[CLIPSeg] Make interpolate_pos_encoding default to True (#34419)

* Remove interpolate_pos_encoding

* Make fixup

* Make interpolate_pos_encoding default to True

* Reuse existing interpolation

* Add integration test
This commit is contained in:
NielsRogge
2024-10-31 22:15:04 +01:00
committed by GitHub
parent 203e27059b
commit df8640cedb
2 changed files with 11 additions and 15 deletions

View File

@@ -796,7 +796,7 @@ class CLIPSegModelIntegrationTest(unittest.TestCase):
# forward pass
with torch.no_grad():
outputs = model(**inputs, interpolate_pos_encoding=True)
outputs = model(**inputs)
# verify the predicted masks
self.assertEqual(
@@ -804,7 +804,7 @@ class CLIPSegModelIntegrationTest(unittest.TestCase):
torch.Size((3, 352, 352)),
)
expected_masks_slice = torch.tensor(
[[-7.4613, -7.4785, -7.3627], [-7.3268, -7.0898, -7.1333], [-6.9838, -6.7900, -6.8913]]
[[-7.4613, -7.4785, -7.3628], [-7.3268, -7.0899, -7.1333], [-6.9838, -6.7900, -6.8913]]
).to(torch_device)
self.assertTrue(torch.allclose(outputs.logits[0, :3, :3], expected_masks_slice, atol=1e-3))