Unverified Commit cd1350ce authored by amyeroberts's avatar amyeroberts Committed by GitHub
Browse files

Fix slow backbone tests - out_indices must match stage name ordering (#28186)

Indices must match stage name ordering
parent 260b9d21
......@@ -244,8 +244,8 @@ class AutoModelTest(unittest.TestCase):
self.assertIsInstance(model, TimmBackbone)
# Check kwargs are correctly passed to the backbone
model = AutoBackbone.from_pretrained("resnet18", use_timm_backbone=True, out_indices=(-1, -2))
self.assertEqual(model.out_indices, (-1, -2))
model = AutoBackbone.from_pretrained("resnet18", use_timm_backbone=True, out_indices=(-2, -1))
self.assertEqual(model.out_indices, (-2, -1))
# Check out_features cannot be passed to Timm backbones
with self.assertRaises(ValueError):
......@@ -259,9 +259,9 @@ class AutoModelTest(unittest.TestCase):
self.assertIsInstance(model, ResNetBackbone)
# Check kwargs are correctly passed to the backbone
model = AutoBackbone.from_pretrained("microsoft/resnet-18", out_indices=[-1, -2])
self.assertEqual(model.out_indices, [-1, -2])
self.assertEqual(model.out_features, ["stage4", "stage3"])
model = AutoBackbone.from_pretrained("microsoft/resnet-18", out_indices=[-2, -1])
self.assertEqual(model.out_indices, [-2, -1])
self.assertEqual(model.out_features, ["stage3", "stage4"])
model = AutoBackbone.from_pretrained("microsoft/resnet-18", out_features=["stage2", "stage4"])
self.assertEqual(model.out_indices, [2, 4])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment