Skip to content

Cleaned and Rebased PR for (#481) to change the hash creation module … #537

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

quic-dhirajku
Copy link
Contributor

…for all models in Qefficient.

This PR contains changes made to the modelling_qeff, modeling_auto to allow usage of certain export parameters and kwargs passed during model creation. The hashing module is now made independant of the calling class and the test scripts are updated accordingly to test for this functionality. Added functionality to have an overarching parent directory in cache to contain all different exported model configs belonging to the same architecture. In case the architecture isn't present in the config of the model, we instead proceed with self.model_name based parent directory creation. Hash is now created during export, so as to incorporate all the additional params needed for unique hash creation thus, the test scripts have been modified to test hashing functionalities accordingly. We maintain an Exclusion list of params for kwargs to be discarded during hashing parameter selection. We'll need to look into the alternate approach of maintaining an Inclusion list instead. There was a comment to use MetaClasses to handle raising a warning whenever someone loads a model without using 'from_pretrained' method but the current class architecture of VLMs and SpeechSeq2Seq models don't allow for this, this use case will be handled in a different PR.

Copy link
Contributor

@quic-hemagnih quic-hemagnih left a comment

Choose a reason for hiding this comment

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

As discussed please prepare the inclusion list instead of exclusion list. This approach will have full control on the set of parameters which are included in hash computation. Exclusion list may lead to surprises.

@quic quic deleted a comment from quic-hemagnih Aug 13, 2025
…ule for all models in Qefficient.

This PR contains changes made to the modelling_qeff, modeling_auto to allow usage of certain export parameters and kwargs passed during model creation.
The hashing module is now made independant of the calling class and the test scripts are updated accordingly to test for this functionality.
Added functionality to have an overarching parent directory in cache to contain all different exported model configs belonging to the same architecture.
In case the architecture isn't present in the config of the model, we instead proceed with  self.model_name based parent directory creation.
Hash is now created during export, so as to incorporate all the additional params needed for unique hash creation thus, the test scripts have been modified to test hashing functionalities accordingly.
We maintain an Exclusion list of params for kwargs to be discarded during hashing parameter selection. We'll need to look into the alternate approach of maintaining an Inclusion list instead.
There was a comment to use MetaClasses to handle raising a warning whenever someone loads a model without using 'from_pretrained' method but the current class architecture of VLMs and SpeechSeq2Seq models don't allow for this, this use case will be handled in a different PR.

Signed-off-by: Dhiraj Kumar Sah <[email protected]>
Moved the export path and hash creation functionality as well as json dumping functionality to a wrapper function of export.
Created a Kwargs_Inclusion_list and we perform the list check during base_model initialization itself instead of doing it during export.
Moved all the hash related functionalities to hash_utils file.
Added try catch exceptions for json object dumping as well as creation.
patched for the case where a Peft model config is sometimes returned as LoraConfig and sometimes as dict.
Modified dummy model testing scripts to monkeypatch QEFF_HOME in the updated script instead of modelling_qeff

Signed-off-by: Dhiraj Kumar Sah <[email protected]>
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.

4 participants