hunyuan
¶
Hunyuan model plugin package.
Classes¶
Modules¶
fastvideo.train.models.hunyuan.hunyuan
¶
Hunyuan model plugin (per-role instance).
Subclasses WanModel since HunyuanVideo uses the same FlowMatchEulerDiscreteScheduler and linear-interpolation noise schedule. Differences: - transformer class name - normalize_dit_input("hunyuan", ...) instead of ("wan", ...) - forward kwargs: no encoder_attention_mask, no return_dict - default flow_shift = 7
Classes¶
fastvideo.train.models.hunyuan.hunyuan.HunyuanModel
¶
HunyuanModel(*, init_from: str, training_config: TrainingConfig, trainable: bool = True, disable_custom_init_weights: bool = False, flow_shift: float = 7.0, enable_gradient_checkpointing_type: str | None = None, transformer_override_safetensor: str | None = None)
Bases: WanModel
HunyuanVideo per-role model.
Inherits most behaviour from WanModel (noise scheduler, timestep sampling, attention metadata, backward). Overrides only the pieces that differ for Hunyuan.
Source code in fastvideo/train/models/hunyuan/hunyuan.py
Functions¶
fastvideo.train.models.hunyuan.hunyuan.HunyuanModel.ensure_negative_conditioning
¶Encode the negative prompt with dual text encoders (LLaMA + CLIP).
Every rank encodes independently to avoid NCCL deadlocks when only a subset of ranks would otherwise participate.
Source code in fastvideo/train/models/hunyuan/hunyuan.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
fastvideo.train.models.hunyuan.hunyuan.HunyuanModel.prepare_batch
¶prepare_batch(raw_batch: dict[str, Any], *, generator: Generator, latents_source: Literal['data', 'zeros'] = 'data') -> TrainingBatch
Same flow as Wan, but uses Hunyuan VAE normalisation.