[Bug] Error: cannot import name ‘ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST‘

code

复制代码
BRANCH = 'r1.23.0'

!python -m pip install git+https://github.com/NVIDIA/NeMo.git@$BRANCH#egg=nemo_toolkit[all]

# Ignore pre-production warnings

import warnings

warnings.filterwarnings('ignore')

import nemo

# Import Speech Recognition collection

import nemo.collections.asr as nemo_asr

# Import Natural Language Processing collection

import nemo.collections.nlp as nemo_nlp

# Import Speech Synthesis collection

import nemo.collections.tts as nemo_tts

# We'll use this to listen to audio

import IPython

出现下面的错误

复制代码
---------------------------------------------------------------------------
复制代码
ImportError                               Traceback (most recent call last)
复制代码
<ipython-input-16-57327be21084> in <cell line: 8>()
      6 import nemo.collections.asr as nemo_asr
      7 # Import Natural Language Processing collection
----> 8 import nemo.collections.nlp as nemo_nlp
      9 # Import Speech Synthesis collection
     10 import nemo.collections.tts as nemo_tts

ImportError: cannot import name 'ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST' from 'transformers' (/usr/local/lib/python3.10/dist-packages/transformers/__init__.py)

/usr/local/lib/python3.10/dist-packages/nemo/collections/nlp/modules/common/huggingface/huggingface_utils.py in <module> 16 from typing import List, Optional 17 ---> 18 from transformers import ( 19 ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST, 20 BERT_PRETRAINED_MODEL_ARCHIVE_LIST,

分析和解决

import nemo.collections.nlp as nemo_nlp

这一步有问题,但是根本原因还是 transformers 版本有点问题,找到对应的版本即可。

所以重新安装一下下面版本的transformers

!pip uninstall transformers

!pip install transformers==4.36.0

好了顺利解决。

相关推荐
!chen2 天前
Oracle 19.20未知BUG导致oraagent进程内存泄漏
数据库·oracle·bug
SAP龙哥4 天前
SAP在未启用负库存的情况下,库存却出现了负数-补充S4 1709 BUG
运维·bug
lxmyzzs4 天前
【已解决】YOLO11模型转wts时报错:PytorchStreamReader failed reading zip archive
人工智能·python·深度学习·神经网络·目标检测·计算机视觉·bug
JHCan3334 天前
一个没有手动加分号引发的bug
前端·javascript·bug
lxmyzzs4 天前
【已解决】Jetson Orin NX apt更换国内源
嵌入式硬件·计算机视觉·bug
JAVA学习通5 天前
【测试开发】---Bug篇
bug
兰琛5 天前
android 小bug :文件冲突的问题
android·学习·bug
GeminiJM5 天前
一次粗心导致的bug定位
前端·chrome·bug
lxmyzzs5 天前
【已解决】 GStreamer找不到编码器
ubuntu·bug·视频编解码
lxmyzzs6 天前
【bug】 jetson上opencv无法录制h264本地视频
opencv·bug·音视频