Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
dd56429
feat: support Ulysses Anything Attention
DefTruth Jan 19, 2026
123f526
feat: support Ulysses Anything Attention
DefTruth Jan 19, 2026
af9af62
feat: support Ulysses Anything Attention
DefTruth Jan 19, 2026
40800e5
Merge branch 'main' into ulysses-anything
DefTruth Jan 19, 2026
0918547
Merge branch 'main' into ulysses-anything
DefTruth Jan 20, 2026
b4d3f07
feat: support Ulysses Anything Attention
DefTruth Jan 20, 2026
ece9f15
Merge branch 'main' into ulysses-anything
DefTruth Jan 20, 2026
7f9c412
Merge branch 'main' into ulysses-anything
DefTruth Jan 21, 2026
403c204
fix UAA broken while using joint attn
DefTruth Jan 21, 2026
9280e2b
update
DefTruth Jan 21, 2026
a5d2459
Merge branch 'main' into ulysses-anything
DefTruth Jan 22, 2026
de157c8
Merge branch 'main' into ulysses-anything
DefTruth Jan 23, 2026
4caa87e
post check
DefTruth Jan 23, 2026
140ece8
add docs
DefTruth Jan 26, 2026
7f2ecf4
Merge branch 'main' into ulysses-anything
DefTruth Jan 26, 2026
4cc56b9
add docs
DefTruth Jan 26, 2026
fd88b2d
Merge branch 'ulysses-anything' of https://github.com/xlite-dev/diffu…
DefTruth Jan 26, 2026
f1c32d9
Merge branch 'main' into ulysses-anything
DefTruth Jan 28, 2026
a74820b
remove lru cache
DefTruth Jan 28, 2026
d141801
Merge branch 'main' into ulysses-anything
DefTruth Jan 29, 2026
f8f2209
move codes
DefTruth Jan 29, 2026
9924f8b
Merge branch 'main' into ulysses-anything
DefTruth Jan 29, 2026
e1d83eb
update
DefTruth Jan 30, 2026
e426b64
Merge branch 'ulysses-anything' of https://github.com/xlite-dev/diffu…
DefTruth Jan 30, 2026
cb6c4fd
Merge branch 'main' into ulysses-anything
DefTruth Jan 30, 2026
ef919b4
Merge branch 'main' into ulysses-anything
DefTruth Feb 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/diffusers/hooks/context_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
ContextParallelModelPlan,
ContextParallelOutput,
)
from ..models._ulysses_anything import PartitionAnythingSharder
from ..utils import get_logger
from ..utils.constants import DIFFUSERS_ULYSSES_ANYTHING
from ..utils.torch_utils import unwrap_module
from .hooks import HookRegistry, ModelHook

Expand Down Expand Up @@ -256,6 +258,9 @@ def backward(ctx, grad_output):
class EquipartitionSharder:
@classmethod
def shard(cls, tensor: torch.Tensor, dim: int, mesh: torch.distributed.device_mesh.DeviceMesh) -> torch.Tensor:
if DIFFUSERS_ULYSSES_ANYTHING:
return PartitionAnythingSharder.shard_anything(tensor, dim, mesh)

# NOTE: the following assertion does not have to be true in general. We simply enforce it for now
# because the alternate case has not yet been tested/required for any model.
assert tensor.size()[dim] % mesh.size() == 0, (
Expand All @@ -269,6 +274,9 @@ def shard(cls, tensor: torch.Tensor, dim: int, mesh: torch.distributed.device_me

@classmethod
def unshard(cls, tensor: torch.Tensor, dim: int, mesh: torch.distributed.device_mesh.DeviceMesh) -> torch.Tensor:
if DIFFUSERS_ULYSSES_ANYTHING:
return PartitionAnythingSharder.unshard_anything(tensor, dim, mesh)

tensor = tensor.contiguous()
tensor = AllGatherFunction.apply(tensor, dim, mesh.get_group())
return tensor
Expand Down
Loading