-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
转换规则 torch.hub.load_state_dict_from_url #226
base: master
Are you sure you want to change the base?
Conversation
Thanks for your contribution! |
torch.utils.model_zoo.load_url _test_alias_case_1()在ci上的pytorch版本已去掉,运行ci会报错,因此单测加_跳过,提供本地运行截图 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这两个API的功能上是一致的不
在支持转换的参数中,是一致的 |
"unsupport_args": [ | ||
"model_dir", | ||
"map_location", | ||
"progress", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pytorch_code = textwrap.dedent( | ||
""" | ||
import torch | ||
state_dict = torch.hub.load_state_dict_from_url('https://s3.amazonaws.com/pytorch/models/resnet18-5c106cde.pth') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看了下这两个API的返回结果不同,torch返回的是一个Layer的state_dict结果,paddle返回的是一个路径,所以是不是paddle的还需要包装下,比如加一个load之类的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加load之后还是不能实现直接转换,原因是:torch 的.pth权重文件,paddle直接load .pth可能会报错
PR Docs
PaddlePaddle/docs#6090
PR APIs