The error about transformers is as follows:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-71d1402da22e> in <module>
----> 1 from transformers import pipeline
2
3 nlp = pipeline("sentiment-analysis")
4
5 result = nlp("I hate you")[0]
ImportError: cannot import name 'pipeline' from 'transformers' (unknown location)
The same can not be imported when changing to the Pipeline class.
The official 4.3.2 version of the document does write this API interface, and I am also using version 4.3.2, but this error is reported.
My environment is:
- Ananconda3's base environment
- python3.7
- tensorflow2.0.0
- transformers4.3.2
- jupyter notebook
Ask for answers and comments.
Resolved:
Reduce the version to be used normally. I saw some questions in the github of this framework, including version issues. There are some bugs or refactoring in the new version. I switched to version 3.0.2 and used it normally.