Uh oh!
There was an error while loading. Please reload this page.
[docs] CP - #12331
Conversation
HuggingFaceDocBuilderDev
commented
Sep 15, 2025
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. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| pipeline.transformer.parallelize(config=ContextParallelConfig(ring_degree=2)) | ||
| pipeline.transformer.set_attention_backend("flash") |
There was a problem hiding this comment.
Is it better to call parallelize() after loading the model, or is it better to pass a parallel config when initializing the model? Or are both approaches same?
There was a problem hiding this comment.
Oh I think it's just enable_prallelism() now.
Uh oh!
There was an error while loading. Please reload this page.
| [`ContextParallelConfig`] also supports Ulysses Attention through the `ulysses_degree` argument. This determines the number of devices to use for Ulysses Attention. | ||
| ```py | ||
| pipeline.transformer.parallelize(config=ContextParallelConfig(ulysses_degree=2)) |
There was a problem hiding this comment.
I didn't include ParallelConfig because it seems like you just pass ContextParallelConfig to it. So I opted to use ContextParallelConfig directly.
Is the ParallelConfig class meant to support other parallelism strategies not yet implemented?
There was a problem hiding this comment.
@sayakpaul So, the intention with ParallelConfig is to support different kinds of parallelism easily. If you pass just ContextParallelConfig, it just create a ParallelConfig using that automatically.
I think current example is sufficient but we can ofcourse revision once there is more parallelisms supported natively
There was a problem hiding this comment.
Sure, thanks! Can we supplement a ParallelConfig as well? 👀
a-r-r-o-w
commented
Sep 24, 2025
Sorry for the delay! Please LMK if I can help with anything :) The CP PR is currently blocked because I can't make updates to it (the branch is in the diffusers repo and not a personal fork, so I can't push changes). Hopefully someone can address the tests there and we can proceed here too |
a-r-r-o-w
left a comment
There was a problem hiding this comment.
Thanks @stevhliu ! LGTM in general, but the examples are outdated a bit. The latest inference snippet removes enable_parallelism and handles that internally.
The final code looks like this: #11941 (comment)
Sorry for the inconvenience! I forgot to update the description of that PR
stevhliu
commented
Sep 25, 2025
Ah my bad, I missed that! Code snippet should be updated now. Let me know if there are any more changes :) |
| [`ContextParallelConfig`] supports Ulysses Attention through the `ulysses_degree` argument. This determines how many devices to use for Ulysses Attention. | ||
| ```py | ||
| pipeline.transformer.parallelize(config=ContextParallelConfig(ulysses_degree=2)) |
There was a problem hiding this comment.
| pipeline.transformer.parallelize(config=ContextParallelConfig(ulysses_degree=2)) | |
| pipeline.transformer.enable_parallelism(config=ContextParallelConfig(ulysses_degree=2)) |
Just one last change and this should be good I think. Off to you @sayakpaul
sayakpaul
left a comment
There was a problem hiding this comment.
Looking good. I would also link the distributed_inference doc from parallel.md.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.


companion docs for context parallelism with Ring/Ulysses attention (see #11941)
cc @a-r-r-o-w