Forums

Import leads to "RuntimeError: function '_has_torch_function' already has a docstring"

Hi,,

I'm trying to import the module sentence_transformers and am unable because I get the error: "RuntimeError: function '_has_torch_function' already has a docstring". I'm able to run it in a venv, but not without it. I can't uninstall the folder torch because I get a 'permission denied' error. The full error says

"` from sentence_transformers import SentenceTransformer, util

File "/home/plainyogurt/.local/lib/python3.10/site-packages/sentence_transformers/_ _init__.py", line 3, in <module>

from .datasets import SentencesDataset, ParallelSentencesDataset

File "/home/plainyogurt/.local/lib/python3.10/site-packages/sentence_transformers/d atasets/init.py", line 1, in <module>

from .DenoisingAutoEncoderDataset import DenoisingAutoEncoderDataset

File "/home/plainyogurt/.local/lib/python3.10/site-packages/sentence_transformers/d atasets/DenoisingAutoEncoderDataset.py", line 1, in <module>

from torch.utils.data import Dataset

File "/usr/local/lib/python3.10/site-packages/torch/init.py", line 596, in <mod ule>

from ._tensor import Tensor

File "/usr/local/lib/python3.10/site-packages/torch/_tensor.py", line 15, in <modul e>

from torch.overrides import (

File "/usr/local/lib/python3.10/site-packages/torch/overrides.py", line 1404, in <m odule>

has_torch_function = _add_docstr(

RuntimeError: function '_has_torch_function' already has a docstring`

Try to use virtual environment for that.