Skip to content

Commit 3778a42

Browse files
pengminbehroozazarkhalili
authored andcommitted
test: cover negative mixture fractions in any position
Signed-off-by: pengmin <minpeng@semigraph.com>
1 parent a0dafe1 commit 3778a42

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

tests/test_cli_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ def test_dataset_fraction_partial_raises_error(self):
390390
[
391391
([0.0, 0.0], "must be greater than zero"),
392392
([-0.5, 1.5], "must be non-negative"),
393+
([1.5, -0.5], "must be non-negative"),
393394
],
394395
)
395396
def test_dataset_fraction_invalid_raises_error_before_loading(self, fractions, error_message):

trl/scripts/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class DatasetConfig:
6565
datasets, and the mixture size is capped so that no dataset is oversampled: the first `round(fraction * N)`
6666
rows of each dataset are kept, where `N` is the largest mixture size that avoids oversampling. Must be set
6767
for either all datasets in the mixture or none of them. Not supported for streaming datasets. When unset,
68-
the full datasets are concatenated.
68+
the full datasets are concatenated. Values must be non-negative and their sum must be greater than zero.
6969
"""
7070

7171
path: str

0 commit comments

Comments
 (0)