Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions tests/smoke/test_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from instructlab.training.config import (
DataProcessArgs,
DistributedBackend,
LoraOptions,
TorchrunArgs,
TrainingArgs,
)
Expand Down Expand Up @@ -231,25 +232,36 @@ def cached_training_data(
@pytest.mark.parametrize(
"dist_backend", [DistributedBackend.FSDP, DistributedBackend.DEEPSPEED]
)
@pytest.mark.parametrize("cpu_offload", [True, False])
@pytest.mark.parametrize("cpu_offload", [False, True])
@pytest.mark.parametrize("lora_rank", [0])
@pytest.mark.parametrize("use_liger", [False, True])
def test_training_feature_matrix(
cached_test_model: pathlib.Path,
cached_training_data: pathlib.Path,
checkpoint_dir: pathlib.Path,
prepared_data_dir: pathlib.Path,
use_liger: bool,
lora_rank: int,
cpu_offload: bool,
dist_backend: DistributedBackend,
) -> None:
torch_args = TorchrunArgs(**DEFAULT_TORCHRUN_ARGS)
train_args = TrainingArgs(
model_path=str(cached_test_model),
data_path=str(cached_training_data),
data_output_dir=str(prepared_data_dir),
ckpt_output_dir=str(checkpoint_dir),
lora=LoraOptions(rank=lora_rank),
use_liger=use_liger,
**MINIMAL_TRAINING_ARGS,
)

train_args.distributed_backend = dist_backend

if lora_rank > 0:
# LoRA doesn't support full state saving.
train_args.accelerate_full_state_at_epoch = False

if dist_backend == DistributedBackend.FSDP:
train_args.fsdp_options.cpu_offload_params = cpu_offload
else:
Expand All @@ -258,6 +270,4 @@ def test_training_feature_matrix(
pytest.xfail("DeepSpeed CPU Adam isn't currently building correctly")
train_args.deepspeed_options.cpu_offload_optimizer = cpu_offload

torch_args = TorchrunArgs(**DEFAULT_TORCHRUN_ARGS)

run_training(torch_args=torch_args, train_args=train_args)
239 changes: 0 additions & 239 deletions tests/smoketest.sh

This file was deleted.

Loading