-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Retiarii serializer user experience improvements #4437
Conversation
nni/retiarii/evaluator/functional.py
Outdated
@@ -26,6 +26,7 @@ def _load(ir): | |||
|
|||
def _dump(self): | |||
return { | |||
'type_name': self.__class__, |
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.
what is the type of self.__class__
? is it safe to dump this self.__class__
object and load it in another environment (e.g., another machine)?
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.
Its type is "type". nni.dump
and nni.load
will handle the serialization of a "type" object.
- If we can get its path, we dump it into a path. e.g.,
torch.nn.Conv2d
. - Otherwise, we dump it into a binary. e.g., class defined in a jupyter notebook.
To simplify unit-tests, I also allow subclass class name here. But actually it's not used in practice.
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.
Since it's a type object, why the key is called "type name"?
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.
Good question. I copied from operation.py
. Let me fix it.
Description
model_wrapped
in Retiarii experiment.Checklist
test caseHow to test
Same as #4390.