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

Remove quantization related config from dequantized model #34856

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/transformers/quantizers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,10 @@ def dequantize(self, model):

# Delete quantizer and quantization config
del model.hf_quantizer

del model.config.quantization_config
del model.config._pre_quantization_dtype
model.is_quantized = False
Comment on lines +218 to +220
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quantizer seems better place for it than PreTrainedModel.

Not sure if that's 100% exhaustive, but it was enough to solve my issue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, sounds good to me !


return model

def _dequantize(self, model):
Expand Down