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

TST: Fix some tests that would fail with torch.compile #949

Conversation

BenjaminBossan
Copy link
Member

@BenjaminBossan BenjaminBossan commented Sep 19, 2023

Some tests would currently fail with torch.compile, not because there is anything wrong with how PEFT works with compiled models, but simply because of the way the tests are written. This is because when models are compiled, the keys of the state dict change. Tests have now been adapted to unwrap the compiled model first before getting the state dict.

Note that the mentioned issue does not affect saving and loading, because save_pretrained is already called on the original module, so there is no issue with mismatched keys.

While working on this, I also fixed the docstring of get_peft_model_state_dict.

Running the torch.compile tests against this branch failed, probably because it's a fork :-/ https://github.com/huggingface/peft/actions/runs/6238068686/job/16933091996

Some tests would currently fail with torch.compile, not because there is
anything wrong with how PEFT works with compiled models, but simply
because of the way the tests are written. This is because when models
are compiled, the keys of the state dict change. Tests have now been
adapted to unwrap the compiled model first before getting the state
dict.

Note that the mentioned issue does not affect saving and loading,
because save_pretrained is already called on the original module, so
there is no issue with mismatched keys.

While working on this, I also fixed the docstring of
get_peft_model_state_dict.
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Sep 19, 2023

The documentation is not available anymore as the PR was closed or merged.

Copy link
Contributor

@younesbelkada younesbelkada left a comment

Choose a reason for hiding this comment

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

Thanks a lot @BenjaminBossan !

@BenjaminBossan BenjaminBossan merged commit 39264a0 into huggingface:main Sep 21, 2023
11 checks passed
@BenjaminBossan BenjaminBossan deleted the tst-fixing-some-tests-to-work-with-torch-compile branch September 21, 2023 07:46
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