Fix slow backbone tests - out_indices must match stage name ordering (#28186)
Indices must match stage name ordering
This commit is contained in:
@@ -244,8 +244,8 @@ class AutoModelTest(unittest.TestCase):
|
|||||||
self.assertIsInstance(model, TimmBackbone)
|
self.assertIsInstance(model, TimmBackbone)
|
||||||
|
|
||||||
# Check kwargs are correctly passed to the backbone
|
# Check kwargs are correctly passed to the backbone
|
||||||
model = AutoBackbone.from_pretrained("resnet18", use_timm_backbone=True, out_indices=(-1, -2))
|
model = AutoBackbone.from_pretrained("resnet18", use_timm_backbone=True, out_indices=(-2, -1))
|
||||||
self.assertEqual(model.out_indices, (-1, -2))
|
self.assertEqual(model.out_indices, (-2, -1))
|
||||||
|
|
||||||
# Check out_features cannot be passed to Timm backbones
|
# Check out_features cannot be passed to Timm backbones
|
||||||
with self.assertRaises(ValueError):
|
with self.assertRaises(ValueError):
|
||||||
@@ -259,9 +259,9 @@ class AutoModelTest(unittest.TestCase):
|
|||||||
self.assertIsInstance(model, ResNetBackbone)
|
self.assertIsInstance(model, ResNetBackbone)
|
||||||
|
|
||||||
# Check kwargs are correctly passed to the backbone
|
# Check kwargs are correctly passed to the backbone
|
||||||
model = AutoBackbone.from_pretrained("microsoft/resnet-18", out_indices=[-1, -2])
|
model = AutoBackbone.from_pretrained("microsoft/resnet-18", out_indices=[-2, -1])
|
||||||
self.assertEqual(model.out_indices, [-1, -2])
|
self.assertEqual(model.out_indices, [-2, -1])
|
||||||
self.assertEqual(model.out_features, ["stage4", "stage3"])
|
self.assertEqual(model.out_features, ["stage3", "stage4"])
|
||||||
|
|
||||||
model = AutoBackbone.from_pretrained("microsoft/resnet-18", out_features=["stage2", "stage4"])
|
model = AutoBackbone.from_pretrained("microsoft/resnet-18", out_features=["stage2", "stage4"])
|
||||||
self.assertEqual(model.out_indices, [2, 4])
|
self.assertEqual(model.out_indices, [2, 4])
|
||||||
|
|||||||
Reference in New Issue
Block a user