[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

好了顺利解决。

相关推荐
Groundwork Explorer1 天前
wiznet5k.py硬件驱动w5500芯片网卡bug
bug
欧恩意1 天前
【BUG】Bindiff中文乱码问题
bug
系统修复专家1 天前
UG12.0官方未公开修复方法:彻底解决C++异常崩溃问题
开发语言·c++·安全·bug·dll·游戏报错
洛_尘3 天前
测试3:BUG篇
bug
蓝帆傲亦4 天前
Web前端常见Bug及排查处理方案
前端·bug
宁宁Fingerstyle4 天前
CryptoJS.AES “Malformed UTF-8 data” Bug 排查
前端·javascript·typescript·bug
奶茶精Gaaa5 天前
测试能力提升--Bug分析能力
bug
LJianK16 天前
idea自带的数据库修改默认值有bug
bug
这个软件需要设计一下8 天前
ninedata安装磁盘不足问题解决
运维·bug
热爱生活的五柒8 天前
cc-switch安装方法、介绍及遇到的bug
bug·cc-switch