-
Notifications
You must be signed in to change notification settings - Fork 28.1k
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
device agnostic models testing #27146
device agnostic models testing #27146
Conversation
Thanks for opening this PR @statelesshz ! Let us know when you'd like a review |
fa43b77
to
28aef47
Compare
28aef47
to
9d37036
Compare
9d37036
to
e94cc76
Compare
Due to network issue, it's not easy to download the model weights on huggingface hub from my area, so I take
|
Marking this ready for review :-) @ydshieh and @amyeroberts |
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.
Another great PR - thank you!
Happy to merge once @ydshieh gives his 👍
def test_generate_fp16(self): | ||
config, input_dict = self.model_tester.prepare_config_and_inputs() | ||
input_ids = input_dict["input_ids"] | ||
attention_mask = input_ids.ne(1).to(torch_device) | ||
model = self.all_generative_model_classes[0](config).eval().to(torch_device) | ||
if torch_device == "cuda": | ||
model.half() | ||
model.half() |
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.
So much cleaner 🤩
@@ -363,7 +369,8 @@ def test_sampling(self): | |||
self.assertIn(zs[2][0].detach().cpu().tolist(), [self.EXPECTED_OUTPUT_0, self.EXPECTED_OUTPUT_0_PT_2]) | |||
|
|||
@slow | |||
@require_torch_gpu | |||
@require_torch_accelerator | |||
@require_torch_fp16 |
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.
why fp16 here?
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.
Oops, the fp16 decorator was misused here. Thanks for pointing it out
Nice to know bert works well on NPU! |
Thank you @statelesshz the king of NPU! |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. |
* device agnostic models testing * add decorator `require_torch_fp16` * make style * apply review suggestion * Oops, the fp16 decorator was misused
What does this PR do?
Part of #25654 (comment)
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.