Skip to content

Deleted model after export to save memory #521

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 4 commits into
base: main
Choose a base branch
from

Conversation

asmigosw
Copy link
Contributor

Deleting the model after export is complete and storing only necessary params required either at compile or generation.

# self.state_dict = self.model.state_dict()

# Loading model if weights are in meta state from state_dict
if any(name for name, param in self.model.named_parameters() if param.is_meta):
Copy link
Contributor

Choose a reason for hiding this comment

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

can't we do this check without the for loop, this will loop over all the model params, we can check only one right?
or add a attribute to a model. and check based on that.

Copy link
Contributor

@ochougul ochougul left a comment

Choose a reason for hiding this comment

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

Changes look good to me as first PR.
The re-loading part needs to be figured out, are you planning to do this in next PR?

Please clean the code, we are good to go.

asmigosw and others added 3 commits August 18, 2025 10:26
… better to clean the model before applying onnx transform and code clean up

Signed-off-by: Rishin Raj <[email protected]>
Signed-off-by: Rishin Raj <[email protected]>
@quic-rishinr quic-rishinr marked this pull request as ready for review August 18, 2025 10:35
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.

3 participants