[英]using pipelines with a local model
I am trying to use a simple pipeline
offline.我正在尝试离线使用简单的
pipeline
。 I am only allowed to download files directly from the web.我只能直接从网上下载文件。
I went to https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english/tree/main and downloaded all the files in a local folder C:\\\\Users\\\\me\\\\mymodel
我去了https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english/tree/main并下载了本地文件夹
C:\\\\Users\\\\me\\\\mymodel
所有文件
However, when I tried to load the model I get a strange error但是,当我尝试加载模型时,出现了一个奇怪的错误
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
What is the issue here?这里有什么问题? Thanks!
谢谢!
Must be either of the two cases:必须是以下两种情况之一:
FYI, I am listing out the required contents in the directory:仅供参考,我在目录中列出了所需的内容:
the solution was slightly indirect:解决方案有点间接:
save_pretrained()
save_pretrained()
保存模型pipeline
callpipeline
调用中指向它的路径The folder will contain all the expected files.该文件夹将包含所有预期文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.