Size mismatch when running locally but not on Colab

Hi

I’ve been running my code in Colab for a couple months and now I’m trying to execute the same code on a local file. However, I’m getting this:

RuntimeError: size mismatch, m1: [16 x 3], m2: [8192 x 3] at /pytorch/aten/src/THC/generic/THCTensorMathBlas.cu:283

On a line that runs perfectly fine on Colab (m2 is 3x8192). I have checked my versions and everything is up to date. I can and will probably track this down and transpose the tensor so that there is no missmatch, but I just don’t get why the tensor shape changes when using the same in Colab notebooks and in a local .py file.

Any ideas?

EDIT: Adding traceback in case it helps

Traceback (most recent call last):
  File "SFA_Single_Feat.py", line 242, in <module>
    zt = sfa(xt)
  File "/home/maroov/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/maroov/.local/lib/python3.8/site-packages/torch/nn/modules/container.py", line 100, in forward
    input = module(input)
  File "/home/maroov/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 550, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/maroov/.local/lib/python3.8/site-packages/torch/nn/modules/linear.py", line 87, in forward
    return F.linear(input, self.weight, self.bias)
  File "/home/maroov/.local/lib/python3.8/site-packages/torch/nn/functional.py", line 1610, in linear
    ret = torch.addmm(bias, input, weight.t())
RuntimeError: size mismatch, m1: [16 x 3], m2: [8192 x 3] at /pytorch/aten/src/THC/generic/THCTensorMathBlas.cu:283

go on colab, export the libraries you are using and their versions with:

pip freeze > requirements.txt

From there, pip install the libraries in the txt locally.

Clear GPU cache, re-run and it should work if its library related.

Okay so in the end it was not related to libraries, it was just a typo in a parameter (yay!). It is working now.