[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

好了顺利解决。


 

相关推荐

最近更新

  1. TCP协议是安全的吗?

    2024-06-08 18:44:02       8 阅读
  2. 【Python教程】压缩PDF文件大小

    2024-06-08 18:44:02       9 阅读
  3. 通过文章id递归查询所有评论(xml)

    2024-06-08 18:44:02       10 阅读

热门阅读

  1. SD-WAN加速跨国服务器访问

    2024-06-08 18:44:02       6 阅读
  2. Spring Boot中实现规则引擎源码教程

    2024-06-08 18:44:02       7 阅读
  3. android:text 总为大写字母的原因

    2024-06-08 18:44:02       7 阅读
  4. input只允许输入数字

    2024-06-08 18:44:02       6 阅读
  5. 数据结构汇总学习(ing)

    2024-06-08 18:44:02       6 阅读
  6. 注解 - @RequestBody

    2024-06-08 18:44:02       6 阅读
  7. 阿里云一键登录号码认证服务

    2024-06-08 18:44:02       6 阅读
  8. pytorch里面封装好的函数,如果要修改怎么办

    2024-06-08 18:44:02       7 阅读
  9. C语言——第五章习题

    2024-06-08 18:44:02       5 阅读
  10. 动手学深度学习——tensor

    2024-06-08 18:44:02       6 阅读
  11. MySQL 运算符以及优先级

    2024-06-08 18:44:02       8 阅读