[Transforms] Apply, serialize, deserialize #276
[Transforms] Apply, serialize, deserialize #276dsikka wants to merge 3 commits intotransform_arg_supportfrom
Conversation
|
|
||
|
|
||
| def process_transforms_config( | ||
| transforms_config: TransformationConfig, |
There was a problem hiding this comment.
Another example where I think consistency in naming convention will help users. Something like this?
| transforms_config: TransformationConfig, | |
| transform_config: TransformConfig, |
358075b to
fadaaf8
Compare
e7cdea4 to
063d62d
Compare
fadaaf8 to
86e805d
Compare
28c7af5 to
579337d
Compare
| state_dict[weight_name] = f.get_tensor(weight_name) | ||
|
|
||
| for name, submodule in iter_named_leaf_modules(model): | ||
| transform_data = getattr(submodule, "transform_data", None) |
There was a problem hiding this comment.
TransformData includes a dictionary of all the transforms-relevant runtime data, and is attached to the layer as "transform_data"
To me, it seems like this information is essentially duplicating the information of the scheme/args? Why not attach the scheme/args to the module, rather than creating a new abstraction?
| ) | ||
|
|
||
|
|
||
| def process_transforms_config( |
There was a problem hiding this comment.
I missed that this is actually modifying model registering transforms to it. The name process_transforms_config is pretty innocuous for something like this, given it's modifying model significantly. Consider renaming to add_transforms_to_model or something more explicit?
Summary
Process
_transform_{idx} e.g. "weight_transform_0" or "input_activation_transform_0" to try and match the convention of weights, input_activations, and output_activations.TransformDataincludes a dictionary of all the transforms-relevant runtime data, and is attached to the layer as "transform_data" . The keys of the dictionary correspond to the transform parameter names. Note: in the future, if we decide to add another layer to infer runtime/call args on the fly, we can potentially remove TransformData but that is an optimization we can talk about in the future.Apply
apply_transforms_to_parameterandapply_inverse_transforms_to_parameterwhich sandwich QDQSerialize/Deserialize
quantization_configis also extended with atransforms_configin config.jsonload_transformsfunction has been added to load the parameters from disk and add the relevant runtime information. However, this requires the above transformers PR indicated aboveExamples:
Testing
Dependencies: