-
Notifications
You must be signed in to change notification settings - Fork 6k
[tests] device_map tests for all models. #11708
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
Conversation
tests/models/test_modeling_common.py
Outdated
def test_passing_dict_device_map_works(self, name, device_map): | ||
# There are other valid dict-based `device_map` values too. It's best to refer to | ||
# the docs for those: https://huggingface.co/docs/accelerate/en/concept_guides/big_model_inference#the-devicemap. | ||
init_dict, inputs_dict = self.prepare_init_args_and_inputs_for_common() | ||
model = self.model_class(**init_dict).eval() | ||
with tempfile.TemporaryDirectory() as tmpdir: | ||
model.save_pretrained(tmpdir) | ||
loaded_model = self.model_class.from_pretrained(tmpdir, device_map=device_map) | ||
_ = loaded_model(**inputs_dict) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, we are not really creating the dict, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Should be fixed now.
Co-authored-by: Aryan <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
What does this PR do?
Move out of just UNets.