ModuleNotFoundError: No module named ‘sentence_transformers‘

场景

使用PyG导入MovieLens数据集:

dataset = MovieLens(root='data/MovieLens', model_name='all-MiniLM-L6-v2')
print(dataset)

报错信息

F:\Anaconda3\python.exe ""
Downloading https://files.grouplens.org/datasets/movielens/ml-latest-small.zip
Extracting data\MovieLens\raw\ml-latest-small.zip
Processing...
Traceback (most recent call last):
  File "", line 17, in <module>
    dataset = MovieLens(root='data/MovieLens', model_name='all-MiniLM-L6-v2')
  File "F:\Anaconda3\lib\site-packages\torch_geometric\datasets\movie_lens.py", line 40, in __init__
    super().__init__(root, transform, pre_transform)
  File "F:\Anaconda3\lib\site-packages\torch_geometric\data\in_memory_dataset.py", line 57, in __init__
    super().__init__(root, transform, pre_transform, pre_filter)
  File "F:\Anaconda3\lib\site-packages\torch_geometric\data\dataset.py", line 88, in __init__
    self._process()
  File "F:\Anaconda3\lib\site-packages\torch_geometric\data\dataset.py", line 171, in _process
    self.process()
  File "F:\Anaconda3\lib\site-packages\torch_geometric\datasets\movie_lens.py", line 61, in process
    from sentence_transformers import SentenceTransformer
ModuleNotFoundError: No module named 'sentence_transformers'

Process finished with exit code 1

解决

安装sentence-transformers:

pip install -U sentence-transformers -i https://pypi.douban.com/simple

你可能感兴趣的:(PyG,PyG,MovieLens)