Skip to content

[docs] add xpu device check - #34684

Merged
stevhliu merged 5 commits into
huggingface:mainfrom
faaany:xpu-available
Nov 13, 2024
Merged

stevhliu merged 5 commits into
huggingface:mainfrom
faaany:xpu-available

Conversation

@faaany

@faaany faaany commented Nov 11, 2024

Copy link
Copy Markdown
Contributor

What does this PR do?

There are many places in the task guides that only check the cuda device availability. This PR adds xpu besides cuda, but I am not sure whether my current change is the best one, because there are other ways to add xpu as, e.g.

  • add xpu in the inline-comment
  • use accelerate's get_backend API to get the underlying device

Just let me what is your favorite, @stevhliu Once agreed by you, I can submit further commits to replicate the change in other places.

@stevhliu stevhliu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the suggestion!

I think using get_backend may be the easiest option for users, and this will also include other devices such as mps.

@faaany

faaany commented Nov 12, 2024

Copy link
Copy Markdown
Contributor Author

Thanks for the suggestion!

I think using get_backend may be the easiest option for users, and this will also include other devices such as mps.

thanks! code update. Is this okay for you? Then I can change to other places as well.

@stevhliu stevhliu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Very nice, thank you! 👍

faaany and others added 2 commits November 13, 2024 13:34
Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
@faaany

faaany commented Nov 13, 2024

Copy link
Copy Markdown
Contributor Author

Very nice, thank you! 👍

I only made one change: I removed GPU from the comment because GPU is a general term including CUDA, XPU, NPU. And I made the same change at other places as well. Pls have a review, thx a lot!

@stevhliu stevhliu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fantastic, works for me!

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@stevhliu
stevhliu merged commit a3d69a8 into huggingface:main Nov 13, 2024
BernardZach pushed a commit to BernardZach/transformers that referenced this pull request Dec 5, 2024
* add XPU path

* use accelerate API

* Update docs/source/en/tasks/semantic_segmentation.md

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* update more places with accelerate API

---------

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
@faaany
faaany deleted the xpu-available branch February 7, 2025 02:33
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.

3 participants