---
title: lingbot_video_pipeline
---

<div class="python-reference">
<a id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline-classes"></a>
<a id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoPipeline-functions"></a>
<a id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline"></a>
<p>Stage-composed LingBot-Video Dense and MoE/refiner T2V pipeline.</p>
<h2 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.FastVideoArgs"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_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.pipelines.basic.lingbot_video.lingbot_video_pipeline.FastVideoArgs.is_output_rank"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_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.pipelines.basic.lingbot_video.lingbot_video_pipeline.FastVideoArgs.add_cli_args"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.FastVideoArgs.add_cli_args</code></h3>
<pre class="doc-signature"><code>add_cli_args(parser: FlexibleArgumentParser) -&gt; FlexibleArgumentParser</code></pre>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.FastVideoArgs.from_cli_args"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_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.pipelines.basic.lingbot_video.lingbot_video_pipeline.FastVideoArgs.from_kwargs"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.FastVideoArgs.from_kwargs</code></h3>
<pre class="doc-signature"><code>from_kwargs(**kwargs: Any) -&gt; FastVideoArgs</code></pre>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.FastVideoArgs.check_fastvideo_args"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_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.pipelines.basic.lingbot_video.lingbot_video_pipeline.FastVideoArgs.finalize_device_offload_policy"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_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.pipelines.basic.lingbot_video.lingbot_video_pipeline.FastVideoArgs.disable_offload_on_unified_memory"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_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.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase</code></h2>
<pre class="doc-signature"><code>ComposedPipelineBase(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>Base class for pipelines composed of multiple stages.</p>
<p>This class provides the framework for creating pipelines by composing multiple
stages together. Each stage is responsible for a specific part of the diffusion
process, and the pipeline orchestrates the execution of these stages.</p>
<p>Initialize the pipeline. After <strong>init</strong>, the pipeline should be ready to
use. The pipeline should be stateless and not hold any batch state.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.get_hf_download_component_dirs"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.get_hf_download_component_dirs</code></h3>
<pre class="doc-signature"><code>get_hf_download_component_dirs() -&gt; tuple&#91;str, ...&#93; | None</code></pre>
<p>Return component directories for an opt-in partial Hub download.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.get_hf_download_allow_patterns"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.get_hf_download_allow_patterns</code></h3>
<pre class="doc-signature"><code>get_hf_download_allow_patterns() -&gt; list&#91;str&#93; | None</code></pre>
<p>Return Hub patterns for the manifest and selected components.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.set_trainable"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.set_trainable</code></h3>
<pre class="doc-signature"><code>set_trainable() -&gt; None</code></pre>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.post_init"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.post_init</code></h3>
<pre class="doc-signature"><code>post_init() -&gt; None</code></pre>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.initialize_training_pipeline"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.initialize_training_pipeline</code></h3>
<pre class="doc-signature"><code>initialize_training_pipeline(training_args: TrainingArgs)</code></pre>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.initialize_validation_pipeline"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.initialize_validation_pipeline</code></h3>
<pre class="doc-signature"><code>initialize_validation_pipeline(training_args: TrainingArgs)</code></pre>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.from_pretrained"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.from_pretrained</code></h3>
<pre class="doc-signature"><code>from_pretrained(model_path: str, device: str | None = None, torch_dtype: torch.dtype | None = None, pipeline_config: str | PipelineConfig | None = None, args: argparse.Namespace | None = None, required_config_modules: list&#91;str&#93; | None = None, loaded_modules: dict&#91;str, torch.nn.Module&#93; | None = None, **kwargs) -&gt; ComposedPipelineBase</code></pre>
<p>Load a pipeline from a pretrained model.
loaded_modules: Optional[Dict[str, torch.nn.Module]] = None,
If provided, loaded_modules will be used instead of loading from config/pretrained weights.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.get_module"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.get_module</code></h3>
<pre class="doc-signature"><code>get_module(module_name: str, default_value: Any = None) -&gt; Any</code></pre>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.add_module"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.add_module</code></h3>
<pre class="doc-signature"><code>add_module(module_name: str, module: Any)</code></pre>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.required_config_modules"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.required_config_modules</code></h3>
<pre class="doc-signature"><code>required_config_modules: list&#91;str&#93;</code></pre>
<p>List of modules that are required by the pipeline. The names should match
the diffusers directory and model_index.json file. These modules will be
loaded using the PipelineComponentLoader and made available in the
modules dictionary. Access these modules using the get_module method.</p>
<p>class ConcretePipeline(ComposedPipelineBase):
    _required_config_modules = ["vae", "text_encoder", "transformer", "scheduler", "tokenizer"]</p>
<pre><code>@property
def required_config_modules(self):
    return self._required_config_modules
</code></pre>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.stages"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.stages</code></h3>
<pre class="doc-signature"><code>stages: list&#91;PipelineStage&#93;</code></pre>
<p>List of stages in the pipeline.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.create_pipeline_stages"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.create_pipeline_stages</code></h3>
<pre class="doc-signature"><code>create_pipeline_stages(fastvideo_args: FastVideoArgs)</code></pre>
<p>Create the inference pipeline stages.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.create_training_stages"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.create_training_stages</code></h3>
<pre class="doc-signature"><code>create_training_stages(training_args: TrainingArgs)</code></pre>
<p>Create the training pipeline stages.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.initialize_pipeline"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.initialize_pipeline</code></h3>
<pre class="doc-signature"><code>initialize_pipeline(fastvideo_args: FastVideoArgs)</code></pre>
<p>Initialize the pipeline.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.load_modules"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.load_modules</code></h3>
<pre class="doc-signature"><code>load_modules(fastvideo_args: FastVideoArgs, loaded_modules: dict&#91;str, torch.nn.Module&#93; | None = None) -&gt; dict&#91;str, Any&#93;</code></pre>
<p>Load the modules from the config.
loaded_modules: Optional[Dict[str, torch.nn.Module]] = None, 
If provided, loaded_modules will be used instead of loading from config/pretrained weights.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.add_stage"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.add_stage</code></h3>
<pre class="doc-signature"><code>add_stage(stage_name: str, stage: PipelineStage)</code></pre>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.forward"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.forward</code></h3>
<pre class="doc-signature"><code>forward(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -&gt; ForwardBatch</code></pre>
<p>Generate a video or image using the pipeline.</p>
<h4>Parameters</h4>
<dl>
<dt><code>batch: ForwardBatch</code></dt><dd><p>The batch to generate from.</p></dd>
<dt><code>fastvideo_args: FastVideoArgs</code></dt><dd><p>The inference arguments.</p></dd>
</dl>
<p>Returns:
    ForwardBatch: The batch with the generated video or image.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.train"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.train</code></h3>
<pre class="doc-signature"><code>train() -&gt; None</code></pre>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.close"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ComposedPipelineBase.close</code></h3>
<pre class="doc-signature"><code>close() -&gt; None</code></pre>

<h2 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LoRAPipeline"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LoRAPipeline</code></h2>
<pre class="doc-signature"><code>LoRAPipeline(*args, **kwargs)</code></pre>
<p>Pipeline that supports injecting LoRA adapters into the diffusion transformer.
TODO: support training.</p>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LoRAPipeline.add_module"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LoRAPipeline.add_module</code></h3>
<pre class="doc-signature"><code>add_module(module_name: str, module: Any) -&gt; None</code></pre>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LoRAPipeline.is_target_layer"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LoRAPipeline.is_target_layer</code></h3>
<pre class="doc-signature"><code>is_target_layer(module_name: str) -&gt; bool</code></pre>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LoRAPipeline.convert_adapter_state_dict"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LoRAPipeline.convert_adapter_state_dict</code></h3>
<pre class="doc-signature"><code>convert_adapter_state_dict(state_dict: dict&#91;str, torch.Tensor&#93;, lora_path: str) -&gt; dict&#91;str, torch.Tensor&#93;</code></pre>
<p>Rewrite a foreign-layout adapter into the layout the model's name mapping speaks.</p>
<p>The default leaves the adapter alone. Pipelines override it for model families whose published
adapters use another naming or fusion scheme, and raise when the adapter is unusable.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LoRAPipeline.set_trainable"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LoRAPipeline.set_trainable</code></h3>
<pre class="doc-signature"><code>set_trainable() -&gt; None</code></pre>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LoRAPipeline.convert_to_lora_layers"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LoRAPipeline.convert_to_lora_layers</code></h3>
<pre class="doc-signature"><code>convert_to_lora_layers() -&gt; None</code></pre>
<p>Unified method to convert the transformer to a LoRA transformer.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LoRAPipeline.set_lora_adapter"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LoRAPipeline.set_lora_adapter</code></h3>
<pre class="doc-signature"><code>set_lora_adapter(lora_nickname: str, lora_path: str | None = None, strength: float = 1.0, accumulate: bool = False)</code></pre>
<p>Load a LoRA adapter into the pipeline and merge it into the transformer.
Args:
    lora_nickname: The "nick name" of the adapter when referenced in the pipeline.
    lora_path: The path to the adapter, either a local path or a Hugging Face repo id.
    strength: Scale for the low-rank adapter. Hybrid adapters must set this at construction
        so their dense payload receives the same scale.
    accumulate: Add this adapter to an already merged pure low-rank adapter.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LoRAPipeline.merge_lora_weights"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LoRAPipeline.merge_lora_weights</code></h3>
<pre class="doc-signature"><code>merge_lora_weights() -&gt; None</code></pre>
<p>Merge LoRA weights, then repack the packed quantized buffers for the merged state.</p>
<p>NVFP4 layers are only supported while their BF16 weight is retained: a purged
BF16 weight cannot be unmerged and remerged.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LoRAPipeline.unmerge_lora_weights"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LoRAPipeline.unmerge_lora_weights</code></h3>
<pre class="doc-signature"><code>unmerge_lora_weights() -&gt; None</code></pre>
<p>Unmerge LoRA weights, then repack the packed quantized buffers for the unmerged state.</p>
<p>NVFP4 is rejected: its FP4 buffers cannot be rebuilt from a purged BF16 weight.</p>
<h2 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoDenoisingStage"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoDenoisingStage</code></h2>
<pre class="doc-signature"><code>LingBotVideoDenoisingStage(transformer, scheduler, refiner: bool = False)</code></pre>
<p>Run the released batched-CFG bf16 DiT loop with fp32 scheduler state.</p>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoDenoisingStage.forward"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoDenoisingStage.forward</code></h3>
<pre class="doc-signature"><code>forward(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -&gt; ForwardBatch</code></pre>
<p>Denoise latents while keeping scheduler samples and predictions in fp32.</p>
<h2 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoInputValidationStage"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoInputValidationStage</code></h2>
<pre class="doc-signature"><code>LingBotVideoInputValidationStage(refiner_enabled: bool = False)</code></pre>
<p>Validate released shape constraints and construct the official CUDA RNG.</p>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoInputValidationStage.forward"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoInputValidationStage.forward</code></h3>
<pre class="doc-signature"><code>forward(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -&gt; ForwardBatch</code></pre>
<p>Run shared validation, then enforce LingBot temporal and spatial geometry.</p>
<h2 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoLatentPreparationStage"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoLatentPreparationStage</code></h2>
<pre class="doc-signature"><code>LingBotVideoLatentPreparationStage(transformer)</code></pre>
<p>Prepare fp32 latents in the released 4x temporal and 8x spatial geometry.</p>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoLatentPreparationStage.forward"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoLatentPreparationStage.forward</code></h3>
<pre class="doc-signature"><code>forward(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -&gt; ForwardBatch</code></pre>
<p>Generate or validate one normalized fp32 latent video.</p>
<h2 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoRefinerPreparationStage"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoRefinerPreparationStage</code></h2>
<pre class="doc-signature"><code>LingBotVideoRefinerPreparationStage(vae, scheduler)</code></pre>
<p>Resize and encode the base video, then initialize the released refiner state.</p>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoRefinerPreparationStage.forward"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoRefinerPreparationStage.forward</code></h3>
<pre class="doc-signature"><code>forward(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -&gt; ForwardBatch</code></pre>
<p>Prepare high-resolution refiner latents and its exact truncated sigma schedule.</p>
<h2 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ConditioningStage"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ConditioningStage</code></h2>
<pre class="doc-signature"><code>ConditioningStage()</code></pre>
<p>Stage for applying conditioning to the diffusion process.</p>
<p>This stage handles the application of conditioning, such as classifier-free guidance,
to the diffusion process.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ConditioningStage.forward"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ConditioningStage.forward</code></h3>
<pre class="doc-signature"><code>forward(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -&gt; ForwardBatch</code></pre>
<p>Apply conditioning to the diffusion process.</p>
<h4>Parameters</h4>
<dl>
<dt><code>batch: ForwardBatch</code></dt><dd><p>The current batch information.</p></dd>
<dt><code>fastvideo_args: FastVideoArgs</code></dt><dd><p>The inference arguments.</p></dd>
</dl>
<h4>Returns</h4>
<dl>
<dt><code>ForwardBatch</code></dt><dd><p>The batch with applied conditioning.</p></dd>
</dl>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ConditioningStage.verify_input"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ConditioningStage.verify_input</code></h3>
<pre class="doc-signature"><code>verify_input(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -&gt; VerificationResult</code></pre>
<p>Verify conditioning stage inputs.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ConditioningStage.verify_output"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.ConditioningStage.verify_output</code></h3>
<pre class="doc-signature"><code>verify_output(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -&gt; VerificationResult</code></pre>
<p>Verify conditioning stage outputs.</p>
<h2 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.DecodingStage"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.DecodingStage</code></h2>
<pre class="doc-signature"><code>DecodingStage(vae, pipeline = None)</code></pre>
<p>Stage for decoding latent representations into pixel space.</p>
<p>This stage handles the decoding of latent representations into the final
output format (e.g., pixel values).</p>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.DecodingStage.verify_input"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.DecodingStage.verify_input</code></h3>
<pre class="doc-signature"><code>verify_input(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -&gt; VerificationResult</code></pre>
<p>Verify decoding stage inputs.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.DecodingStage.verify_output"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.DecodingStage.verify_output</code></h3>
<pre class="doc-signature"><code>verify_output(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -&gt; VerificationResult</code></pre>
<p>Verify decoding stage outputs.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.DecodingStage.decode"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.DecodingStage.decode</code></h3>
<pre class="doc-signature"><code>decode(latents: torch.Tensor, fastvideo_args: FastVideoArgs) -&gt; torch.Tensor</code></pre>
<p>Decode latent representations into pixel space using VAE.</p>
<h4>Parameters</h4>
<dl>
<dt><code>latents: torch.Tensor</code></dt><dd><p>Input latent tensor with shape (batch, channels, frames, height_latents, width_latents)</p></dd>
<dt><code>fastvideo_args: FastVideoArgs</code></dt><dd><p>Configuration containing:
- disable_autocast: Whether to disable automatic mixed precision (default: False)
- pipeline_config.vae_precision: VAE computation precision ("fp32", "fp16", "bf16")
- pipeline_config.vae_tiling: Whether to enable VAE tiling for memory efficiency</p></dd>
</dl>
<h4>Returns</h4>
<dl>
<dt><code>torch.Tensor</code></dt><dd><p>Decoded video tensor with shape (batch, channels, frames, height, width), </p></dd>
<dt><code>torch.Tensor</code></dt><dd><p>normalized to [0, 1] range and moved to CPU as float32</p></dd>
</dl>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.DecodingStage.streaming_decode"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.DecodingStage.streaming_decode</code></h3>
<pre class="doc-signature"><code>streaming_decode(latents: torch.Tensor, fastvideo_args: FastVideoArgs, cache: list&#91;torch.Tensor | None&#93; | None = None, is_first_chunk: bool = False) -&gt; tuple&#91;torch.Tensor, list&#91;torch.Tensor | None&#93;&#93;</code></pre>
<p>Decode latent representations into pixel space using VAE with streaming cache.</p>
<h4>Parameters</h4>
<dl>
<dt><code>latents: torch.Tensor</code></dt><dd><p>Input latent tensor with shape (batch, channels, frames, height_latents, width_latents)</p></dd>
<dt><code>fastvideo_args: FastVideoArgs</code></dt><dd><p>Configuration object.</p></dd>
<dt><code>cache: list[torch.Tensor | None] | None</code></dt><dd><p>VAE cache from previous call, or None to initialize a new cache.</p></dd>
<dt><code>is_first_chunk: bool</code></dt><dd><p>Whether this is the first chunk.</p></dd>
</dl>
<h4>Returns</h4>
<dl>
<dt><code>tuple[torch.Tensor, list[torch.Tensor | None]]</code></dt><dd><p>A tuple of (decoded_frames, updated_cache).</p></dd>
</dl>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.DecodingStage.forward"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.DecodingStage.forward</code></h3>
<pre class="doc-signature"><code>forward(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -&gt; ForwardBatch</code></pre>
<p>Decode latent representations into pixel space.</p>
<p>This method processes the batch through the VAE decoder, converting latent
representations to pixel-space video/images. It also optionally decodes
trajectory latents for visualization purposes.</p>
<h4>Parameters</h4>
<dl>
<dt><code>batch: ForwardBatch</code></dt><dd><p>The current batch containing:
- latents: Tensor to decode (batch, channels, frames, height_latents, width_latents)
- return_trajectory_decoded (optional): Flag to decode trajectory latents
- trajectory_latents (optional): Latents at different timesteps
- trajectory_timesteps (optional): Corresponding timesteps</p></dd>
<dt><code>fastvideo_args: FastVideoArgs</code></dt><dd><p>Configuration containing:
- output_type: "latent" to skip decoding, otherwise decode to pixels
- vae_cpu_offload: Whether to offload VAE to CPU after decoding
- model_loaded: Track VAE loading state
- model_paths: Path to VAE model if loading needed</p></dd>
</dl>
<h4>Returns</h4>
<dl>
<dt><code>ForwardBatch</code></dt><dd><p>Modified batch with:
- output: Decoded frames (batch, channels, frames, height, width) as CPU float32
- trajectory_decoded (if requested): List of decoded frames per timestep</p></dd>
</dl>
<h2 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TextEncodingStage"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TextEncodingStage</code></h2>
<pre class="doc-signature"><code>TextEncodingStage(text_encoders, tokenizers)</code></pre>
<p>Stage for encoding text prompts into embeddings for diffusion models.</p>
<p>This stage handles the encoding of text prompts into the embedding space
expected by the diffusion model.</p>
<p>Initialize the prompt encoding stage.</p>
<h3>Parameters</h3>
<dl>
<dt><code>enable_logging</code></dt><dd><p>Whether to enable logging for this stage.</p></dd>
<dt><code>is_secondary</code></dt><dd><p>Whether this is a secondary text encoder.</p></dd>
</dl>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TextEncodingStage.forward"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TextEncodingStage.forward</code></h3>
<pre class="doc-signature"><code>forward(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -&gt; ForwardBatch</code></pre>
<p>Encode the prompt into text encoder hidden states.</p>
<h4>Parameters</h4>
<dl>
<dt><code>batch: ForwardBatch</code></dt><dd><p>The current batch information.</p></dd>
<dt><code>fastvideo_args: FastVideoArgs</code></dt><dd><p>The inference arguments.</p></dd>
</dl>
<h4>Returns</h4>
<dl>
<dt><code>ForwardBatch</code></dt><dd><p>The batch with encoded prompt embeddings.</p></dd>
</dl>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TextEncodingStage.verify_input"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TextEncodingStage.verify_input</code></h3>
<pre class="doc-signature"><code>verify_input(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -&gt; VerificationResult</code></pre>
<p>Verify text encoding stage inputs.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TextEncodingStage.encode_text"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TextEncodingStage.encode_text</code></h3>
<pre class="doc-signature"><code>encode_text(text: str | list&#91;str&#93;, fastvideo_args: FastVideoArgs, encoder_index: int | list&#91;int&#93; | None = None, return_attention_mask: bool = False, return_type: str = &#x27;list&#x27;, device: torch.device | str | None = None, dtype: torch.dtype | None = None, max_length: int | Sequence&#91;int | None&#93; | None = None, truncation: bool | None = None, padding: bool | str | None = None)</code></pre>
<p>Encode plain text using selected text encoder(s) and return embeddings.</p>
<h4>Parameters</h4>
<dl>
<dt><code>text: str | list[str]</code></dt><dd><p>A single string or a list of strings to encode.</p></dd>
<dt><code>fastvideo_args: FastVideoArgs</code></dt><dd><p>The inference arguments providing pipeline config,
including tokenizer and encoder settings, preprocess and postprocess
functions.</p></dd>
<dt><code>encoder_index: int | list[int] | None</code></dt><dd><p>Encoder selector by index. Accepts an int or list of ints.</p></dd>
<dt><code>return_attention_mask: bool</code></dt><dd><p>If True, also return attention masks for each
selected encoder.</p></dd>
<dt><code>return_type: str</code></dt><dd><p>"list" (default) returns a list aligned with selection;
"dict" returns a dict keyed by encoder index as a string; "stack" stacks along a
new first dimension (requires matching shapes).</p></dd>
<dt><code>device: torch.device | str | None</code></dt><dd><p>Optional device override for inputs; defaults to local torch device.</p></dd>
<dt><code>dtype: torch.dtype | None</code></dt><dd><p>Optional dtype to cast returned embeddings to.</p></dd>
<dt><code>max_length: int | Sequence[int | None] | None</code></dt><dd><p>Optional per-call tokenizer override. Either one value applied to every
selected encoder (existing behavior), or a sequence with one entry per encoder in
<code>encoder_index</code> order -- <code>None</code> at a position falls back to that encoder's own
configured default instead of the override.</p></dd>
<dt><code>truncation: bool | None</code></dt><dd><p>Optional per-call tokenizer override.</p></dd>
<dt><code>padding: bool | str | None</code></dt><dd><p>Optional per-call tokenizer override.</p></dd>
</dl>
<h4>Returns</h4>
<dl>
<dt><code></code></dt><dd><p>Depending on return_type and return_attention_mask:</p></dd>
<dt><code></code></dt><dd><ul>
<li>list: List[Tensor] or (List[Tensor], List[Tensor])</li>
</ul></dd>
<dt><code></code></dt><dd><ul>
<li>dict: Dict[str, Tensor] or (Dict[str, Tensor], Dict[str, Tensor])</li>
</ul></dd>
<dt><code></code></dt><dd><ul>
<li>stack: Tensor of shape [num_encoders, ...] or a tuple with stacked
attention masks</li>
</ul></dd>
</dl>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TextEncodingStage.return_embeds"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TextEncodingStage.return_embeds</code></h3>
<pre class="doc-signature"><code>return_embeds(embeds_list: list&#91;torch.Tensor&#93;, attn_masks_list: list&#91;torch.Tensor&#93;, return_type: str = &#x27;list&#x27;, return_attention_mask: bool = False, indices: list&#91;int&#93; | None = None) -&gt; Any</code></pre>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TextEncodingStage.verify_output"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TextEncodingStage.verify_output</code></h3>
<pre class="doc-signature"><code>verify_output(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -&gt; VerificationResult</code></pre>
<p>Verify text encoding stage outputs.</p>
<h2 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TimestepPreparationStage"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TimestepPreparationStage</code></h2>
<pre class="doc-signature"><code>TimestepPreparationStage(scheduler)</code></pre>
<p>Stage for preparing timesteps for the diffusion process.</p>
<p>This stage handles the preparation of the timestep sequence that will be used
during the diffusion process.</p>

<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TimestepPreparationStage.forward"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TimestepPreparationStage.forward</code></h3>
<pre class="doc-signature"><code>forward(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -&gt; ForwardBatch</code></pre>
<p>Prepare timesteps for the diffusion process.</p>
<h4>Parameters</h4>
<dl>
<dt><code>batch: ForwardBatch</code></dt><dd><p>The current batch information.</p></dd>
<dt><code>fastvideo_args: FastVideoArgs</code></dt><dd><p>The inference arguments.</p></dd>
</dl>
<h4>Returns</h4>
<dl>
<dt><code>ForwardBatch</code></dt><dd><p>The batch with prepared timesteps.</p></dd>
</dl>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TimestepPreparationStage.verify_input"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TimestepPreparationStage.verify_input</code></h3>
<pre class="doc-signature"><code>verify_input(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -&gt; VerificationResult</code></pre>
<p>Verify timestep preparation stage inputs.</p>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TimestepPreparationStage.verify_output"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.TimestepPreparationStage.verify_output</code></h3>
<pre class="doc-signature"><code>verify_output(batch: ForwardBatch, fastvideo_args: FastVideoArgs) -&gt; VerificationResult</code></pre>
<p>Verify timestep preparation stage outputs.</p>
<h2 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoPipeline"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoPipeline</code></h2>
<pre class="doc-signature"><code>LingBotVideoPipeline(*args, **kwargs)</code></pre>
<p>T2V pipeline with optional released MoE pixel-space refinement.</p>
<details><summary>Source</summary><pre><code>class LingBotVideoPipeline(LoRAPipeline, ComposedPipelineBase):
    &quot;&quot;&quot;T2V pipeline with optional released MoE pixel-space refinement.&quot;&quot;&quot;

    is_video_pipeline = True
    _required_config_modules = &#91;&quot;text_encoder&quot;, &quot;tokenizer&quot;, &quot;vae&quot;, &quot;transformer&quot;, &quot;scheduler&quot;&#93;

    def load_modules(
        self,
        fastvideo_args: FastVideoArgs,
        loaded_modules: dict&#91;str, Any&#93; | None = None,
    ) -&gt; dict&#91;str, Any&#93;:
        &quot;&quot;&quot;Load the optional refiner DiT and the VAE encoder only when declared.&quot;&quot;&quot;
        model_index = self._load_config(self.model_path)
        required = list(type(self)._required_config_modules)
        load_refiner = &quot;transformer_2&quot; in model_index and getattr(fastvideo_args, &quot;refine_enabled&quot;, None) is not False
        if load_refiner:
            required.append(&quot;transformer_2&quot;)
            fastvideo_args.pipeline_config.vae_config.load_encoder = True
        self._required_config_modules = required
        return super().load_modules(fastvideo_args, loaded_modules)

    def initialize_pipeline(self, fastvideo_args: FastVideoArgs) -&gt; None:
        &quot;&quot;&quot;Apply the released runtime flow shift to the loaded scheduler.&quot;&quot;&quot;
        shift = fastvideo_args.pipeline_config.flow_shift
        if shift is None:
            raise ValueError(&quot;LingBot-Video requires a flow shift&quot;)
        self.get_module(&quot;scheduler&quot;).set_shift(float(shift))

    def create_pipeline_stages(self, fastvideo_args: FastVideoArgs) -&gt; None:
        &quot;&quot;&quot;Create base generation and the optional decoded-video refiner stages.&quot;&quot;&quot;
        refiner = self.get_module(&quot;transformer_2&quot;)
        self.add_stage(
            &quot;input_validation_stage&quot;,
            LingBotVideoInputValidationStage(refiner_enabled=refiner is not None),
        )
        self.add_stage(
            &quot;prompt_encoding_stage&quot;,
            TextEncodingStage(
                text_encoders=&#91;self.get_module(&quot;text_encoder&quot;)&#93;,
                tokenizers=&#91;self.get_module(&quot;tokenizer&quot;)&#93;,
            ),
        )
        self.add_stage(&quot;conditioning_stage&quot;, ConditioningStage())
        self.add_stage(
            &quot;timestep_preparation_stage&quot;,
            TimestepPreparationStage(scheduler=self.get_module(&quot;scheduler&quot;)),
        )
        self.add_stage(
            &quot;latent_preparation_stage&quot;,
            LingBotVideoLatentPreparationStage(transformer=self.get_module(&quot;transformer&quot;)),
        )
        self.add_stage(
            &quot;denoising_stage&quot;,
            LingBotVideoDenoisingStage(
                transformer=self.get_module(&quot;transformer&quot;),
                scheduler=self.get_module(&quot;scheduler&quot;),
            ),
        )
        self.add_stage(
            &quot;decoding_stage&quot;,
            DecodingStage(vae=self.get_module(&quot;vae&quot;), pipeline=self),
        )
        if refiner is not None:
            self.add_stage(
                &quot;refiner_preparation_stage&quot;,
                LingBotVideoRefinerPreparationStage(
                    vae=self.get_module(&quot;vae&quot;),
                    scheduler=self.get_module(&quot;scheduler&quot;),
                ),
            )
            self.add_stage(
                &quot;refiner_denoising_stage&quot;,
                LingBotVideoDenoisingStage(
                    transformer=refiner,
                    scheduler=self.get_module(&quot;scheduler&quot;),
                    refiner=True,
                ),
            )
            self.add_stage(
                &quot;refiner_decoding_stage&quot;,
                DecodingStage(vae=self.get_module(&quot;vae&quot;), pipeline=self),
            )</code></pre></details>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoPipeline.load_modules"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoPipeline.load_modules</code></h3>
<pre class="doc-signature"><code>load_modules(fastvideo_args: FastVideoArgs, loaded_modules: dict&#91;str, Any&#93; | None = None) -&gt; dict&#91;str, Any&#93;</code></pre>
<p>Load the optional refiner DiT and the VAE encoder only when declared.</p>
<details><summary>Source</summary><pre><code>def load_modules(
    self,
    fastvideo_args: FastVideoArgs,
    loaded_modules: dict&#91;str, Any&#93; | None = None,
) -&gt; dict&#91;str, Any&#93;:
    &quot;&quot;&quot;Load the optional refiner DiT and the VAE encoder only when declared.&quot;&quot;&quot;
    model_index = self._load_config(self.model_path)
    required = list(type(self)._required_config_modules)
    load_refiner = &quot;transformer_2&quot; in model_index and getattr(fastvideo_args, &quot;refine_enabled&quot;, None) is not False
    if load_refiner:
        required.append(&quot;transformer_2&quot;)
        fastvideo_args.pipeline_config.vae_config.load_encoder = True
    self._required_config_modules = required
    return super().load_modules(fastvideo_args, loaded_modules)</code></pre></details>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoPipeline.initialize_pipeline"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoPipeline.initialize_pipeline</code></h3>
<pre class="doc-signature"><code>initialize_pipeline(fastvideo_args: FastVideoArgs) -&gt; None</code></pre>
<p>Apply the released runtime flow shift to the loaded scheduler.</p>
<details><summary>Source</summary><pre><code>def initialize_pipeline(self, fastvideo_args: FastVideoArgs) -&gt; None:
    &quot;&quot;&quot;Apply the released runtime flow shift to the loaded scheduler.&quot;&quot;&quot;
    shift = fastvideo_args.pipeline_config.flow_shift
    if shift is None:
        raise ValueError(&quot;LingBot-Video requires a flow shift&quot;)
    self.get_module(&quot;scheduler&quot;).set_shift(float(shift))</code></pre></details>
<h3 id="fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoPipeline.create_pipeline_stages"><code>fastvideo.pipelines.basic.lingbot_video.lingbot_video_pipeline.LingBotVideoPipeline.create_pipeline_stages</code></h3>
<pre class="doc-signature"><code>create_pipeline_stages(fastvideo_args: FastVideoArgs) -&gt; None</code></pre>
<p>Create base generation and the optional decoded-video refiner stages.</p>
<details><summary>Source</summary><pre><code>def create_pipeline_stages(self, fastvideo_args: FastVideoArgs) -&gt; None:
    &quot;&quot;&quot;Create base generation and the optional decoded-video refiner stages.&quot;&quot;&quot;
    refiner = self.get_module(&quot;transformer_2&quot;)
    self.add_stage(
        &quot;input_validation_stage&quot;,
        LingBotVideoInputValidationStage(refiner_enabled=refiner is not None),
    )
    self.add_stage(
        &quot;prompt_encoding_stage&quot;,
        TextEncodingStage(
            text_encoders=&#91;self.get_module(&quot;text_encoder&quot;)&#93;,
            tokenizers=&#91;self.get_module(&quot;tokenizer&quot;)&#93;,
        ),
    )
    self.add_stage(&quot;conditioning_stage&quot;, ConditioningStage())
    self.add_stage(
        &quot;timestep_preparation_stage&quot;,
        TimestepPreparationStage(scheduler=self.get_module(&quot;scheduler&quot;)),
    )
    self.add_stage(
        &quot;latent_preparation_stage&quot;,
        LingBotVideoLatentPreparationStage(transformer=self.get_module(&quot;transformer&quot;)),
    )
    self.add_stage(
        &quot;denoising_stage&quot;,
        LingBotVideoDenoisingStage(
            transformer=self.get_module(&quot;transformer&quot;),
            scheduler=self.get_module(&quot;scheduler&quot;),
        ),
    )
    self.add_stage(
        &quot;decoding_stage&quot;,
        DecodingStage(vae=self.get_module(&quot;vae&quot;), pipeline=self),
    )
    if refiner is not None:
        self.add_stage(
            &quot;refiner_preparation_stage&quot;,
            LingBotVideoRefinerPreparationStage(
                vae=self.get_module(&quot;vae&quot;),
                scheduler=self.get_module(&quot;scheduler&quot;),
            ),
        )
        self.add_stage(
            &quot;refiner_denoising_stage&quot;,
            LingBotVideoDenoisingStage(
                transformer=refiner,
                scheduler=self.get_module(&quot;scheduler&quot;),
                refiner=True,
            ),
        )
        self.add_stage(
            &quot;refiner_decoding_stage&quot;,
            DecodingStage(vae=self.get_module(&quot;vae&quot;), pipeline=self),
        )</code></pre></details>
</div>
