Skip to content

Commit 1f83f6d

Browse files
committed
more tiny fixes
1 parent 20427f2 commit 1f83f6d

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

src/maxdiffusion/generate_flux2klein.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@
3131
from maxdiffusion.models.vae_flax import FlaxAutoencoderKL
3232
from maxdiffusion.models.qwen3_flax import FlaxQwen3Config, FlaxQwen3Model, load_and_convert_qwen3_weights
3333

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+
3451
# -----------------------------------------------------------------------------
3552
# Latent Packing & Unpacking Helpers
3653
# -----------------------------------------------------------------------------
@@ -875,7 +892,6 @@ def qwen3_init_fn():
875892

876893
# 8. Set up Flow Match Scheduler
877894
from maxdiffusion.schedulers.scheduling_flow_match_flax import FlaxFlowMatchScheduler
878-
from diffusers.pipelines.flux2.pipeline_flux2 import compute_empirical_mu
879895

880896
print("Setting up FlowMatch Scheduler...")
881897
num_inference_steps = 4

0 commit comments

Comments
 (0)