You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[2023-07-10 11:45:44,857] [ EVAL] - Saving best model to img_classification_ckpt/best_model [best acc=0.6710]
[2023-07-10 11:45:44,860] [ INFO] - Saving model checkpoint to img_classification_ckpt/epoch_1
加载模型的代码:
import paddle
import paddlehub as hub
if __name__ == '__main__':
model = hub.Module(name='resnet50_vd_imagenet_ssld', label_list=["roses", "tulips", "daisy", "sunflowers", "dandelion"], load_checkpoint='img_classification_ckpt/')
result = model.predict(['flower.jpg'])
报错:
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/setuptools/depends.py:2: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
Traceback (most recent call last):
File "untitled.py", line 6, in <module>
model = hub.Module(name='resnet50_vd_imagenet_ssld', label_list=["roses", "tulips", "daisy", "sunflowers", "dandelion"], load_checkpoint='img_classification_ckpt/')
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/module/module.py", line 396, in __new__
**kwargs)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddlehub/module/module.py", line 511, in init_with_name
return user_module_cls(**kwargs)
File "/home/aistudio/.paddlehub/modules/resnet50_vd_imagenet_ssld/module.py", line 240, in __init__
self.model_dict = paddle.load(load_checkpoint)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/framework/io.py", line 1103, in load
load_result = _legacy_load(path, **configs)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/framework/io.py", line 1150, in _legacy_load
load_result = _load_state_dict_from_save_params(model_path)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/framework/io.py", line 147, in _load_state_dict_from_save_params
attrs={'file_path': os.path.join(model_path, name)},
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/tracer.py", line 314, in trace_op
stop_gradient, inplace_map)
File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/tracer.py", line 176, in eager_legacy_trace_op
returns = function_ptr(*arg_list, *attrs_list)
ValueError: (InvalidArgument) Deserialize to tensor failed, maybe the loaded file is not a paddle model(expected file format: 0, but 1667433344 found).
[Hint: Expected version == 0U, but received version:1667433344 != 0U:0.] (at /paddle/paddle/phi/core/serialization.cc:106)
[operator < load > error]
欢迎您反馈PaddleHub使用问题,非常感谢您对PaddleHub的贡献!
在留下您的问题时,辛苦您同步提供如下信息:
1)PaddleHub和PaddlePaddle版本:PaddlePaddle 2.4.0,paddleHub 2.3.0
2)系统环境:AIStudio,python 1.7.4,
直接运行教程里面迁移学习-图像分类 的代码,完成迁移学习后,加载模型报错。
使用AIstudio、本地 运行都出现一样的错误。
迁移学习成功:
加载模型的代码:
报错:
迁移学习后,生成的文件结构是:
做过以下尝试,依旧不行
The text was updated successfully, but these errors were encountered: