Open ismaelfernandezdelacoteralorenzo opened 7 months ago
Hello,
Thanks for opening an issue here.
The issue originates directly from the import of torch
, i.e. via from torch.utils.data import Dataset
, so I suspect that there is some issue with your torch installation. If you run the following code:
from torch.utils.data import Dataset
Do you also get this same crash?
People have gotten the same error message online a few times before, often times it was related to a file/directory called torch
or an incorrect torch
installation (which was sometimes solved with reinstalling torch
).
Otherwise, others have experienced the same issue with Sentence Transformers: #1758. Perhaps you also have luck with Python 3.9?
Indeed, when executing said line the same error appears. I have tried reinstalling torch and I can't get rid of the problem, so I will try changing the version of Python. But the truth is, it's something I don't know how to do to use version 3.9.
Indeed, when executing said line the same error appears. I have tried reinstalling torch and I can't get rid of the problem, so I will try changing the version of Python. But the truth is, it's something I don't know how to do to use version 3.9.
hello, how you solved the problem, because it happened to me and i received the same log
Once I installed the sentence transformer package apparently without any problem, when I execute the command "from sentence_transformers import SentenceTransformer" I get the following error:
ModuleNotFoundError Traceback (most recent call last) Cell In[1], line 1 ----> 1 from sentence_transformers import SentenceTransformer
File ~\anaconda3\Lib\site-packages\sentence_transformers__init.py:3 1 version = "2.6.1" 2 MODEL_HUB_ORGANIZATION__ = "sentence-transformers" ----> 3 from .datasets import SentencesDataset, ParallelSentencesDataset 4 from .LoggingHandler import LoggingHandler 5 from .SentenceTransformer import SentenceTransformer
File ~\anaconda3\Lib\site-packages\sentence_transformers\datasets__init__.py:1 ----> 1 from .DenoisingAutoEncoderDataset import DenoisingAutoEncoderDataset 2 from .NoDuplicatesDataLoader import NoDuplicatesDataLoader 3 from .ParallelSentencesDataset import ParallelSentencesDataset
File ~\anaconda3\Lib\site-packages\sentence_transformers\datasets\DenoisingAutoEncoderDataset.py:1 ----> 1 from torch.utils.data import Dataset 2 from typing import List 3 from ..readers.InputExample import InputExample
File ~\anaconda3\Lib\site-packages\torch\utils__init__.py:4 1 import os.path as _osp 2 import torch ----> 4 from .throughput_benchmark import ThroughputBenchmark 5 from .cpp_backtrace import get_cpp_backtrace 6 from .backend_registration import rename_privateuse1_backend, generate_methods_for_privateuse1_backend
File ~\anaconda3\Lib\site-packages\torch\utils\throughput_benchmark.py:2 ----> 2 import torch._C 5 def format_time(time_us=None, time_ms=None, time_s=None): 6 """Define time formatting."""
ModuleNotFoundError: No module named 'torch._C'
I don't know how to solve it, I have verified that Torch is correctly installed. Any ideas?? thank you so much