ℕʘʘ*_*ḆḽḘ 5 python tensorflow2.0 huggingface-transformers
我正在尝试使用简单的pipeline离线功能。我只被允许直接从网络下载文件。
我访问https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english/tree/main并将所有文件下载到本地文件夹中C:\\Users\\me\\mymodel
但是,当我尝试加载模型时,出现了一个奇怪的错误
from transformers import pipeline
classifier = pipeline(task= 'sentiment-analysis',
model= "C:\\Users\\me\\mymodel",
tokenizer = "C:\\Users\\me\\mymodel")
ValueError: unable to parse C:\Users\me\mymodel\modelcard.json as a URL or as a local path
Run Code Online (Sandbox Code Playgroud)
这里有什么问题呢?谢谢!
解决方案有点间接:
save_pretrained()pipeline路径该文件夹将包含所有预期的文件。
| 归档时间: |
|
| 查看次数: |
6933 次 |
| 最近记录: |