Skip to content
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

Fix onnx export for quantized MPT models #1646

Merged
merged 4 commits into from
Jul 13, 2023
Merged

Conversation

eldarkurtic
Copy link
Contributor

Empty dict raises an exception when exporting quantized MPT models because when state_dict = {}, the HF loading pipeline will try to initialize the model by calling _init_weights for each module. However, for MPT models, this function is not defined and will therefore raise an exception.

@bfineran on a side note, I am not really sure what this function is supposed to do. According to the code it will return either None (for pruned model) or {} (for quantized model), but never the actual loaded state_dict as mentioned in the docstring. We might want to rethink whether we need to refactor the function and its usage, or at least to update the docstring because at the moment they don't match.

Empty dict raises an exception when exporting quantized MPT models because when `state_dict = {}`, the HF loading pipeline will try to initialize the model by calling `_init_weights` for each module. However, for MPT models, this function is not defined and will therefore raise an exception.

@neuralmagic/machine-learning on a side note, I am not really sure what this function is supposed to do. According to the code it will return either `None` (for pruned model) or `{}` (for quantized model), but never the actual loaded `state_dict` as mentioned in the docstring. We might want to rethink whether we need to refactor the function and its usage, or at least to update the docstring?
@eldarkurtic eldarkurtic merged commit 488dfaf into main Jul 13, 2023
20 checks passed
@eldarkurtic eldarkurtic deleted the fix-quant-MPT-export branch July 13, 2023 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants