【问题标题】:Transformers model from Hugging-Face throws error that specific classes couldn t be loadedHugging-Face 的变形金刚模型引发无法加载特定类的错误
【发布时间】:2022-01-07 14:43:30
【问题描述】:
您好,在下面运行此代码后,我收到以下错误。
ValueError:无法使用以下任何类加载模型 facebook/bart-large-mnli:(,)。 p>
import tensorflow as tf
from transformers import pipeline
classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
有人可以帮忙吗?
谢谢!
【问题讨论】:
标签:
python
tensorflow
nlp
huggingface-transformers
【解决方案1】:
之前在变形金刚回购中以Github issue 提出了该问题。 cmets 指向内存问题。链接中的主题还建议您可以使用几种解决方法
【解决方案2】:
使用以下内容:
!pip install pytorch-pretrained-bert
import pytorch_pretrained_bert as ppb
assert 'bert-large-cased' in ppb.modeling.PRETRAINED_MODEL_ARCHIVE_MAP
现在运行您的原始代码。