-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Fix Context Parallel validation checks #12446
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
base: main
Are you sure you want to change the base?
Conversation
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. |
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.
Left some nits, otherwise looks very nice!
raise NotImplementedError( | ||
f"Only rotate_method='allgather' is supported for now, but got {self.rotate_method}." | ||
|
||
if self.ulysses_degree * self.ring_degree > world_size: |
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.
Should we hit line as both cannot be set, right?
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.
Both can be set techinically, but currently both can't be > 1. Also this is for cases where you have 3 GPUs available and you set something like ulysses_degree=1 and ring_degree==4 (more GPUs being requested is greater than world_size)
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.
Feels slightly confusing to me but since we're erroring out early for unsupported ulysses_degree
and ring_degree
value combos, I think it's okay.
self._flattened_mesh = self._mesh._flatten() | ||
self._ring_mesh = self._mesh["ring"] | ||
self._ulysses_mesh = self._mesh["ulysses"] | ||
self._ring_local_rank = self._ring_mesh.get_local_rank() | ||
self._ulysses_local_rank = self._ulysses_mesh.get_local_rank() |
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.
Can't they be None
? Why unguard?
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.
They are internal attributes that are derived from mesh which is set through the setup
method. The device mesh object is also only dynamically created when enabled_parallelism
is called.
The guards are redundant, they would always be None
unless set explicitly for some custom debugging.
mesh_shape=(cp_config.ring_degree, cp_config.ulysses_degree), | ||
mesh_dim_names=("ring", "ulysses"), | ||
) | ||
from .attention_dispatch import AttentionBackendName, _AttentionBackendRegistry |
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.
(nit): Would prefer to keep the import at the beginning of the method implementation, if possible (after from .attention_processor import Attention, MochiAttention
).
What does this PR do?
Currently CP inference will run with split hooks even if the attention backend doesn't support it. This can lead to weird results #12443
This PR
enable_parallelism
Fixes # (issue)
Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.