-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Conversation
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
|
||
Also it records extra information about where this object comes from. That's why it's called "trace". | ||
When parameters of functions are received, it is first stored, and then a shallow copy will be passed to inner function. |
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 meaning of "inner function"? is there example for it?
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 inner function means the wrapped function/class. Will update to clarify this.
return obj.__json_encode__() | ||
if isinstance(obj.trace_symbol, property): | ||
# commonly made mistake when users forget to call the traced function/class. | ||
warnings.warn(f'The symbol of {obj} is found to be a property. Did you forget to create the instance with ``xx(...)``?') |
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.
this is only a warning, not an error?
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.
We can't be sure. In rare cases, they might actually want this as expected behavior.
def __enter__(self): | ||
# For example, currently the top of stack is [1, 2, 2], and [1, 2, 2, 3] is used, | ||
# the next thing up is [1, 2, 2, 4]. | ||
# `reset_uid` to count from zero for "model_wrapper_1_2_2_4" |
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 relation between this label and user provided label?
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.
If user provides a label, it will always override this label.
@ultmaster when should users use |
Users should never use I don't know about compression. For NAS, the planned user interfaces that implicitly use
So, how is
|
This PR will be merged, and @QuanluZhang comments could be fixed in the following PR if they are required. |
Description
This PR refines the serialization infrastructure as introduced in the previous release, and integrates it with Retiarii.
Adopt
nni.load
andnni.dump
in most cases where serialization is used in NNI.I think this PR is big enough. I'll leave the work of
evaluator_fn
(to support evaluator that doesn't need to wrap with serialize) in a future PR.Checklist
How to test
See
test/ut/sdk/test_serializer.py
. Needs to test NAS multi-trial examples and integration tests.