[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

好了顺利解决。

相关推荐
Cola可洛2 天前
修复Flyme移植BUG
android·bug
Bear on Toilet2 天前
C++_Bug:现代写法拷贝构造中 swap 写法之小坑
数据结构·c++·bug
aduzhe2 天前
关于在嵌入式中打印float类型遇到的bug
前端·javascript·bug
明雨-开发3 天前
近期发生一个因为渲染导致的bug
bug
程序员小远3 天前
软件测试之bug分析定位技巧
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·bug
眠りたいです3 天前
基于脚手架微服务的视频点播系统-脚手架开发部分(完结)elasticsearch与libcurl的简单使用与二次封装及bug修复
c++·elasticsearch·微服务·云原生·架构·bug
困死了11113 天前
bug【celery】
bug·celery
阿奇__4 天前
el-table有固定列时样式bug
vue.js·elementui·bug
残花月伴6 天前
天机学堂——day1(修改bug)
servlet·bug
std860216 天前
微软 Win11 经典版 Outlook 曝 BUG,加速 SSD 损耗
microsoft·bug·outlook