Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Make the one scored completion GRPO test follow the TRL version (#14775)
Daniel Hancd7850ce23be
diff --git a/tests/test_grpo_sample_weight.py b/tests/test_grpo_sample_weight.pyindex 4bed8c9eef0..c6b46159b72 100644--- a/tests/test_grpo_sample_weight.py+++ b/tests/test_grpo_sample_weight.py@@ -280,14 +280,23 @@ def test_exclusion_follows_normalize_then_sum(monkeypatch):assert _kept_groups(trainer, flat, monkeypatch) == [False]-def test_group_with_one_scored_completion_is_kept(monkeypatch):[email protected]("trl_version", [None, "1.5.1", "1.6.0"])+def test_group_with_one_scored_completion_is_kept(monkeypatch, trl_version):+ trl = pytest.importorskip("trl")+ from packaging.version import Version++ if trl_version is not None:+ monkeypatch.setattr(trl, "__version__", trl_version)+ masks_unscorable = Version(trl.__version__) >= Version("1.6.0")rpf = torch.full((2 * G, 2), torch.nan)rpf[0] = torch.tensor([1.0, 0.0])rpf[G:] = torch.tensor([[0.0, 1.0], [1.0, 1.0], [2.0, 1.0], [0.0, 0.0]])- for aggregation in ("sum_then_normalize", "normalize_then_sum"):- trainer = _trainer("dapo", None)- trainer.multi_objective_aggregation = aggregation- assert _kept_groups(trainer, rpf, monkeypatch) == [True, True]+ trainer = _trainer("dapo", None)+ # TRL < 1.6 scores unscored rows 0, so normalize_then_sum zeroes the group (nan z-scores) and excludes it.+ trainer.multi_objective_aggregation = "sum_then_normalize"+ assert _kept_groups(trainer, rpf, monkeypatch) == [True, True]+ trainer.multi_objective_aggregation = "normalize_then_sum"+ assert _kept_groups(trainer, rpf, monkeypatch) == [masks_unscorable, True]def test_unscored_completion_counts_as_zero_on_trl_before_1_6(monkeypatch):