-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[4/N] Enable intel GPU for unsloth #2621
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
[4/N] Enable intel GPU for unsloth #2621
Conversation
unsloth/models/_utils.py
Outdated
| torch_amp_custom_bwd = torch.amp.custom_bwd(device_type = "cuda") | ||
| pass | ||
| elif DEVICE_TYPE == "xpu": | ||
| if Version(torch_version) < Version("2.4.0"): |
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.
| if Version(torch_version) < Version("2.4.0"): | |
| if Version(torch_version) < Version("2.6.0"): |
unsloth/models/_utils.py
Outdated
| if DEVICE_TYPE == "cuda": | ||
| major_version, minor_version = torch.cuda.get_device_capability() | ||
|
|
||
|
|
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.
just one line blank space is ok?
|
@danielhanchen, @shimmyshimmer |
| try: vllm_version = f" vLLM: {importlib_version('vllm')}." | ||
| except: vllm_version = "" | ||
|
|
||
| statistics = \ |
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.
On printouts, it's best not to make 2 - instead define new variables like device_count = torch.xpu.device_count() if DEVICE_TYPE == "xpu" else torch.cuda.device_count()
|
Closed pr as duplicated with |
Hi unsloth, we are going to support unsloth intel GPU with several prs and this is the third pr.
For the first step we are aiming to support several models with LoRA, and increase our feature in the future (including BNB, FlashAttention, xformers).
For this PR, we resolve device specific API for cuda and Intel GPU(XPU) for model utils and llama model
For cuda specific path, we didn't change the logics, only add check and tab to pass python grammar.
cc: