Deep learning 运行零快照模型时声明缺少标记器时出错

Deep learning 运行零快照模型时声明缺少标记器时出错,deep-learning,nlp,Deep Learning,Nlp,此示例取自拥抱面,但会产生模型加载错误。我以为我下载了这个模型,但是有没有人知道我可以如何避免这个错误呢?谢谢,威尔 from ktrain import text zsl = text.ZeroShotClassifier() topic_strings=['politics', 'elections', 'sports', 'films', 'television'] doc = 'I am extremely dissatisfied with the President and wil

此示例取自拥抱面,但会产生模型加载错误。我以为我下载了这个模型,但是有没有人知道我可以如何避免这个错误呢?谢谢,威尔

from ktrain import text 
zsl = text.ZeroShotClassifier()
topic_strings=['politics', 'elections', 'sports', 'films', 'television']
doc = 'I am extremely dissatisfied with the President and will definitely vote in 2020.'
zsl.predict(doc, topic_strings=topic_strings, include_labels=True)
结果:


OSError:在tokenizers型号名称列表中未找到型号名称“facebook/bart large mnli”(bart large、bart large mnli、bart large cnn、bart large xsum)。我们假设“facebook/bart large mnli”是一个路径、模型标识符或指向包含名为['vocab.json'、'merges.txt']词汇文件的目录的url,但在该路径或url中找不到此类词汇文件。

derp我手头没有默认模型,因此我将第2行更改为指向我能够正确加载的模型:

zsl = text.ZeroShotClassifier(model_name='bart-large-mnli')

您可能正在使用早于2.11的
transformers
。从2.11<规范>变压器开始,必须使用变压器更改日志中所示的完整型号ID指定BART(和一些其他型号):

URLs to model weights are not hardcoded anymore (@julien-c)
Archive maps were dictionaries linking pre-trained models to their S3 URLs. Since the arrival of the model hub, these have become obsolete.

⚠️ This PR is breaking for the following models: BART, Flaubert, bert-japanese, bert-base-finnish, bert-base-dutch. ⚠️
Those models now have to be instantiated with their full model id:

"cl-tohoku/bert-base-japanese"
"cl-tohoku/bert-base-japanese-whole-word-masking"
"cl-tohoku/bert-base-japanese-char"
"cl-tohoku/bert-base-japanese-char-whole-word-masking"
"TurkuNLP/bert-base-finnish-cased-v1"
"TurkuNLP/bert-base-finnish-uncased-v1"
"wietsedv/bert-base-dutch-cased"
"flaubert/flaubert_small_cased"
"flaubert/flaubert_base_uncased"
"flaubert/flaubert_base_cased"
"flaubert/flaubert_large_cased"

all variants of "facebook/bart"