通过modelscope调用本地图片分类模型,报错:
2023-09-21 14:38:46,038 - modelscope - INFO - PyTorch version 2.0.1 Found.
2023-09-21 14:38:46,039 - modelscope - INFO - Loading ast index from /home/aigc/.cache/modelscope/ast_indexer
2023-09-21 14:38:46,064 - modelscope - INFO - Loading done! Current index file version is 1.9.1, with md5 73f95558bb285a59afef388db22ce97f and a total number of 924 components indexed
2023-09-21 14:38:46,485 - modelscope - INFO - initialize model from /model/cv_resnest101_general_recognition/
Traceback (most recent call last):
File "/home/aigc/magaoxiang/bin/test1.py", line 7, in
model = Model.from_pretrained('/model/cv_resnest101_general_recognition/')
File "/home/aigc/.conda/envs/PersonalDigitalAssistant/lib/python3.9/site-packages/modelscope/models/base/base_model.py", line 145, in from_pretrained
model_cfg = cfg.model
File "/home/aigc/.conda/envs/PersonalDigitalAssistant/lib/python3.9/site-packages/modelscope/utils/config.py", line 296, in getattr
return getattr(self._cfg_dict, name)
File "/home/aigc/.conda/envs/PersonalDigitalAssistant/lib/python3.9/site-packages/modelscope/utils/config.py", line 55, in getattr
raise ex
AttributeError: 'ConfigDict' object has no attribute 'model'
代码如下:
from modelscope.models import Model
from modelscope.pipelines import pipeline
model = Model.from_pretrained('/model/cv_resnest101_general_recognition/')
picture_recognition = pipeline('general-recognition', model=model)
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。