-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
xpu device is not used running pipeline(device_map="auto") #31922
Comments
I think that issue root cause is that HF currently can't query total free XPU device memory and consequently does not use XPU for dispatching. I should note however that it seems there is an issue in HF accelerate around query free XPU memory - wrong function is used for the query and HF gets allocated memory size instead of free memory size. See huggingface/accelerate#2929. |
I forgot to comment that I opened request in pytorch to support the |
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
torch.xpu.mem_get_info API is available starting from PyTorch 2.6 (and in nightly 2.6.0.dev20241206+xpu or later). To work properly this method requires PyTorch built with the SYCL runtime which supports API to query device memory stats. If not available, exception will be raised. Requires: pytorch/pytorch#141230 Fixes: huggingface#2929 Fixes: huggingface/transformers#31922 Signed-off-by: Dmitry Rogozhkin <[email protected]>
torch.xpu.mem_get_info API is available starting from PyTorch 2.6 (and in nightly 2.6.0.dev20241206+xpu or later). To work properly this method requires PyTorch built with the SYCL runtime which supports API to query device memory stats. If not available, exception will be raised. Requires: pytorch/pytorch#141230 Fixes: huggingface#2929 Fixes: huggingface/transformers#31922 Signed-off-by: Dmitry Rogozhkin <[email protected]>
|
torch.xpu.mem_get_info API is available starting from PyTorch 2.6 (and in nightly 2.6.0.dev20241206+xpu or later). To work properly this method requires PyTorch built with the SYCL runtime which supports API to query device memory stats. If not available, exception will be raised. Requires: pytorch/pytorch#141230 Fixes: huggingface#2929 Fixes: huggingface/transformers#31922 Signed-off-by: Dmitry Rogozhkin <[email protected]>
Found on this code versions: 5258501, huggingface/accelerate@12a007d, pytorch/pytorch@3477ee3. This is an issue with XPU support in stock pytorch (i.e. without using IPEX).
HF model pipelines with
device_map="auto"
(ordevice_map="sequential"
) does not actually run on XPU even if they can fit the device memory. I spotted that trying to run LLAMA 3 models:Example script:
Workarounds and findings:
device_map="auto"
todevice_map="xpu"
will allow model to run (that's easier to check on 8B model)max_memory
to the model kwargs:max_memory
will currently work only if model fits into device memory and you provided big enough max_limit. If not, then you will see the following error (filed separate cuda device is wrongly requested instead of xpu running pipeline(device_map="auto", max_memory": {0: 1.0e+10}) #31941 for this):CC: @gujinghui @EikanWang @fengyuan14 @guangyey @jgong5 @sywangyi @yao-matrix
The text was updated successfully, but these errors were encountered: