Skip to content

Add regression tests for schedulers, loaders, and pipeline weight selection - #30

Draft
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/regression-test-coverage-f0a6
Draft

Add regression tests for schedulers, loaders, and pipeline weight selection#30
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/regression-test-coverage-f0a6

Conversation

@cursor

@cursor cursor Bot commented Jul 3, 2026

Copy link
Copy Markdown

What does this PR do?

Adds fast regression tests for high-blast-radius utilities and schedulers that previously had little or no direct unit coverage.

Risky behavior now covered

  • _get_ignore_patterns — decides which weight formats (.bin, .safetensors, .onnx, flashpack) are downloaded/loaded on every from_pretrained call; now tested for flax, safetensors, flashpack, pickle fallback, ONNX toggles, and incompatible-safetensors errors.
  • infer_diffusers_model_type — shape/key-based checkpoint classifier gating all single-file loading; now tested for Flux2, LTX2, Wan variants, Z-Image ControlNet 2.0 vs 2.1, Cosmos invalid shapes, and v1 fallback.
  • state_dict_utils — LoRA key-format translation (DIFFUSERS ↔ PEFT ↔ Kohya); round-trip and fallback paths.
  • loading_utilsload_image/load_video validation, submodule resolution for LoRA injection.
  • remote_utils — remote VAE encode/decode input validation.
  • Schedulers — FlowMatch Euler, Helios, LTX Euler Ancestral RF, CogVideoX DDIM/DPM, DDPM Wuerstchen: set_timesteps, step, and scheduler-specific math.

Test files added/updated

File Purpose
tests/loaders/test_single_file_utils.py Newinfer_diffusers_model_type branch coverage
tests/pipelines/test_pipeline_utils.py UpdatedIgnorePatternsTests for _get_ignore_patterns
tests/others/test_state_dict_utils.py New — LoRA state dict conversion
tests/others/test_loading_utils.py New — image/video loading and module lookup
tests/others/test_remote_utils.py New — remote VAE validation
tests/schedulers/test_scheduler_flow_match_euler_discrete.py New
tests/schedulers/test_scheduler_helios.py New
tests/schedulers/test_scheduler_ltx_euler_ancestral_rf.py New
tests/schedulers/test_scheduler_cogvideox.py New
tests/schedulers/test_scheduler_ddpm_wuerstchen.py New

Why these tests materially reduce regression risk

These modules sit on critical paths used by dozens of pipelines. Integration tests exercise happy paths only; a wrong ignore pattern or misclassified checkpoint type fails silently or at Hub download time. The new tests are deterministic, CPU-only, and run in ~6s (96 tests), making them suitable for every CI run.

Validation

python3 -m pytest -n auto --dist=loadfile -s -v \
  tests/loaders/test_single_file_utils.py \
  tests/pipelines/test_pipeline_utils.py::IgnorePatternsTests \
  tests/others/test_state_dict_utils.py \
  tests/others/test_loading_utils.py \
  tests/others/test_remote_utils.py \
  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/schedulers/test_scheduler_cogvideox.py \
  tests/schedulers/test_scheduler_ddpm_wuerstchen.py

Result: 96 passed

Before submitting

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

cursoragent and others added 3 commits July 3, 2026 02:05
Cover FlowMatchEulerDiscreteScheduler, HeliosScheduler, and
LTXEulerAncestralRFScheduler contract behavior, DDIM/DDPM
set_timesteps validation guards, state_dict LoRA conversion paths,
and remote_utils encode/decode helpers.

Co-authored-by: Simon Lynch <srlynch1@users.noreply.github.com>
…g_utils

Cover high-blast-radius code paths that previously only had indirect
pipeline coverage:
- CogVideoXDDIMScheduler SNR shift and set_timesteps guard
- CogVideoXDPMScheduler multi-step API (old_pred_original_sample)
- DDPMWuerstchenScheduler float timestep schedule and add_noise
- loading_utils path/URL validation and submodule resolution

Use python -m ruff in check_copies so the commit hook works when ruff
is installed as a Python package but not on PATH.

Co-authored-by: Simon Lynch <srlynch1@users.noreply.github.com>
…nference

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