报错信息如下
File "/root/app/app.py", line 9, in <module>
model = ORTModelForSequenceClassification.from_pretrained(file_name, local_files_only=True, force_download=False,
File "/opt/conda/lib/python3.9/site-packages/optimum/modeling_base.py", line 183, in from_pretrained
config_file = hf_hub_download(
File "/opt/conda/lib/python3.9/site-packages/huggingface_hub/file_download.py", line 1022, in hf_hub_download
cache_dir, repo_folder_name(repo_id=repo_id, repo_type=repo_type)
File "/opt/conda/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 92, in _inner_fn
validate_repo_id(arg_value)
File "/opt/conda/lib/python3.9/site-packages/huggingface_hub/utils/_validators.py", line 136, in validate_repo_id
raise HFValidationError(
huggingface_hub.utils._validators.HFValidationError: Repo id must be in the form 'repo_name' or 'namespace/repo_name': '/root/app/emoji.onnx'. Use `repo_type` argument if needed.
代码如下
file_name = "/root/app/emoji.onnx"
model = ORTModelForSequenceClassification.from_pretrained(file_name, local_files_only=True, force_download=False,repo_type='local')
tokenizer = AutoTokenizer.from_pretrained(file_name, local_files_only=True, force_download=False, repo_type='local')
onnx_classifier = pipeline(
task="text-classification",
model=model,
tokenizer=tokenizer,
top_k=None,
function_to_apply="sigmoid", # optional as is the default for the task
)
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.