-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Init partial network parameters from another saved model. #2664
Conversation
@@ -187,7 +184,7 @@ def __setitem__(self, key, value): | |||
(shape, value.shape)) | |||
|
|||
if len(self.__gradient_machines__) == 0: | |||
self.__tmp_params__.append((key, value)) |
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.
The append
could lead the repeated key in self.__tmp_params__
. This is a bug.
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.
LGTM, except a tiny enhancement for Python syntax.
@@ -302,6 +299,12 @@ def from_tar(f): | |||
params.deserialize(param_name, f) | |||
return params | |||
|
|||
def init_from_tar(self, f): |
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.
Because from_tar
is a static method. Maybe Parameters.from_tar
is better.
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.
Done.
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.
Maybe we should add comment to describe the usage scenario about from_tar
and init_from_tar
.
@pkuyym add comments. |
The usage example should be :
|
Fix #2663
The usage example is: