---
title: cosmos2_5_training_pipeline
---

<div class="python-reference">
<a id="fastvideo.training.cosmos2_5_training_pipeline-classes"></a>
<a id="fastvideo.training.cosmos2_5_training_pipeline-functions"></a>
<a id="fastvideo.training.cosmos2_5_training_pipeline.Cosmos25TrainingPipeline-functions"></a>
<a id="fastvideo.training.cosmos2_5_training_pipeline"></a>
<p>Cosmos 2.5 training pipeline (text-to-world, full fine-tuning + LoRA).</p>
<p>Follows the same structure as wan_training_pipeline.py. Key Cosmos 2.5 specifics:
- Text embeddings are (B, seq, 100352) from Reason1 full-concat (28 layers × 3584 dim)
- forward() takes <code>padding_mask</code> (B, 1, H, W) and optional <code>fps</code> int
- Normalisation is handled by Cosmos25WanVAEWrapper (handles_latent_norm=True),
  so _normalize_dit_input is a no-op and stored latents are already normalised.
- Timesteps are sigma values in [0, 1] (flow matching); (B,) is auto-expanded
  inside the model to (B, 1).</p>
<h2 id="fastvideo.training.cosmos2_5_training_pipeline.get_local_torch_device"><code>fastvideo.training.cosmos2_5_training_pipeline.get_local_torch_device</code></h2>
<pre class="doc-signature"><code>get_local_torch_device() -&gt; torch.device</code></pre>
<p>Return the torch device for the current rank.</p>
<h2 id="fastvideo.training.cosmos2_5_training_pipeline.FastVideoArgs"><code>fastvideo.training.cosmos2_5_training_pipeline.FastVideoArgs</code></h2>
<pre class="doc-signature"><code>FastVideoArgs(model_path: str, mode: ExecutionMode = ExecutionMode.INFERENCE, workload_type: WorkloadType = WorkloadType.T2V, distributed_executor_backend: str = &#x27;mp&#x27;, enable_streaming_ipc_queues: bool = False, ray_placement_group: PlacementGroup | None = None, ray_runtime_env: RuntimeEnv | None = None, inference_mode: bool = True, trust_remote_code: bool = False, revision: str | None = None, num_gpus: int = 1, tp_size: int = -1, sp_size: int = -1, hsdp_replicate_dim: int = 1, hsdp_shard_dim: int = -1, dist_timeout: int | None = None, pipeline_config: PipelineConfig = PipelineConfig(), preprocess_config: PreprocessConfig | None = None, lora_path: str | None = None, lora_nickname: str = &#x27;default&#x27;, lora_strength: float = 1.0, lora_target_modules: list&#91;str&#93; | None = None, output_type: str = &#x27;pil&#x27;, attention_backend: str | None = None, dit_cpu_offload: bool = True, use_fsdp_inference: bool = False, dit_layerwise_offload: bool = True, text_encoder_cpu_offload: bool = True, image_encoder_cpu_offload: bool = True, vae_cpu_offload: bool = True, pin_cpu_memory: bool = True, h3_sequential_load: bool | None = None, h3_encoder_split: bool | None = None, h3_encoder_nodes: int = -1, h3_encoder_workers: int = 0, video_decode_backend: str = &#x27;h3-vae&#x27;, taeh3_checkpoint: str | None = None, taeh3_chunk_size: int = 5, h3_vae_nvfp4_decoder: str | None = None, lazy_module_load: bool | None = None, vae_parallel_decode: bool = False, vae_parallel_encode: bool = False, vae_parallel_decode_strategy: str | None = None, enable_torch_compile: bool = False, regional_compile: bool = False, enable_torch_compile_text_encoder: bool = False, enable_torch_compile_vae: bool = False, enable_torch_compile_audio_vae: bool = False, torch_compile_kwargs: dict&#91;str, Any&#93; = dict(), torch_compile_kwargs_dit: dict&#91;str, Any&#93; = dict(), torch_compile_kwargs_text_encoder: dict&#91;str, Any&#93; = dict(), torch_compile_kwargs_vae: dict&#91;str, Any&#93; = dict(), torch_compile_kwargs_audio_vae: dict&#91;str, Any&#93; = dict(), inference_torch_compile: bool = False, h3_vsa_fp4: dict&#91;str, Any&#93; = dict(), disable_autocast: bool = False, VSA_sparsity: float | None = None, VSA_tile_size: int | None = None, moba_config_path: str | None = None, moba_config: dict&#91;str, Any&#93; = dict(), master_port: int | None = None, enable_stage_verification: bool = True, prompt_txt: str | None = None, ltx2_vae_tiling: bool | None = None, ltx2_vae_spatial_tile_size_in_pixels: int | None = None, ltx2_vae_spatial_tile_overlap_in_pixels: int | None = None, ltx2_vae_temporal_tile_size_in_frames: int | None = None, ltx2_vae_temporal_tile_overlap_in_frames: int | None = None, ltx2_initial_latent_path: str | None = None, ltx2_audio_latent_path: str | None = None, refine_enabled: bool | None = None, refine_upsampler_path: str | None = None, refine_transformer_path: str | None = None, refine_lora_path: str | None = None, refine_num_inference_steps: int | None = None, refine_guidance_scale: float | None = None, refine_add_noise: bool | None = None, refine_noise_path: str | None = None, refine_audio_noise_path: str | None = None, ltx2_refine_enabled: bool = False, ltx2_refine_upsampler_path: str | None = None, ltx2_refine_transformer_path: str | None = None, ltx2_refine_lora_path: str | None = None, ltx2_refine_num_inference_steps: int = 3, ltx2_refine_guidance_scale: float = 1.0, ltx2_refine_add_noise: bool = True, ltx2_refine_noise_path: str | None = None, ltx2_refine_audio_noise_path: str | None = None, ltx2_legacy_native_noise_order: bool = False, ltx2_use_distilled_sigmas: bool = True, model_paths: dict&#91;str, str&#93; = dict(), model_loaded: dict&#91;str, bool&#93; = (lambda: &#123;&#x27;transformer&#x27;: True, &#x27;vae&#x27;: True, &#x27;upsampler&#x27;: True&#125;)(), override_text_encoder_safetensors: str | None = None, override_text_encoder_quant: QuantizationMethods = None, transformer_quant: Any | None = None, override_transformer_cls_name: str | None = None, init_weights_from_safetensors: str = &#x27;&#x27;, init_weights_from_safetensors_2: str = &#x27;&#x27;, override_pipeline_cls_name: str | None = None, boundary_ratio: float | None = 0.875)</code></pre>


<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FastVideoArgs.is_output_rank"><code>fastvideo.training.cosmos2_5_training_pipeline.FastVideoArgs.is_output_rank</code></h3>
<pre class="doc-signature"><code>is_output_rank: bool</code></pre>
<p>Whether this process may materialize user-facing outputs.</p>
<p>This is runtime state assigned by an SPMD executor, not a public
configuration field, so dataclass serialization and typed config
parsing deliberately ignore it.</p>
<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FastVideoArgs.add_cli_args"><code>fastvideo.training.cosmos2_5_training_pipeline.FastVideoArgs.add_cli_args</code></h3>
<pre class="doc-signature"><code>add_cli_args(parser: FlexibleArgumentParser) -&gt; FlexibleArgumentParser</code></pre>

<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FastVideoArgs.from_cli_args"><code>fastvideo.training.cosmos2_5_training_pipeline.FastVideoArgs.from_cli_args</code></h3>
<pre class="doc-signature"><code>from_cli_args(args: argparse.Namespace) -&gt; FastVideoArgs</code></pre>

<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FastVideoArgs.from_kwargs"><code>fastvideo.training.cosmos2_5_training_pipeline.FastVideoArgs.from_kwargs</code></h3>
<pre class="doc-signature"><code>from_kwargs(**kwargs: Any) -&gt; FastVideoArgs</code></pre>

<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FastVideoArgs.check_fastvideo_args"><code>fastvideo.training.cosmos2_5_training_pipeline.FastVideoArgs.check_fastvideo_args</code></h3>
<pre class="doc-signature"><code>check_fastvideo_args() -&gt; None</code></pre>
<p>Validate inference arguments for consistency</p>
<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FastVideoArgs.finalize_device_offload_policy"><code>fastvideo.training.cosmos2_5_training_pipeline.FastVideoArgs.finalize_device_offload_policy</code></h3>
<pre class="doc-signature"><code>finalize_device_offload_policy(device_id: int = 0) -&gt; bool</code></pre>
<p>Apply device-local memory policy, then resolve incompatible modes.</p>
<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FastVideoArgs.disable_offload_on_unified_memory"><code>fastvideo.training.cosmos2_5_training_pipeline.FastVideoArgs.disable_offload_on_unified_memory</code></h3>
<pre class="doc-signature"><code>disable_offload_on_unified_memory(device_id: int = 0, *, offload_flag: str | None = None) -&gt; bool</code></pre>
<p>Disable host offload after a worker has selected its device.</p>
<p>CUDA's unified-memory probe reads runtime device properties and may
initialize a CUDA context. Callers must therefore use this only inside
a device-owning process, after selecting and binding <code>device_id</code>.
Returning the classification lets direct component-loader callers
apply the same policy to explicit per-call overrides. When
<code>offload_flag</code> is given, the return value says whether this policy
covers that component role.</p>
<h2 id="fastvideo.training.cosmos2_5_training_pipeline.TrainingArgs"><code>fastvideo.training.cosmos2_5_training_pipeline.TrainingArgs</code></h2>
<pre class="doc-signature"><code>TrainingArgs(model_path: str, mode: ExecutionMode = ExecutionMode.INFERENCE, workload_type: WorkloadType = WorkloadType.T2V, distributed_executor_backend: str = &#x27;mp&#x27;, enable_streaming_ipc_queues: bool = False, ray_placement_group: PlacementGroup | None = None, ray_runtime_env: RuntimeEnv | None = None, inference_mode: bool = True, trust_remote_code: bool = False, revision: str | None = None, num_gpus: int = 1, tp_size: int = -1, sp_size: int = -1, hsdp_replicate_dim: int = 1, hsdp_shard_dim: int = -1, dist_timeout: int | None = None, pipeline_config: PipelineConfig = PipelineConfig(), preprocess_config: PreprocessConfig | None = None, lora_path: str | None = None, lora_nickname: str = &#x27;default&#x27;, lora_strength: float = 1.0, lora_target_modules: list&#91;str&#93; | None = None, output_type: str = &#x27;pil&#x27;, attention_backend: str | None = None, dit_cpu_offload: bool = True, use_fsdp_inference: bool = False, dit_layerwise_offload: bool = True, text_encoder_cpu_offload: bool = True, image_encoder_cpu_offload: bool = True, vae_cpu_offload: bool = True, pin_cpu_memory: bool = True, h3_sequential_load: bool | None = None, h3_encoder_split: bool | None = None, h3_encoder_nodes: int = -1, h3_encoder_workers: int = 0, video_decode_backend: str = &#x27;h3-vae&#x27;, taeh3_checkpoint: str | None = None, taeh3_chunk_size: int = 5, h3_vae_nvfp4_decoder: str | None = None, lazy_module_load: bool | None = None, vae_parallel_decode: bool = False, vae_parallel_encode: bool = False, vae_parallel_decode_strategy: str | None = None, enable_torch_compile: bool = False, regional_compile: bool = False, enable_torch_compile_text_encoder: bool = False, enable_torch_compile_vae: bool = False, enable_torch_compile_audio_vae: bool = False, torch_compile_kwargs: dict&#91;str, Any&#93; = dict(), torch_compile_kwargs_dit: dict&#91;str, Any&#93; = dict(), torch_compile_kwargs_text_encoder: dict&#91;str, Any&#93; = dict(), torch_compile_kwargs_vae: dict&#91;str, Any&#93; = dict(), torch_compile_kwargs_audio_vae: dict&#91;str, Any&#93; = dict(), inference_torch_compile: bool = False, h3_vsa_fp4: dict&#91;str, Any&#93; = dict(), disable_autocast: bool = False, VSA_sparsity: float | None = None, VSA_tile_size: int | None = None, moba_config_path: str | None = None, moba_config: dict&#91;str, Any&#93; = dict(), master_port: int | None = None, enable_stage_verification: bool = True, prompt_txt: str | None = None, ltx2_vae_tiling: bool | None = None, ltx2_vae_spatial_tile_size_in_pixels: int | None = None, ltx2_vae_spatial_tile_overlap_in_pixels: int | None = None, ltx2_vae_temporal_tile_size_in_frames: int | None = None, ltx2_vae_temporal_tile_overlap_in_frames: int | None = None, ltx2_initial_latent_path: str | None = None, ltx2_audio_latent_path: str | None = None, refine_enabled: bool | None = None, refine_upsampler_path: str | None = None, refine_transformer_path: str | None = None, refine_lora_path: str | None = None, refine_num_inference_steps: int | None = None, refine_guidance_scale: float | None = None, refine_add_noise: bool | None = None, refine_noise_path: str | None = None, refine_audio_noise_path: str | None = None, ltx2_refine_enabled: bool = False, ltx2_refine_upsampler_path: str | None = None, ltx2_refine_transformer_path: str | None = None, ltx2_refine_lora_path: str | None = None, ltx2_refine_num_inference_steps: int = 3, ltx2_refine_guidance_scale: float = 1.0, ltx2_refine_add_noise: bool = True, ltx2_refine_noise_path: str | None = None, ltx2_refine_audio_noise_path: str | None = None, ltx2_legacy_native_noise_order: bool = False, ltx2_use_distilled_sigmas: bool = True, model_paths: dict&#91;str, str&#93; = dict(), model_loaded: dict&#91;str, bool&#93; = (lambda: &#123;&#x27;transformer&#x27;: True, &#x27;vae&#x27;: True, &#x27;upsampler&#x27;: True&#125;)(), override_text_encoder_safetensors: str | None = None, override_text_encoder_quant: QuantizationMethods = None, transformer_quant: Any | None = None, override_transformer_cls_name: str | None = None, init_weights_from_safetensors: str = &#x27;&#x27;, init_weights_from_safetensors_2: str = &#x27;&#x27;, override_pipeline_cls_name: str | None = None, boundary_ratio: float | None = 0.875, pipeline_class: str = &#x27;&#x27;, pipeline_module: str = &#x27;&#x27;, data_path: str = &#x27;&#x27;, dataloader_num_workers: int = 0, num_height: int = 0, num_width: int = 0, num_frames: int = 0, train_batch_size: int = 0, num_latent_t: int = 0, group_frame: bool = False, group_resolution: bool = False, pretrained_model_name_or_path: str = &#x27;&#x27;, real_score_model_path: str = &#x27;&#x27;, fake_score_model_path: str = &#x27;&#x27;, ema_decay: float = 0.0, ema_start_step: int = 0, training_cfg_rate: float = 0.0, precondition_outputs: bool = False, validation_dataset_file: str = &#x27;&#x27;, validation_preprocessed_path: str = &#x27;&#x27;, validation_sampling_steps: str = &#x27;&#x27;, validation_guidance_scale: str = &#x27;&#x27;, validation_steps: float = 0.0, log_validation: bool = False, trackers: list&#91;str&#93; = list(), tracker_project_name: str = &#x27;&#x27;, wandb_run_name: str = &#x27;&#x27;, seed: int | None = None, output_dir: str = &#x27;&#x27;, checkpoints_total_limit: int = 0, resume_from_checkpoint: str = &#x27;&#x27;, num_train_epochs: int = 0, max_train_steps: int = 0, gradient_accumulation_steps: int = 0, learning_rate: float = 0.0, scale_lr: bool = False, lr_scheduler: str = &#x27;constant&#x27;, lr_warmup_steps: int = 0, max_grad_norm: float = 0.0, enable_gradient_checkpointing_type: str | None = None, selective_checkpointing: float = 0.0, mixed_precision: str = &#x27;&#x27;, train_sp_batch_size: int = 0, fsdp_sharding_startegy: str = &#x27;&#x27;, weighting_scheme: str = &#x27;&#x27;, logit_mean: float = 0.0, logit_std: float = 1.0, mode_scale: float = 0.0, num_euler_timesteps: int = 0, lr_num_cycles: int = 0, lr_power: float = 0.0, min_lr_ratio: float = 0.5, not_apply_cfg_solver: bool = False, distill_cfg: float = 0.0, scheduler_type: str = &#x27;&#x27;, linear_quadratic_threshold: float = 0.0, linear_range: float = 0.0, weight_decay: float = 0.0, betas: str = &#x27;0.9,0.999&#x27;, use_ema: bool = False, multi_phased_distill_schedule: str = &#x27;&#x27;, pred_decay_weight: float = 0.0, pred_decay_type: str = &#x27;&#x27;, hunyuan_teacher_disable_cfg: bool = False, master_weight_type: str = &#x27;&#x27;, VSA_decay_rate: float = 0.01, VSA_decay_interval_steps: int = 1, VSA_cache_tile_buf: bool = False, lora_rank: int | None = None, lora_alpha: int | None = None, lora_training: bool = False, ltx2_first_frame_conditioning_p: float = 0.1, generator_update_interval: int = 5, dfake_gen_update_ratio: int = 5, min_timestep_ratio: float = 0.2, max_timestep_ratio: float = 0.98, real_score_guidance_scale: float = 3.5, fake_score_learning_rate: float = 0.0, fake_score_lr_scheduler: str = &#x27;constant&#x27;, fake_score_betas: str = &#x27;0.9,0.999&#x27;, training_state_checkpointing_steps: int = 0, weight_only_checkpointing_steps: int = 0, log_visualization: bool = False, visualization_steps: int = 0, simulate_generator_forward: bool = False, warp_denoising_step: bool = False, num_frame_per_block: int = 3, independent_first_frame: bool = False, enable_gradient_masking: bool = True, gradient_mask_last_n_frames: int = 21, same_step_across_blocks: bool = False, last_step_only: bool = False, context_noise: int = 0)</code></pre>
<p>Training arguments. Inherits from FastVideoArgs and adds training-specific
arguments. If there are any conflicts, the training arguments will take
precedence.</p>

<h3 id="fastvideo.training.cosmos2_5_training_pipeline.TrainingArgs.from_cli_args"><code>fastvideo.training.cosmos2_5_training_pipeline.TrainingArgs.from_cli_args</code></h3>
<pre class="doc-signature"><code>from_cli_args(args: argparse.Namespace) -&gt; TrainingArgs</code></pre>

<h3 id="fastvideo.training.cosmos2_5_training_pipeline.TrainingArgs.add_cli_args"><code>fastvideo.training.cosmos2_5_training_pipeline.TrainingArgs.add_cli_args</code></h3>
<pre class="doc-signature"><code>add_cli_args(parser: FlexibleArgumentParser) -&gt; FlexibleArgumentParser</code></pre>

<h2 id="fastvideo.training.cosmos2_5_training_pipeline.init_logger"><code>fastvideo.training.cosmos2_5_training_pipeline.init_logger</code></h2>
<pre class="doc-signature"><code>init_logger(name: str) -&gt; _FastvideoLogger</code></pre>
<p>The main purpose of this function is to ensure that loggers are
retrieved in such a way that we can be sure the root fastvideo logger has
already been configured.</p>
<h2 id="fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler"><code>fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler</code></h2>
<pre class="doc-signature"><code>FlowUniPCMultistepScheduler(num_train_timesteps: int = 1000, solver_order: int = 2, prediction_type: str = &#x27;flow_prediction&#x27;, shift: float | None = 1.0, use_dynamic_shifting = False, thresholding: bool = False, dynamic_thresholding_ratio: float = 0.995, sample_max_value: float = 1.0, predict_x0: bool = True, solver_type: str = &#x27;bh2&#x27;, lower_order_final: bool = True, disable_corrector: tuple = (), solver_p: SchedulerMixin = None, timestep_spacing: str = &#x27;linspace&#x27;, steps_offset: int = 0, final_sigmas_type: str | None = &#x27;zero&#x27;, **kwargs)</code></pre>
<p><code>UniPCMultistepScheduler</code> is a training-free framework designed for the fast sampling of diffusion models.</p>
<p>This model inherits from [<code>SchedulerMixin</code>] and [<code>ConfigMixin</code>]. Check the superclass documentation for the generic
methods the library implements for all schedulers such as loading and saving.</p>
<h3>Parameters</h3>
<dl>
<dt><code>num_train_timesteps: `int`, defaults to 1000</code></dt><dd><p>The number of diffusion steps to train the model.</p></dd>
<dt><code>solver_order: `int`, default `2`</code></dt><dd><p>The UniPC order which can be any positive integer. The effective order of accuracy is <code>solver_order + 1</code>
due to the UniC. It is recommended to use <code>solver_order=2</code> for guided sampling, and <code>solver_order=3</code> for
unconditional sampling.</p></dd>
<dt><code>prediction_type: `str`, defaults to &quot;flow_prediction&quot;</code></dt><dd><p>Prediction type of the scheduler function; must be <code>flow_prediction</code> for this scheduler, which predicts
the flow of the diffusion process.</p></dd>
<dt><code>thresholding: `bool`, defaults to `False`</code></dt><dd><p>Whether to use the "dynamic thresholding" method. This is unsuitable for latent-space diffusion models such
as Stable Diffusion.</p></dd>
<dt><code>dynamic_thresholding_ratio: `float`, defaults to 0.995</code></dt><dd><p>The ratio for the dynamic thresholding method. Valid only when <code>thresholding=True</code>.</p></dd>
<dt><code>sample_max_value: `float`, defaults to 1.0</code></dt><dd><p>The threshold value for dynamic thresholding. Valid only when <code>thresholding=True</code> and <code>predict_x0=True</code>.</p></dd>
<dt><code>predict_x0: `bool`, defaults to `True`</code></dt><dd><p>Whether to use the updating algorithm on the predicted x0.</p></dd>
<dt><code>solver_type: `str`, default `bh2`</code></dt><dd><p>Solver type for UniPC. It is recommended to use <code>bh1</code> for unconditional sampling when steps &lt; 10, and <code>bh2</code>
otherwise.</p></dd>
<dt><code>lower_order_final: `bool`, default `True`</code></dt><dd><p>Whether to use lower-order solvers in the final steps. Only valid for &lt; 15 inference steps. This can
stabilize the sampling of DPMSolver for steps &lt; 15, especially for steps &lt;= 10.</p></dd>
<dt><code>disable_corrector: `list`, default `[]`</code></dt><dd><p>Decides which step to disable the corrector to mitigate the misalignment between <code>epsilon_theta(x_t, c)</code>
and <code>epsilon_theta(x_t^c, c)</code> which can influence convergence for a large guidance scale. Corrector is
usually disabled during the first few steps.</p></dd>
<dt><code>solver_p: `SchedulerMixin`, default `None`</code></dt><dd><p>Any other scheduler that if specified, the algorithm becomes <code>solver_p + UniC</code>.</p></dd>
<dt><code>use_karras_sigmas: `bool`, *optional*, defaults to `False`</code></dt><dd><p>Whether to use Karras sigmas for step sizes in the noise schedule during the sampling process. If <code>True</code>,
the sigmas are determined according to a sequence of noise levels &#123;σi&#125;.</p></dd>
<dt><code>use_exponential_sigmas: `bool`, *optional*, defaults to `False`</code></dt><dd><p>Whether to use exponential sigmas for step sizes in the noise schedule during the sampling process.</p></dd>
<dt><code>timestep_spacing: `str`, defaults to `&quot;linspace&quot;`</code></dt><dd><p>The way the timesteps should be scaled. Refer to Table 2 of the <a href="https://huggingface.co/papers/2305.08891">Common Diffusion Noise Schedules and
Sample Steps are Flawed</a> for more information.</p></dd>
<dt><code>steps_offset: `int`, defaults to 0</code></dt><dd><p>An offset added to the inference steps, as required by some model families.</p></dd>
<dt><code>final_sigmas_type: `str`, defaults to `&quot;zero&quot;`</code></dt><dd><p>The final <code>sigma</code> value for the noise schedule during the sampling process. If <code>"sigma_min"</code>, the final
sigma is the same as the last sigma in the training schedule. If <code>zero</code>, the final sigma is set to 0.</p></dd>
</dl>

<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.step_index"><code>fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.step_index</code></h3>
<pre class="doc-signature"><code>step_index</code></pre>
<p>The index counter for current timestep. It will increase 1 after each scheduler step.</p>
<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.begin_index"><code>fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.begin_index</code></h3>
<pre class="doc-signature"><code>begin_index</code></pre>
<p>The index for the first timestep. It should be set from pipeline with <code>set_begin_index</code> method.</p>
<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.set_shift"><code>fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.set_shift</code></h3>
<pre class="doc-signature"><code>set_shift(shift: float) -&gt; None</code></pre>

<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.set_begin_index"><code>fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.set_begin_index</code></h3>
<pre class="doc-signature"><code>set_begin_index(begin_index: int = 0)</code></pre>
<p>Sets the begin index for the scheduler. This function should be run from pipeline before the inference.</p>
<h4>Parameters</h4>
<dl>
<dt><code>begin_index: `int`</code></dt><dd><p>The begin index for the scheduler.</p></dd>
</dl>
<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.set_timesteps"><code>fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.set_timesteps</code></h3>
<pre class="doc-signature"><code>set_timesteps(num_inference_steps: int | None = None, device: str | torch.device = None, sigmas: list&#91;float&#93; | None = None, mu: float | None | None = None, shift: float | None | None = None, use_karras_sigmas: bool | None = None, use_kerras_sigma: bool | None = None)</code></pre>
<p>Sets the discrete timesteps used for the diffusion chain (to be run before inference).
Args:
    num_inference_steps (<code>int</code>):
        Total number of the spacing of the time steps.
    device (<code>str</code> or <code>torch.device</code>, <em>optional</em>):
        The device to which the timesteps should be moved to. If <code>None</code>, the timesteps are not moved.</p>
<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.time_shift"><code>fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.time_shift</code></h3>
<pre class="doc-signature"><code>time_shift(mu: float, sigma: float, t: torch.Tensor)</code></pre>

<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.convert_model_output"><code>fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.convert_model_output</code></h3>
<pre class="doc-signature"><code>convert_model_output(model_output: torch.Tensor, *args, sample: torch.Tensor = None, **kwargs) -&gt; torch.Tensor</code></pre>
<p>Convert the model output to the corresponding type the UniPC algorithm needs.</p>
<h4>Parameters</h4>
<dl>
<dt><code>model_output: `torch.Tensor`</code></dt><dd><p>The direct output from the learned diffusion model.</p></dd>
<dt><code>timestep: `int`</code></dt><dd><p>The current discrete timestep in the diffusion chain.</p></dd>
<dt><code>sample: `torch.Tensor`</code></dt><dd><p>A current instance of a sample created by the diffusion process.</p></dd>
</dl>
<h4>Returns</h4>
<dl>
<dt><code>torch.Tensor</code></dt><dd><p><code>torch.Tensor</code>:
The converted model output.</p></dd>
</dl>
<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.multistep_uni_p_bh_update"><code>fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.multistep_uni_p_bh_update</code></h3>
<pre class="doc-signature"><code>multistep_uni_p_bh_update(model_output: torch.Tensor, *args, sample: torch.Tensor = None, order: int | None = None, **kwargs) -&gt; torch.Tensor</code></pre>
<p>One step for the UniP (B(h) version). Alternatively, <code>self.solver_p</code> is used if is specified.</p>
<h4>Parameters</h4>
<dl>
<dt><code>model_output: `torch.Tensor`</code></dt><dd><p>The direct output from the learned diffusion model at the current timestep.</p></dd>
<dt><code>prev_timestep: `int`</code></dt><dd><p>The previous discrete timestep in the diffusion chain.</p></dd>
<dt><code>sample: `torch.Tensor`</code></dt><dd><p>A current instance of a sample created by the diffusion process.</p></dd>
<dt><code>order: `int`</code></dt><dd><p>The order of UniP at this timestep (corresponds to the <em>p</em> in UniPC-p).</p></dd>
</dl>
<h4>Returns</h4>
<dl>
<dt><code>torch.Tensor</code></dt><dd><p><code>torch.Tensor</code>:
The sample tensor at the previous timestep.</p></dd>
</dl>
<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.multistep_uni_c_bh_update"><code>fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.multistep_uni_c_bh_update</code></h3>
<pre class="doc-signature"><code>multistep_uni_c_bh_update(this_model_output: torch.Tensor, *args, last_sample: torch.Tensor = None, this_sample: torch.Tensor = None, order: int | None = None, **kwargs) -&gt; torch.Tensor</code></pre>
<p>One step for the UniC (B(h) version).</p>
<h4>Parameters</h4>
<dl>
<dt><code>this_model_output: `torch.Tensor`</code></dt><dd><p>The model outputs at <code>x_t</code>.</p></dd>
<dt><code>this_timestep: `int`</code></dt><dd><p>The current timestep <code>t</code>.</p></dd>
<dt><code>last_sample: `torch.Tensor`</code></dt><dd><p>The generated sample before the last predictor <code>x_&#123;t-1&#125;</code>.</p></dd>
<dt><code>this_sample: `torch.Tensor`</code></dt><dd><p>The generated sample after the last predictor <code>x_&#123;t&#125;</code>.</p></dd>
<dt><code>order: `int`</code></dt><dd><p>The <code>p</code> of UniC-p at this step. The effective order of accuracy should be <code>order + 1</code>.</p></dd>
</dl>
<h4>Returns</h4>
<dl>
<dt><code>torch.Tensor</code></dt><dd><p><code>torch.Tensor</code>:
The corrected sample tensor at the current timestep.</p></dd>
</dl>
<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.index_for_timestep"><code>fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.index_for_timestep</code></h3>
<pre class="doc-signature"><code>index_for_timestep(timestep, schedule_timesteps = None) -&gt; int</code></pre>

<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.step"><code>fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.step</code></h3>
<pre class="doc-signature"><code>step(model_output: torch.Tensor, timestep: int | torch.Tensor, sample: torch.Tensor, return_dict: bool = True, generator = None) -&gt; SchedulerOutput | tuple</code></pre>
<p>Predict the sample from the previous timestep by reversing the SDE. This function propagates the sample with
the multistep UniPC.</p>
<h4>Parameters</h4>
<dl>
<dt><code>model_output: `torch.Tensor`</code></dt><dd><p>The direct output from learned diffusion model.</p></dd>
<dt><code>timestep: `int`</code></dt><dd><p>The current discrete timestep in the diffusion chain.</p></dd>
<dt><code>sample: `torch.Tensor`</code></dt><dd><p>A current instance of a sample created by the diffusion process.</p></dd>
<dt><code>return_dict: `bool`</code></dt><dd><p>Whether or not to return a [<code>~schedulers.scheduling_utils.SchedulerOutput</code>] or <code>tuple</code>.</p></dd>
</dl>
<h4>Returns</h4>
<dl>
<dt><code>SchedulerOutput | tuple</code></dt><dd><p>[<code>~schedulers.scheduling_utils.SchedulerOutput</code>] or <code>tuple</code>:
If return_dict is <code>True</code>, [<code>~schedulers.scheduling_utils.SchedulerOutput</code>] is returned, otherwise a
tuple is returned where the first element is the sample tensor.</p></dd>
</dl>
<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.scale_model_input"><code>fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.scale_model_input</code></h3>
<pre class="doc-signature"><code>scale_model_input(sample: torch.Tensor, *args, **kwargs) -&gt; torch.Tensor</code></pre>
<p>Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
current timestep.</p>
<h4>Parameters</h4>
<dl>
<dt><code>sample: `torch.Tensor`</code></dt><dd><p>The input sample.</p></dd>
</dl>
<h4>Returns</h4>
<dl>
<dt><code>torch.Tensor</code></dt><dd><p><code>torch.Tensor</code>:
A scaled input sample.</p></dd>
</dl>
<h3 id="fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.add_noise"><code>fastvideo.training.cosmos2_5_training_pipeline.FlowUniPCMultistepScheduler.add_noise</code></h3>
<pre class="doc-signature"><code>add_noise(original_samples: torch.Tensor, noise: torch.Tensor, timesteps: torch.IntTensor) -&gt; torch.Tensor</code></pre>

<h2 id="fastvideo.training.cosmos2_5_training_pipeline.Cosmos2_5Pipeline"><code>fastvideo.training.cosmos2_5_training_pipeline.Cosmos2_5Pipeline</code></h2>
<pre class="doc-signature"><code>Cosmos2_5Pipeline(model_path: str, fastvideo_args: FastVideoArgs | TrainingArgs, required_config_modules: list&#91;str&#93; | None = None, loaded_modules: dict&#91;str, torch.nn.Module&#93; | None = None)</code></pre>
<p>Cosmos 2.5 video generation pipeline.</p>
<h3 id="fastvideo.training.cosmos2_5_training_pipeline.Cosmos2_5Pipeline.create_pipeline_stages"><code>fastvideo.training.cosmos2_5_training_pipeline.Cosmos2_5Pipeline.create_pipeline_stages</code></h3>
<pre class="doc-signature"><code>create_pipeline_stages(fastvideo_args: FastVideoArgs)</code></pre>

<h2 id="fastvideo.training.cosmos2_5_training_pipeline.TrainingBatch"><code>fastvideo.training.cosmos2_5_training_pipeline.TrainingBatch</code></h2>
<pre class="doc-signature"><code>TrainingBatch(current_timestep: int = 0, current_vsa_sparsity: float = 0.0, latents: torch.Tensor | None = None, raw_latent_shape: tuple&#91;int, ...&#93; | None = None, noise_latents: torch.Tensor | None = None, encoder_hidden_states: torch.Tensor | None = None, encoder_attention_mask: torch.Tensor | None = None, audio_latents: torch.Tensor | None = None, audio_noisy_model_input: torch.Tensor | None = None, audio_timesteps: torch.Tensor | None = None, audio_sigmas: torch.Tensor | None = None, audio_noise: torch.Tensor | None = None, audio_encoder_hidden_states: torch.Tensor | None = None, audio_encoder_attention_mask: torch.Tensor | None = None, conditioning_mask: torch.Tensor | None = None, preprocessed_image: torch.Tensor | None = None, image_embeds: torch.Tensor | None = None, image_latents: torch.Tensor | None = None, infos: list&#91;dict&#91;str, Any&#93;&#93; | None = None, mask_lat_size: torch.Tensor | None = None, trajectory_latents: torch.Tensor | None = None, trajectory_timesteps: torch.Tensor | None = None, noisy_model_input: torch.Tensor | None = None, timesteps: torch.Tensor | None = None, sigmas: torch.Tensor | None = None, noise: torch.Tensor | None = None, training_target: torch.Tensor | None = None, minimax_h3_layout: Any | None = None, attn_metadata_vsa: AttentionMetadata | None = None, attn_metadata: AttentionMetadata | None = None, input_kwargs: dict&#91;str, Any&#93; | None = None, loss: torch.Tensor | None = None, total_loss: float | None = None, grad_norm: float | None = None, encoder_hidden_states_neg: torch.Tensor | None = None, encoder_attention_mask_neg: torch.Tensor | None = None, conditional_dict: dict&#91;str, Any&#93; | None = None, unconditional_dict: dict&#91;str, Any&#93; | None = None, generator_loss: float = 0.0, fake_score_loss: float = 0.0, dmd_latent_vis_dict: dict&#91;str, Any&#93; = dict(), latent_vis_dict: dict&#91;str, Any&#93; = dict(), fake_score_latent_vis_dict: dict&#91;str, Any&#93; = dict(), minimax_h3_condition_video_rows: torch.Tensor | None = None, minimax_h3_condition_audio_rows: torch.Tensor | None = None, minimax_h3_dmd_layout: Any | None = None, minimax_h3_document_video_latents: tuple&#91;torch.Tensor, ...&#93; | None = None, minimax_h3_document_audio_latents: tuple&#91;torch.Tensor, ...&#93; | None = None, minimax_h3_text_attn_metadata: AttentionMetadata | None = None, sequence_packing_num_documents: int = 1, sequence_packing_num_tokens: int = 0, sequence_padded_num_tokens: int = 0, sequence_padding_ratio: float | None = None, sequence_packing_loss_scale: float = 1.0, sequence_packing_data_forced_ratio: float | None = None)</code></pre>


<h2 id="fastvideo.training.cosmos2_5_training_pipeline.TrainingPipeline"><code>fastvideo.training.cosmos2_5_training_pipeline.TrainingPipeline</code></h2>
<pre class="doc-signature"><code>TrainingPipeline(model_path: str, fastvideo_args: TrainingArgs, required_config_modules: list&#91;str&#93; | None = None, loaded_modules: dict&#91;str, torch.nn.Module&#93; | None = None)</code></pre>
<p>A pipeline for training a model. All training pipelines should inherit from this class.
All reusable components and code should be implemented in this class.</p>

<h3 id="fastvideo.training.cosmos2_5_training_pipeline.TrainingPipeline.create_pipeline_stages"><code>fastvideo.training.cosmos2_5_training_pipeline.TrainingPipeline.create_pipeline_stages</code></h3>
<pre class="doc-signature"><code>create_pipeline_stages(fastvideo_args: FastVideoArgs)</code></pre>

<h3 id="fastvideo.training.cosmos2_5_training_pipeline.TrainingPipeline.set_schemas"><code>fastvideo.training.cosmos2_5_training_pipeline.TrainingPipeline.set_schemas</code></h3>
<pre class="doc-signature"><code>set_schemas() -&gt; None</code></pre>

<h3 id="fastvideo.training.cosmos2_5_training_pipeline.TrainingPipeline.initialize_training_pipeline"><code>fastvideo.training.cosmos2_5_training_pipeline.TrainingPipeline.initialize_training_pipeline</code></h3>
<pre class="doc-signature"><code>initialize_training_pipeline(training_args: TrainingArgs)</code></pre>

<h3 id="fastvideo.training.cosmos2_5_training_pipeline.TrainingPipeline.initialize_validation_pipeline"><code>fastvideo.training.cosmos2_5_training_pipeline.TrainingPipeline.initialize_validation_pipeline</code></h3>
<pre class="doc-signature"><code>initialize_validation_pipeline(training_args: TrainingArgs)</code></pre>

<h3 id="fastvideo.training.cosmos2_5_training_pipeline.TrainingPipeline.train_one_step"><code>fastvideo.training.cosmos2_5_training_pipeline.TrainingPipeline.train_one_step</code></h3>
<pre class="doc-signature"><code>train_one_step(training_batch: TrainingBatch) -&gt; TrainingBatch</code></pre>

<h3 id="fastvideo.training.cosmos2_5_training_pipeline.TrainingPipeline.train"><code>fastvideo.training.cosmos2_5_training_pipeline.TrainingPipeline.train</code></h3>
<pre class="doc-signature"><code>train() -&gt; None</code></pre>

<h3 id="fastvideo.training.cosmos2_5_training_pipeline.TrainingPipeline.visualize_intermediate_latents"><code>fastvideo.training.cosmos2_5_training_pipeline.TrainingPipeline.visualize_intermediate_latents</code></h3>
<pre class="doc-signature"><code>visualize_intermediate_latents(training_batch: TrainingBatch, training_args: TrainingArgs, step: int)</code></pre>
<p>Add visualization data to tracker logging and save frames to disk.</p>
<h2 id="fastvideo.training.cosmos2_5_training_pipeline.Cosmos25TrainingPipeline"><code>fastvideo.training.cosmos2_5_training_pipeline.Cosmos25TrainingPipeline</code></h2>
<pre class="doc-signature"><code>Cosmos25TrainingPipeline(model_path: str, fastvideo_args: TrainingArgs, required_config_modules: list&#91;str&#93; | None = None, loaded_modules: dict&#91;str, torch.nn.Module&#93; | None = None)</code></pre>
<p>Training pipeline for Cosmos 2.5 (text-to-world).</p>
<p>Supports:
- Full fine-tuning (all transformer parameters)
- LoRA via the inherited LoRAPipeline mechanism
  (lora_param_names_mapping is set on Cosmos25Transformer3DModel)</p>
<details><summary>Source</summary><pre><code>class Cosmos25TrainingPipeline(TrainingPipeline):
    &quot;&quot;&quot;Training pipeline for Cosmos 2.5 (text-to-world).

    Supports:
    - Full fine-tuning (all transformer parameters)
    - LoRA via the inherited LoRAPipeline mechanism
      (lora_param_names_mapping is set on Cosmos25Transformer3DModel)
    &quot;&quot;&quot;

    _required_config_modules = &#91;&quot;scheduler&quot;, &quot;transformer&quot;, &quot;vae&quot;&#93;

    def initialize_pipeline(self, fastvideo_args: FastVideoArgs):
        &quot;&quot;&quot;Create the flow-matching scheduler with Cosmos 2.5&#x27;s shift=5.0.&quot;&quot;&quot;
        self.modules&#91;&quot;scheduler&quot;&#93; = FlowUniPCMultistepScheduler(shift=fastvideo_args.pipeline_config.flow_shift)

    def initialize_validation_pipeline(self, training_args: TrainingArgs):
        &quot;&quot;&quot;Build a full Cosmos2_5Pipeline that reuses the training transformer.&quot;&quot;&quot;
        logger.info(&quot;Initializing Cosmos 2.5 validation pipeline...&quot;)
        args_copy = deepcopy(training_args)
        args_copy.inference_mode = True

        validation_pipeline = Cosmos2_5Pipeline.from_pretrained(
            training_args.model_path,
            args=args_copy,
            inference_mode=True,
            loaded_modules=&#123;
                &quot;transformer&quot;: self.get_module(&quot;transformer&quot;),
            &#125;,
            tp_size=training_args.tp_size,
            sp_size=training_args.sp_size,
            num_gpus=training_args.num_gpus,
            pin_cpu_memory=training_args.pin_cpu_memory,
            dit_cpu_offload=True,
        )
        self.validation_pipeline = validation_pipeline

    # ------------------------------------------------------------------
    # Cosmos 2.5-specific overrides
    # ------------------------------------------------------------------

    def _normalize_dit_input(self, training_batch: TrainingBatch) -&gt; TrainingBatch:
        &quot;&quot;&quot;Skip: Cosmos25WanVAEWrapper normalises latents during encoding.

        Pre-computed latents stored in the dataset are already normalised
        (per-channel mean/std applied inside the VAE wrapper), so applying a
        second normalisation here would corrupt the inputs.
        &quot;&quot;&quot;
        return training_batch

    def _build_input_kwargs(self, training_batch: TrainingBatch) -&gt; TrainingBatch:
        &quot;&quot;&quot;Build the keyword arguments for Cosmos25Transformer3DModel.forward().

        Cosmos 2.5 forward() signature (T2W training subset):
            hidden_states : (B, 16, T, H, W)
            timestep      : (B,)  sigma values in &#91;0, 1&#93; — model expands to (B, 1)
            encoder_hidden_states : (B, seq, 100352)
            padding_mask  : (B, 1, H, W)  — all-ones for T2W (no spatial padding)
            fps           : int            — used only when rope_enable_fps_modulation=True
        &quot;&quot;&quot;
        assert training_batch.noisy_model_input is not None
        assert training_batch.encoder_hidden_states is not None
        assert training_batch.sigmas is not None

        noisy = training_batch.noisy_model_input  # (B, 16, T, H, W)
        batch_size, _c, _t, height, width = noisy.shape
        device = get_local_torch_device()

        # sigmas stored as (B, 1, 1, 1, 1) after get_sigmas; flatten to (B,)
        sigma_vals = training_batch.sigmas.view(batch_size).to(dtype=torch.bfloat16, device=device)

        # T2W: no spatial padding, all-ones padding mask (16 latent + 1 padding).
        padding_mask = torch.ones(
            batch_size,
            1,
            height,
            width,
            device=device,
            dtype=torch.bfloat16,
        )

        # T2W: no inpainting, all-zeros condition mask (adds 1 channel → total 18).
        condition_mask = torch.zeros(
            batch_size,
            1,
            _t,
            height,
            width,
            device=device,
            dtype=torch.bfloat16,
        )

        training_batch.input_kwargs = &#123;
            &quot;hidden_states&quot;: noisy,
            &quot;encoder_hidden_states&quot;: training_batch.encoder_hidden_states,
            # (B,) sigma in &#91;0, 1&#93;; model auto-expands to (B, 1) at line 901
            &quot;timestep&quot;: sigma_vals,
            &quot;condition_mask&quot;: condition_mask,
            &quot;padding_mask&quot;: padding_mask,
            # rope_enable_fps_modulation=False for the 2B checkpoint, so fps
            # has no effect on the embeddings, but the argument is still forwarded.
            &quot;fps&quot;: 24,
        &#125;
        return training_batch</code></pre></details>
<h3 id="fastvideo.training.cosmos2_5_training_pipeline.Cosmos25TrainingPipeline.initialize_pipeline"><code>fastvideo.training.cosmos2_5_training_pipeline.Cosmos25TrainingPipeline.initialize_pipeline</code></h3>
<pre class="doc-signature"><code>initialize_pipeline(fastvideo_args: FastVideoArgs)</code></pre>
<p>Create the flow-matching scheduler with Cosmos 2.5's shift=5.0.</p>
<details><summary>Source</summary><pre><code>def initialize_pipeline(self, fastvideo_args: FastVideoArgs):
    &quot;&quot;&quot;Create the flow-matching scheduler with Cosmos 2.5&#x27;s shift=5.0.&quot;&quot;&quot;
    self.modules&#91;&quot;scheduler&quot;&#93; = FlowUniPCMultistepScheduler(shift=fastvideo_args.pipeline_config.flow_shift)</code></pre></details>
<h3 id="fastvideo.training.cosmos2_5_training_pipeline.Cosmos25TrainingPipeline.initialize_validation_pipeline"><code>fastvideo.training.cosmos2_5_training_pipeline.Cosmos25TrainingPipeline.initialize_validation_pipeline</code></h3>
<pre class="doc-signature"><code>initialize_validation_pipeline(training_args: TrainingArgs)</code></pre>
<p>Build a full Cosmos2_5Pipeline that reuses the training transformer.</p>
<details><summary>Source</summary><pre><code>def initialize_validation_pipeline(self, training_args: TrainingArgs):
    &quot;&quot;&quot;Build a full Cosmos2_5Pipeline that reuses the training transformer.&quot;&quot;&quot;
    logger.info(&quot;Initializing Cosmos 2.5 validation pipeline...&quot;)
    args_copy = deepcopy(training_args)
    args_copy.inference_mode = True

    validation_pipeline = Cosmos2_5Pipeline.from_pretrained(
        training_args.model_path,
        args=args_copy,
        inference_mode=True,
        loaded_modules=&#123;
            &quot;transformer&quot;: self.get_module(&quot;transformer&quot;),
        &#125;,
        tp_size=training_args.tp_size,
        sp_size=training_args.sp_size,
        num_gpus=training_args.num_gpus,
        pin_cpu_memory=training_args.pin_cpu_memory,
        dit_cpu_offload=True,
    )
    self.validation_pipeline = validation_pipeline</code></pre></details>
<h2 id="fastvideo.training.cosmos2_5_training_pipeline.main"><code>fastvideo.training.cosmos2_5_training_pipeline.main</code></h2>
<pre class="doc-signature"><code>main(args) -&gt; None</code></pre>

<h2 id="fastvideo.training.cosmos2_5_training_pipeline.build_parser"><code>fastvideo.training.cosmos2_5_training_pipeline.build_parser</code></h2>
<pre class="doc-signature"><code>build_parser(pipeline_class: str | None = None, pipeline_module: str | None = None) -&gt; FlexibleArgumentParser</code></pre>
<p>Build the training-runner CLI parser.</p>
<p>When <code>pipeline_class</code>/<code>pipeline_module</code> are given they become optional defaults,
so the deprecated per-pipeline <code>__main__</code> blocks keep working without the flags.</p>
</div>
