-
Notifications
You must be signed in to change notification settings - Fork 27k
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
[tests] enable test_pipeline_accelerate_top_p on XPU #29309
Conversation
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.
I think in this one we want to test accelerate support with sampling so it's probably on purpose!
Could you elaborate more on the relationship between top_p sampling and device? I don't see the need to use "device_map='auto'" in this case, e.g. if I change "device_map='auto'" to "device=torch_device", will the test on top_p sampling fail? |
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.
The name of the test is test_pipeline_accelerate_top_p
to make sure we test accelerate
dispatching automatically.
I thought testing "auto"
made sense but you're right here, we can test any device, as long as we make sure we test the accelerate support here!
Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
done, thanks for the review! |
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 for iterating!
* use torch_device * Update tests/pipelines/test_pipelines_text_generation.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * fix style --------- Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
* use torch_device * Update tests/pipelines/test_pipelines_text_generation.py Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com> * fix style --------- Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
What does this PR do?
Is there any particular reason why we use
device_map="auto"
in this testtest_pipeline_accelerate_top_p
? If not, I would suggest using the device-agnostic variabletorch_device
instead ofdevice_map="auto"
just like in all other tests e.g.test_small_model_fp16
.Another reason is that the
device_map="auto"
mechanism is still not mature on XPU, causing the model to be loaded on the CPU, rather than on XPU. With this fix,test_pipeline_accelerate_top_p
will definitively work on all devices. Below is an evidence for XPU:BEFORE
AFTER
Pls have a review, thx! @Narsil @ArthurZucker