@@ -108,10 +108,12 @@ class FastVideoArgs:
108108 num_gpus : int = 1
109109 tp_size : int = - 1
110110 sp_size : int = - 1
111- # Number of ranks within the sequence-parallel group used by pure Ring
112- # Attention. ``1`` disables Ring Attention (default Ulysses-only SP).
113- # The initial implementation supports pure Ring only, so when > 1 it
114- # must equal ``sp_size`` (see ``_check_ring_attention_args``).
111+ # Number of ranks within the sequence-parallel group used by Ring
112+ # Attention. ``1`` disables Ring Attention (pure Ulysses SP). When
113+ # ``1 < ring_size < sp_size``, Ring Attention runs combined with Ulysses
114+ # as a 2D hybrid (USP): ``sp_size`` must be divisible by ``ring_size``,
115+ # and the remaining ``sp_size // ring_size`` factor is the Ulysses
116+ # subgroup size (see ``_check_ring_attention_args``).
115117 ring_size : int = 1
116118 hsdp_replicate_dim : int = 1
117119 hsdp_shard_dim : int = - 1
@@ -450,8 +452,10 @@ def add_cli_args(parser: FlexibleArgumentParser) -> FlexibleArgumentParser:
450452 type = int ,
451453 default = FastVideoArgs .ring_size ,
452454 help = ("Number of ranks used by Ring Attention within the sequence-parallel "
453- "group. Set to 1 to disable Ring Attention. In the initial pure-Ring "
454- "implementation, ring_size must equal sp_size." ),
455+ "group. Set to 1 to disable Ring Attention. Must evenly divide sp_size; "
456+ "when ring_size == sp_size this is pure Ring Attention, when "
457+ "1 < ring_size < sp_size it runs combined with Ulysses as a hybrid "
458+ "(USP) using the remaining sp_size // ring_size ranks for Ulysses." ),
455459 )
456460 parser .add_argument (
457461 "--hsdp-replicate-dim" ,
@@ -856,9 +860,11 @@ def check_fastvideo_args(self) -> None:
856860 def _check_ring_attention_args (self ) -> None :
857861 """Validate Ring Attention configuration.
858862
859- The initial FastVideo integration only supports pure Ring Attention:
860- the entire sequence-parallel group is used as the Ring group, and
861- Ring Attention training/backward is not supported.
863+ FastVideo supports pure Ring Attention (``ring_size == sp_size``) and
864+ the Ring+Ulysses hybrid, a.k.a. USP (``1 < ring_size < sp_size``,
865+ with the remaining ``sp_size // ring_size`` factor used as the
866+ Ulysses subgroup size). Ring Attention training/backward is not
867+ supported in either case.
862868 """
863869 if self .ring_size < 1 :
864870 raise ValueError (f"ring_size must be >= 1, got { self .ring_size } ." )
@@ -870,10 +876,9 @@ def _check_ring_attention_args(self) -> None:
870876 raise ValueError (f"Ring Attention requires sequence parallelism. Got ring_size={ self .ring_size } , "
871877 f"sp_size={ self .sp_size } ." )
872878
873- if self .ring_size != self .sp_size :
874- raise NotImplementedError (
875- "The initial Ring Attention implementation supports pure Ring only: ring_size must equal "
876- f"sp_size. Got ring_size={ self .ring_size } , sp_size={ self .sp_size } ." )
879+ if self .sp_size % self .ring_size != 0 :
880+ raise ValueError ("Ring Attention (including the Ring+Ulysses/USP hybrid) requires sp_size to be divisible "
881+ f"by ring_size. Got ring_size={ self .ring_size } , sp_size={ self .sp_size } ." )
877882
878883 if not self .inference_mode :
879884 raise NotImplementedError ("Ring Attention training/backward is not supported in the initial "
0 commit comments