Skip to content

Commit

Permalink
Using the Lightning CLI interface to run tests
Browse files Browse the repository at this point in the history
Signed-off-by: João Lucas de Sousa Almeida <[email protected]>
  • Loading branch information
Joao-L-S-Almeida committed Jul 3, 2024
1 parent 1ebeeb5 commit 6379737
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions tests/test_finetune.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import subprocess
import os

from terratorch.models.backbones.prithvi_vit import checkpoint_filter_fn as checkpoint_filter_fn_vit
from terratorch.models.backbones.prithvi_swin import checkpoint_filter_fn as checkpoint_filter_fn_swin
from terratorch.cli_tools import build_lightning_cli

@pytest.mark.parametrize("model_name", ["prithvi_swin_B", "prithvi_swin_L", "prithvi_vit_100", "prithvi_vit_300"])
def test_finetune_multiple_backbones(model_name):
Expand All @@ -21,11 +20,7 @@ def test_finetune_multiple_backbones(model_name):
torch.save(state_dict, os.path.join("tests/", model_name + ".pt"))

# Running the terratorch CLI
command_str = f"terratorch fit -c tests/manufactured-finetune_{model_name}.yaml"

command_out = subprocess.run(command_str, shell=True)

assert not command_out.returncode

command_list = ["fit", "-c", f"tests/manufactured-finetune_{model_name}.yaml"]
_ = build_lightning_cli(command_list)


0 comments on commit 6379737

Please sign in to comment.