Repository navigation
Pick Intel XPU by default when there is no CUDA, keep flash_attn to CUDA - #96
Open
EvilFreelancer wants to merge 1 commit into
Open
EvilFreelancer wants to merge 1 commit into
EvilFreelancer wants to merge 1 commit into
Conversation
load_model(device=None) chose cuda or cpu, so an Intel GPU (torch xpu) was only used when asked for explicitly, although the model runs there as it is: the forward already autocasts on the model's device type. The default is now cuda, then xpu, then cpu. flash_attn is a CUDA-only library, so the existing CPU fallback now covers every non-CUDA device.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
load_model(device=None)pickscudaif available, otherwisecpu, so on a machine with an Intel GPU (PyTorchxpubackend) GigaAM silently runs on the CPU unless the caller passesdevice="xpu". The model itself already works on XPU as it is:GigaAMASR.forwardautocasts on the model's own device type, and nothing else is CUDA-specific.This PR:
_default_device():cuda, thenxpu(whentorch.xpuexists and reports a device), thencpu;flash_attnis a CUDA-only library;tests/test_device.py(9 tests, no model download): the default-device order including a torch build withouttorch.xpu, an explicit device being kept, and the flash_attn policy per device type.Tested
On an Intel Arc A770 (xe driver, torch 2.10.0+xpu, Ubuntu 24.04 container):
pytest tests/test_device.py: 9 passed;gigaam.load_model("v3_e2e_rnnt")withoutdeviceloads ontoxpu:0;Nothing changes for CUDA or CPU users.