distribution_matching ¶
Classes¶
fastvideo.train.methods.distribution_matching.AnyFlowMethod ¶
Bases: DMD2Method
AnyFlow on-policy distillation (multi-step rollout).
Source code in fastvideo/train/methods/distribution_matching/anyflow.py
fastvideo.train.methods.distribution_matching.AnyFlowPretrainMethod ¶
Bases: TrainingMethod
AnyFlow flow-map pretrain method.
Single-student training; no teacher or critic. The student must implement predict_velocity_with_r(noisy, t, r, batch, ...) — typically a WanModel with r_embedder=True in its arch config.
Source code in fastvideo/train/methods/distribution_matching/anyflow_pretrain.py
Methods:¶
fastvideo.train.methods.distribution_matching.AnyFlowPretrainMethod.backward ¶
backward(loss_map: dict[str, Tensor], outputs: dict[str, Any], *, grad_accum_rounds: int = 1) -> None
Route the loss backward through the student's forward_context so attn metadata stays attached during gradient computation.
Source code in fastvideo/train/methods/distribution_matching/anyflow_pretrain.py
fastvideo.train.methods.distribution_matching.DMD2Method ¶
Bases: TrainingMethod
DMD2 distillation algorithm (method layer).
Owns role model instances directly: - self.student — trainable student :class:ModelBase - self.teacher — frozen teacher :class:ModelBase - self.critic — trainable critic :class:ModelBase
Source code in fastvideo/train/methods/distribution_matching/dmd2.py
fastvideo.train.methods.distribution_matching.SelfForcingMethod ¶
Bases: DMD2Method
Self-Forcing DMD2 (distribution matching) method.
Requires a causal student implementing CausalModelBase.
Source code in fastvideo/train/methods/distribution_matching/self_forcing.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
fastvideo.train.methods.distribution_matching.StreamingLongTuningMethod ¶
Bases: SelfForcingMethod
Two-stage MatrixGame/LongLive-style self-forcing method.
Stage 1 uses the existing full self-forcing rollout over a short latent horizon. Stage 2 uses a persistent streaming sequence and trains on chunks generated with the causal student cache.