Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WiP] Using the TerraTorch registry for Swin #475

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Removing these tests
Signed-off-by: Joao Lucas de Sousa Almeida <[email protected]>
Joao-L-S-Almeida committed Mar 6, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 127e7a1257d94be733cc85fde4e55eb427f26850
38 changes: 19 additions & 19 deletions tests/test_backbones.py
Original file line number Diff line number Diff line change
@@ -35,26 +35,26 @@ def input_386():
return torch.ones((1, NUM_CHANNELS, 386, 386))


@pytest.mark.parametrize("model_name", ["prithvi_swin_B", "prithvi_swin_L", "prithvi_swin_B"])
@pytest.mark.parametrize("test_input", ["input_224", "input_512"])
def test_can_create_backbones_from_timm(model_name, test_input, request):
backbone = timm.create_model(model_name, pretrained=False)
input_tensor = request.getfixturevalue(test_input)
backbone(input_tensor)
gc.collect()

@pytest.mark.parametrize("model_name", ["prithvi_swin_B", "prithvi_swin_L", "prithvi_swin_B"])
@pytest.mark.parametrize("test_input", ["input_224", "input_512"])
def test_can_create_backbones_from_timm_features_only(model_name, test_input, request):
backbone = timm.create_model(model_name, pretrained=False, features_only=True)
input_tensor = request.getfixturevalue(test_input)
backbone(input_tensor)
gc.collect()

@pytest.mark.parametrize("model_name", ["prithvi_swin_L", "prithvi_swin_L", "prithvi_swin_B"])
@pytest.mark.parametrize("prefix", ["", "timm_"])
#@pytest.mark.parametrize("model_name", ["prithvi_swin_B", "prithvi_swin_L", "prithvi_swin_B"])
#@pytest.mark.parametrize("test_input", ["input_224", "input_512"])
#def test_can_create_backbones_from_timm(model_name, test_input, request):
# backbone = timm.create_model(model_name, pretrained=False)
# input_tensor = request.getfixturevalue(test_input)
# backbone(input_tensor)
# gc.collect()

#@pytest.mark.parametrize("model_name", ["prithvi_swin_B", "prithvi_swin_L", "prithvi_swin_B"])
#@pytest.mark.parametrize("test_input", ["input_224", "input_512"])
#def test_can_create_backbones_from_timm_features_only(model_name, test_input, request):
# backbone = timm.create_model(model_name, pretrained=False, features_only=True)
# input_tensor = request.getfixturevalue(test_input)
# backbone(input_tensor)
# gc.collect()

@pytest.mark.parametrize("model_name", ["prithvi_swin_L", "prithvi_swin_B"])
#@pytest.mark.parametrize("prefix", [""])#, "timm_"])
def test_can_create_timm_backbones_from_registry(model_name, input_224, prefix):
backbone = BACKBONE_REGISTRY.build(prefix+model_name, pretrained=False)
backbone = BACKBONE_REGISTRY.build(model_name, pretrained=False)
backbone(input_224)
gc.collect()