- Remove tautological test_trainer assertions that never trained - Drop grpo isfinite-only smokes and merge frozen-model checks via parametrize - Merge duplicate tool_parser cases (find/streaming/factory) with parametrize - Collapse duplicate dataset store/detect_format tests - Remove misleading scheduler/task tests that asserted the opposite of their names - Merge signal-handler SIGTERM/SIGINT into one parametrized case - Drop cross-file grpo strategy duplication kept in online_strategy
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
import pytest
|
|
|
|
from astrai.trainer import Trainer
|
|
|
|
|
|
def test_training_runs_with_various_batch_sizes(
|
|
base_test_env, random_dataset, train_config_factory
|
|
):
|
|
"""Training should complete for a range of batch sizes without error."""
|
|
for batch_per_device in [1, 2, 4]:
|
|
train_config = train_config_factory(
|
|
model_fn=lambda: base_test_env["model"],
|
|
dataset=random_dataset,
|
|
test_dir=base_test_env["test_dir"],
|
|
device=base_test_env["device"],
|
|
batch_per_device=batch_per_device,
|
|
)
|
|
trainer = Trainer(train_config)
|
|
trainer.train()
|
|
|
|
|
|
@pytest.mark.slow
|
|
def test_gradient_accumulation_runs(
|
|
base_test_env, random_dataset, train_config_factory
|
|
):
|
|
"""Training with gradient accumulation should complete."""
|
|
train_config = train_config_factory(
|
|
model_fn=lambda: base_test_env["model"],
|
|
dataset=random_dataset,
|
|
test_dir=base_test_env["test_dir"],
|
|
device=base_test_env["device"],
|
|
batch_per_device=2,
|
|
grad_accum_steps=4,
|
|
)
|
|
trainer = Trainer(train_config)
|
|
trainer.train()
|