tensor.H is only supported on matrices (2-D tensors). Got 1-D tensor

Hello folks, I ran into problem that not even allowing me to execute any of my code after import statements:

from fastai2.text.all import *


def app():
    print('Hello')


if __name__ == '__main__':
    app()

I’m getting:

RuntimeError: tensor.H is only supported on matrices (2-D tensors). Got 1-D tensor.

Full stacktrace:

/home/vsaik/projects/diary/sentiment/venv/bin/python /home/vsaik/projects/diary/sentiment/main.py
Traceback (most recent call last):
  File "/home/vsaik/projects/diary/sentiment/main.py", line 1, in <module>
    from fastai2.text.all import *
  File "/home/vsaik/projects/diary/sentiment/venv/lib/python3.8/site-packages/fastai2/text/all.py", line 1, in <module>
    from ..basics import *
  File "/home/vsaik/projects/diary/sentiment/venv/lib/python3.8/site-packages/fastai2/basics.py", line 1, in <module>
    from .data.all import *
  File "/home/vsaik/projects/diary/sentiment/venv/lib/python3.8/site-packages/fastai2/data/all.py", line 1, in <module>
    from ..torch_basics import *
  File "/home/vsaik/projects/diary/sentiment/venv/lib/python3.8/site-packages/fastai2/torch_basics.py", line 4, in <module>
    from .torch_core import *
  File "/home/vsaik/projects/diary/sentiment/venv/lib/python3.8/site-packages/fastai2/torch_core.py", line 312, in <module>
    _patch_tb()
  File "/home/vsaik/projects/diary/sentiment/venv/lib/python3.8/site-packages/fastai2/torch_core.py", line 308, in _patch_tb
    f = getattr(t, fn)
RuntimeError: tensor.H is only supported on matrices (2-D tensors). Got 1-D tensor.

I’m using:
Ubuntu 20.04.4 LTS 64-bit
PyCharm Pro with:
Python 3.8.10
IPython 8.4.0
pip 21.3.1
torch 1.11.0
fastai2 0.0.30
numpy 1.22.4

What could be the reason for such error? Does anyone faced same problem? How to fix it?

Would be helpful for any kind of advice!

2 Likes

I am also facing the same problem while practicing the pets breed classification class. Please let me know if you’ve found out the solution to this.

same here having this problem using google colab and jupyter

I myself have been using Google Colab. Hoping that someone might have the answer.

Same issue here. Found any solution?

I had the same issue when I installed PyTorch via the recommended way on Start Locally | PyTorch and then installed fastai via conda or pip (Linux) after that. I tried both 11.3 and 11.6 PyTorch and had the same issue. What solved it was simply setting up a new clean environment and starting with conda install -c fastchan fastai (+ pip install nbdev)

FWIW, this “install fastai first” approach seems to install torch version 11.5 so I’m guessing 11.3 and 11.6 somehow conflict with fast.ai.

Thanks @rother

For some reason your conda command get stuck at 0 when installing pytorch-1.11.0 and cudatoolkit-11.5.1 . Did you face the same issue?

Cheers

Please don’t cross-post @baldoino

Sorry @jeremy. I will remove this post.