Skip to content

Add regression tests for schedulers, LoRA utils, and remote decode#16

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/regression-test-coverage-8799
Draft

Add regression tests for schedulers, LoRA utils, and remote decode#16
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/regression-test-coverage-8799

Conversation

@cursor

@cursor cursor Bot commented Jun 26, 2026

Copy link
Copy Markdown

What does this PR do?

Adds fast unit tests covering high-blast-radius production paths that previously had no dedicated scheduler or utility coverage.

Risky behavior now covered

  • FlowMatchEulerDiscreteScheduler — shared by SD3, Flux, Wan, and other flow-matching pipelines (timestep setup, dynamic shifting guard, step contract, denoising loop)
  • LTXEulerAncestralRFScheduler — LTX long-form video pipelines (custom sigma schedules, eta=0 determinism, step API)
  • HeliosScheduler — multi-stage set_timesteps(stage_index=...), Euler step, UniPC corrector path on second step
  • DDIMScheduler / DDPMSchedulerset_timesteps guard when num_inference_steps > num_train_timesteps (prevents inverted comparison regressions)
  • state_dict_utils — LoRA key remapping (PEFT ↔ Diffusers ↔ Kohya prefixes and alpha tensors)
  • remote_utils — decode/encode validation, image-type detection, postprocessing

Test files added/updated

File Tests
tests/schedulers/test_scheduler_flow_match_euler_discrete.py new — 9 tests
tests/schedulers/test_scheduler_ltx_euler_ancestral_rf.py new — 10 tests
tests/schedulers/test_scheduler_helios.py new — 8 tests
tests/others/test_state_dict_utils.py new — 11 tests
tests/others/test_remote_utils.py new — 9 tests
tests/schedulers/test_scheduler_ddim.py +2 guard tests
tests/schedulers/test_scheduler_ddpm.py +2 guard tests

Why these tests materially reduce regression risk

  • Schedulers with non-standard APIs cannot use SchedulerCommonTest; without dedicated contract tests, step-signature or timestep-schedule bugs slip through pipeline-only coverage.
  • LoRA conversion utilities are on every load/save path — incorrect key remapping silently produces wrong weights.
  • set_timesteps guard tests lock in correct comparison direction; an inverted check would reject all valid schedules.
  • Remote decode helpers gate server-side tensor round-trips; validation errors here surface only at integration time.

Validation

All 49 targeted tests pass locally:

python3 -m pytest -n auto --dist=loadfile -s -v \
  tests/schedulers/test_scheduler_flow_match_euler_discrete.py \
  tests/schedulers/test_scheduler_helios.py \
  tests/schedulers/test_scheduler_ltx_euler_ancestral_rf.py \
  tests/others/test_state_dict_utils.py \
  tests/others/test_remote_utils.py \
  tests/schedulers/test_scheduler_ddim.py::DDIMSchedulerTest::test_set_timesteps_num_inference_steps_exceeds_train_timesteps_raises \
  tests/schedulers/test_scheduler_ddim.py::DDIMSchedulerTest::test_set_timesteps_num_inference_steps_at_limit_succeeds \
  tests/schedulers/test_scheduler_ddpm.py::DDPMSchedulerTest::test_set_timesteps_num_inference_steps_exceeds_train_timesteps_raises \
  tests/schedulers/test_scheduler_ddpm.py::DDPMSchedulerTest::test_set_timesteps_num_inference_steps_at_limit_succeeds

Before submitting

  • Did you write any new necessary tests?
Open in Web View Automation 

Cover high-blast-radius gaps: FlowMatchEuler, LTX RF ancestral, Helios
multi-stage/UniPC corrector, DDIM/DDPM set_timesteps guards, LoRA Kohya
conversion prefixes, and remote decode/encode validation.

Co-authored-by: Simon Lynch <srlynch1@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant