• 1402/06/10

import error در جلسه 86 :

سلام استاد من در جلسه 86 به این ارور می خورم:

 

ImportError                               Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_27516\3526693201.py in <module>
     32 
     33 model_name = "human-centered-summarization/financial-summarization-pegasus"
---> 34 tokenizer = PegasusTokenizer.from_pretrained(model_name)
     35 model = PegasusForConditionalGeneration.from_pretrained(model_name)
     36 

~\anaconda3\lib\site-packages\transformers\utils\import_utils.py in __getattribute__(cls, key)
   1068         if key.startswith("_") and key != "_from_config":
   1069             return super().__getattribute__(key)
-> 1070         requires_backends(cls, cls._backends)
   1071 
   1072 

~\anaconda3\lib\site-packages\transformers\utils\import_utils.py in requires_backends(obj, backends)
   1056     failed = [msg.format(name) for available, msg in checks if not available()]
   1057     if failed:
-> 1058         raise ImportError("".join(failed))
   1059 
   1060 

ImportError: 
PegasusTokenizer requires the SentencePiece library but it was not found in your environment. Checkout the instructions on the
installation page of its repo: https://github.com/google/sentencepiece#installation and follow the ones
that match your environment. Please note that you may need to restart your runtime after installation.
  • 1402/06/11
  • ساعت 13:47

سلام 

هر کدام از دستورات زیر رو جدا گانه امتحان کنید و قبل از ران کردن، کرنل ژوپیتر رو ری‌استارت کنید.

!pip install sentencepiece

!pip install Transformers==3.2.0

logo-enamadlogo-samandehi