關于transformers的報錯如下:
```bash
---------------------------------------------------------------------------
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)
```
換成Pipeline類也一樣無法匯入。
官方4.3.2版本的檔案上確實寫有這個API介面,我用的也是4.3.2版本,但是卻是報了這個錯誤。
我的環境是:

- Ananconda3的base環境
- python3.7
- tensorflow2.0.0
- transformers4.3.2
- jupyter notebook
**求解答評論。**
我的原文鏈接:https://blog.csdn.net/qq_42658739/article/details/114239961
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/264619.html
標籤:人工智能技術
