Skip to content

Experiment: Support intel xpu device for the model side of things - #125

Draft
akaIDIOT wants to merge 6 commits into
mainfrom
experiment/support-intel-xpu-device
Draft

Experiment: Support intel xpu device for the model side of things#125
akaIDIOT wants to merge 6 commits into
mainfrom
experiment/support-intel-xpu-device

Conversation

@akaIDIOT

Copy link
Copy Markdown
Member

No description provided.

Comment on lines +14 to +19
if torch.cuda.is_available():
return torch.device('cuda')
if torch.xpu.is_available():
return torch.device('xpu')
if torch.mps.is_available():
return torch.device('mps')

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wider than it really needs to be, but it might just work on macos now too.

Comment on lines +28 to +30
if device.type == 'xpu':
# SPDA might cause runtime errors on xpu, default to eager attention to avoid it
model_args.setdefault('attn_implementation', 'eager')

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When all seemed fine, the loaded model would raise a RuntimeError: could not create a primitive from transformers/integrations/sdpa_attention.py, clanker suggested setting the attention implementation to eager, which actually dodged the error and made the embedder tests succeed 🙏🏻

Comment thread citatio/pyproject.toml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant