[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

好了顺利解决。

相关推荐
致微2 天前
Vue项目 bug 解决
前端·vue.js·bug
网安小陈2 天前
【网安】处理项目中的一些常见漏洞bug(java相关)
java·开发语言·数据库·安全·web安全·网络安全·bug
北冥有鱼被烹4 天前
【问题记录】C语言一个程序bug定位记录?(定义指针数组忘记[])
c语言·bug
越学不动啦5 天前
三、概念篇+Bug篇
bug·测试·软件测试入门·bug测试
伏游5 天前
【BUG】生产环境死锁问题定位排查解决全过程
服务器·数据库·spring boot·后端·postgresql·bug
越学不动啦7 天前
四、Bug篇+用例篇
软件测试·测试用例·bug·软件工程·测试基础
有时间要学习7 天前
Test——BUG篇
bug·测试
猫猫头有亿点炸9 天前
电脑连不上手机热点会出现的小bug
bug
不想加班的码小牛10 天前
第4期:重构软件测试体系——生成式AI如何让BUG无所遁形
人工智能·重构·bug·集成测试
limanjihe10 天前
PrimeTime生成.lib竟暗藏PG添加Bug
bug