16

When I try to run the quick start notebook of this repo, I get the error ModuleNotFoundError: No module named 'huggingface_hub.snapshot_download'. How can I fix it? I already installed huggingface_hub using pip.

I get the error after compiling the following cell:

!CUDA_VISIBLE_DEVICES=0 python -u ../scripts/main.py --summarizer gpt3_summarizer --controller longformer_classifier longformer_classifier --loader alignment coherence --controller-load-dir emnlp22_re3_data/ckpt/relevance_reranker emnlp22_re3_data/ckpt/coherence_reranker --controller-model-string allenai/longformer-base-4096 allenai/longformer-base-4096 --save-outline-file output/outline0.pkl --save-complete-file output/complete_story0.pkl --log-file output/story0.log

Here's the entire output:

Traceback (most recent call last):
  File "../scripts/main.py", line 20, in <module>
    from story_generation.edit_module.entity import *
  File "/home/jovyan/emnlp22-re3-story-generation/story_generation/edit_module/entity.py", line 20, in <module>
    from story_generation.common.util import *
  File "/home/jovyan/emnlp22-re3-story-generation/story_generation/common/util.py", line 13, in <module>
    from sentence_transformers import SentenceTransformer
  File "/opt/conda/lib/python3.8/site-packages/sentence_transformers/__init__.py", line 3, in <module>
    from .datasets import SentencesDataset, ParallelSentencesDataset
  File "/opt/conda/lib/python3.8/site-packages/sentence_transformers/datasets/__init__.py", line 3, in <module>
    from .ParallelSentencesDataset import ParallelSentencesDataset
  File "/opt/conda/lib/python3.8/site-packages/sentence_transformers/datasets/ParallelSentencesDataset.py", line 4, in <module>
    from .. import SentenceTransformer
  File "/opt/conda/lib/python3.8/site-packages/sentence_transformers/SentenceTransformer.py", line 25, in <module>
    from .evaluation import SentenceEvaluator
  File "/opt/conda/lib/python3.8/site-packages/sentence_transformers/evaluation/__init__.py", line 5, in <module>
    from .InformationRetrievalEvaluator import InformationRetrievalEvaluator
  File "/opt/conda/lib/python3.8/site-packages/sentence_transformers/evaluation/InformationRetrievalEvaluator.py", line 6, in <module>
    from ..util import cos_sim, dot_score
  File "/opt/conda/lib/python3.8/site-packages/sentence_transformers/util.py", line 407, in <module>
    from huggingface_hub.snapshot_download import REPO_ID_SEPARATOR
ModuleNotFoundError: No module named 'huggingface_hub.snapshot_download'
1
  • 5
    Fixed using pip install huggingface-hub==0.10.1.
    – randomal
    Commented Nov 24, 2022 at 7:23

1 Answer 1

20

Updating to the latest version of sentence-transformers fixes it (no need to install huggingface-hub explicitly):

pip install -U sentence-transformers

I've proposed a pull request for this in the original repo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.