Last active
August 30, 2025 07:10
-
-
Save anthonywu/2832147ff5f5f50c81df4d13152d2bed to your computer and use it in GitHub Desktop.
mflux 0.9.0 scheduler sigmas snapshot for unit testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
common_seed=12345 | |
common_args="--steps 20 --prompt sunset --seed 12345" | |
uvx --from mflux==0.9.0 mflux-generate --model dev --output sunset_dev_before.png $common_args | |
uvx --from mflux==0.9.0 mflux-generate --model schnell --output sunset_schnell_before.png $common_args | |
mflux-generate --scheduler linear --model dev --output sunset_dev_after.png $common_args | |
mflux-generate --scheduler linear --model schnell --output sunset_schnell_after.png $common_args |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env uvx --from mflux==0.9.0 python | |
import io | |
import mlx.core as mx | |
from mflux.config.config import Config | |
from mflux.config.runtime_config import RuntimeConfig | |
from mflux.config.model_config import ModelConfig | |
rt_config = RuntimeConfig( | |
Config( | |
# these are the only attributes relevant to schedulers | |
num_inference_steps=14, | |
width=1024, | |
height=1024, | |
), | |
ModelConfig.dev(), # requires_sigma_shift=True | |
) | |
sigmas_with_shift = RuntimeConfig._create_sigmas(rt_config, ModelConfig.dev()) | |
print(sigmas_with_shift) | |
sigmas_without_shift = RuntimeConfig._create_sigmas(rt_config, ModelConfig.schnell()) | |
print(sigmas_without_shift) | |
out1, out2 = io.BytesIO(), io.BytesIO() | |
mx.save(out1, sigmas_with_shift) | |
mx.save(out2, sigmas_without_shift) | |
compare1 = out1.getvalue().hex() | |
compare2 = out2.getvalue().hex() | |
print(compare1, compare2) | |
"""python | |
# to reverse the process above: hex string -> mx.array | |
mx.array( | |
np.load( | |
io.BytesIO( | |
bytes.fromhex( | |
"abcde...12345" | |
) | |
) | |
) | |
) | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in my
image_generation_test_helper.py
I have a un-commited diff that does this:it's showing the spots where the diff is greater than my
assert_allclose
tolerances set above