mirror of
https://github.com/kohya-ss/sd-scripts.git
synced 2026-10-12 02:17:16 +00:00
`get_my_scheduler` (sample image generation during training) failed for two of the `--sample_sampler` choices with recent versions of diffusers: - `dpmsolver`: diffusers rejects its default `final_sigmas_type="zero"` for the non-++ algorithm. Pass `final_sigmas_type="sigma_min"` for this case (`dpmsolver++` keeps the default, so its output is unchanged). The same fix is applied to `--sampler dpmsolver` of gen_img.py / sdxl_gen_img.py. - `dpmsingle`: `DPMSolverSinglestepScheduler` has no `steps_offset` argument. Do not pass it, as gen_img.py already does. `lms` / `k_lms` need scipy, which is not in requirements.txt. Instead of failing at the first sample generation after the models are loaded, a new `check_sampler_requirements` raises a clear ImportError (with the pip command) at startup: in `verify_training_args` when `--sample_prompts` is set, and at the top of `main` of gen_img.py / sdxl_gen_img.py. tests/test_sampling_scheduler.py builds every sampler choice and checks the new behavior. The other samplers were verified to be unchanged with the local regression harness (tests/local, schedulers entry). Co-Authored-By: Claude Fable 5.1 <[email protected]>
Tests
Install
pip install pytest
Usage
pytest
Contribution
Pytest is configured to run tests in this directory. It might be a good idea to add tests closer in the code, as well as doctests.
Tests are functions starting with test_ and files with the pattern test_*.py.
def test_x():
assert 1 == 2, "Invalid test response"
Resources
pytest
- https://docs.pytest.org/en/stable/index.html
- https://docs.pytest.org/en/stable/how-to/assert.html
- https://docs.pytest.org/en/stable/how-to/doctest.html