|
31 | 31 | from maxdiffusion.models.vae_flax import FlaxAutoencoderKL |
32 | 32 | from maxdiffusion.models.qwen3_flax import FlaxQwen3Config, FlaxQwen3Model, load_and_convert_qwen3_weights |
33 | 33 |
|
| 34 | +# ----------------------------------------------------------------------------- |
| 35 | +# FlowMatch Scheduler Helpers |
| 36 | +# ----------------------------------------------------------------------------- |
| 37 | + |
| 38 | +def compute_empirical_mu(image_seq_len: int, num_steps: int) -> float: |
| 39 | + a1, b1 = 8.73809524e-05, 1.89833333 |
| 40 | + a2, b2 = 0.00016927, 0.45666666 |
| 41 | + if image_seq_len > 4300: |
| 42 | + mu = a2 * image_seq_len + b2 |
| 43 | + return float(mu) |
| 44 | + m_200 = a2 * image_seq_len + b2 |
| 45 | + m_10 = a1 * image_seq_len + b1 |
| 46 | + a = (m_200 - m_10) / 190.0 |
| 47 | + b = m_200 - 200.0 * a |
| 48 | + mu = a * num_steps + b |
| 49 | + return float(mu) |
| 50 | + |
34 | 51 | # ----------------------------------------------------------------------------- |
35 | 52 | # Latent Packing & Unpacking Helpers |
36 | 53 | # ----------------------------------------------------------------------------- |
@@ -875,7 +892,6 @@ def qwen3_init_fn(): |
875 | 892 |
|
876 | 893 | # 8. Set up Flow Match Scheduler |
877 | 894 | from maxdiffusion.schedulers.scheduling_flow_match_flax import FlaxFlowMatchScheduler |
878 | | - from diffusers.pipelines.flux2.pipeline_flux2 import compute_empirical_mu |
879 | 895 |
|
880 | 896 | print("Setting up FlowMatch Scheduler...") |
881 | 897 | num_inference_steps = 4 |
|
0 commit comments