Skip to content

Conversation

@sayakpaul
Copy link
Member

@sayakpaul sayakpaul commented Dec 12, 2025

What does this PR do?

We should be able to error out when an attention backend isn't supported with CP.

Refer to #12829 (comment) and #12829 (comment).

Additionally, when we specify parallel_config to from_pretrained() and then set an attention backend through set_attention_backend() (which is CP-incompatible), it goes through silently.

This PR eliminates those and gracefully errors out.

@sayakpaul sayakpaul requested a review from DN6 December 12, 2025 09:52
@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.

@sayakpaul sayakpaul requested a review from DN6 December 30, 2025 08:44
raise ValueError(f"`{backend=}` must be one of the following: " + ", ".join(available_backends))

backend = AttentionBackendName(backend)
if not _AttentionBackendRegistry._is_context_parallel_available(backend):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will raise an error if the backend doesn't support context parallel (regardless of whether you want to use CP or not)

We need to first check if the attention processor has a _parallel_config set and then check if the backend supports context parallel.

Copy link
Member Author

Choose a reason for hiding this comment

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

That should be fixed now. Thanks for flagging.

@sayakpaul sayakpaul requested a review from DN6 January 2, 2026 16:08
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.

4 participants