question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Matrix multiplication error during training TFT

See original GitHub issue

Environment Details

  • Python version: 3.7.10
  • Operating System: Google Colab web platform

Error Description

I get a matrix multiplication error during training TFT

RuntimeError: mat1 and mat2 shapes cannot be multiplied (4608x2 and 1x32)

Steps to reproduce

  1. Open Colab https://colab.research.google.com/
  2. Run the code
!pip install pytorchts -q
!curl https://forecasters.org/data/m3comp/M3C.xls --create-dirs -o /root/.mxnet/gluon-ts/datasets/M3C.xls 

from gluonts.dataset.repository.datasets import get_dataset
from pts.model.tft import TemporalFusionTransformerEstimator
from pts import Trainer

dataset = get_dataset("m3_monthly", regenerate=False)

estimator = TemporalFusionTransformerEstimator(
    freq=dataset.metadata.freq,
    prediction_length=dataset.metadata.prediction_length,
    context_length=dataset.metadata.prediction_length,
    dropout_rate=0.1,
    num_outputs=15,
    trainer=Trainer(device='cpu',
                    epochs=20,
                    learning_rate=1e-3,
                    num_batches_per_epoch=100,
                    batch_size=128))

predictor = estimator.train(dataset.train)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13

github_iconTop GitHub Comments

1reaction
kashifcommented, Jun 2, 2021

@nsoma97 @vpozdnyakov sorry i didnt get time to look into it… I will try to squeeze it in this week… the issue most probably is that I have some value hard-coded from the dataset I was testing with…

0reactions
vpozdnyakovcommented, Jul 7, 2021

it works, thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pytorch GAN model doesn't train: matrix multiplication error
I'm trying to build a basic GAN to familiarise myself with Pytorch. I have some (limited) experience with Keras, but since I'm bound...
Read more >
The 3 Most Common PyTorch Errors (And How To Solve Them)
Let's try matrix multiplication. Oh no! This is a shape error, as our two tensors (matrices) can't be matrix multiplied because their shapes ......
Read more >
Overflow in matrix multiplication - SAS Support Communities
Solved: Hi, I have some code that tries to minimize a function. The code is below: start odr_yrly (matrix, year); yr_odr = j(nrow(matrix), ......
Read more >
Incorrect dimensions for matrix multiplication. - MathWorks
Error using *. Incorrect dimensions for matrix multiplication. Check that the number. of columns in the first matrix matches the number of rows...
Read more >
Straggler Mitigation through Unequal Error Protection for ...
As a remedy to this problem, we employ Unequal Error Protection (UEP) codes to obtain an approximation of the matrix product in the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found