Skip to content

Conversation

@danieldk
Copy link
Member

@danieldk danieldk commented Feb 6, 2026

So far, get_kernel has always auto-detected the backend from the Torch build. However, this causes issues in fixed-device settings where we may want to run some ops on the CPU and others on the GPU. This change allows specifying backend as an argument to get_kernel and friends.

Currently, only the cpu backend and the backend that Torch was built for are supported (since we cannot determine the version, etc. of a backend that Torch was not built for). However, we decided to make it a string-based argument as opposed to e.g. a cpu bool, in the case Torch might do multi-backend builds in the future.

So far, `get_kernel` has always auto-detected the backend from the Torch
build. However, this causes issues in fixed-device settings where we may
want to run some ops on the CPU and others on the GPU. This change
allows specifying `backend` as an argument to `get_kernel` and friends.

Currently, only the `cpu` backend and the backend that Torch was built
for are supported (since we cannot determine the version, etc. of a
backend that Torch was not built for). However, we decided to make it a
string-based argument as opposed to e.g. a `cpu` bool, in the case Torch
might do multi-backend builds in the future.
@HuggingFaceDocBuilderDev

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.

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.

2 participants