Files
Kohya-ss-sd-scripts/tests
rockerBOO 4f27c6a0c9 Add BPO, CPO, DDO, SDPO, SimPO
Refactor Preference Optimization
Refactor preference dataset
Add iterator support for ImageInfo and ImageSetInfo
- Supporting iterating through either ImageInfo or ImageSetInfo to
  clean up preference dataset implementation and support 2 or more
  images more cleanly without needing to duplicate code
Add tests for all PO functions
Add metrics for process_batch
Add losses for gradient manipulation of loss parts
Add normalizing gradient for stabilizing gradients

Args added:

mapo_beta = 0.05
cpo_beta = 0.1
bpo_beta = 0.1
bpo_lambda = 0.2
sdpo_beta = 0.02
simpo_gamma_beta_ratio = 0.25
simpo_beta = 2.0
simpo_smoothing = 0.0
simpo_loss_type = "sigmoid"
ddo_alpha = 4.0
ddo_beta = 0.05
2025-06-03 15:09:48 -04:00
..
2025-06-03 15:09:48 -04:00
2024-12-02 13:51:57 -05:00
2024-11-29 15:52:03 -05:00

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

PyTorch testing