Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
dakinggg committed Jun 13, 2024
1 parent f46f6ff commit 2098118
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/data/test_packing.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,12 @@ def test_auto_packing_with_streaming_dataloader(tmp_path: Path):
if batch_ix >= 3:
break

assert loader.dataset.packing_ratio is not None
assert loader.dataset.packing_ratio == int(loader.batch_size / 6)

state_dict = loader.dataset.state_dict(num_samples=2, from_beginning=False)
assert state_dict['sample_in_epoch'] == 2 * loader.dataset.packing_ratio


@pytest.mark.parametrize('packing_ratio', ['auto', 2.0])
@patch(
Expand Down

0 comments on commit 2098118

Please sign in to comment.