Skip to content

Commit

Permalink
adapting output tensor in teests
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Sanchez Hernandez committed Sep 18, 2024
1 parent f36537b commit 4170cba
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/models/altclip/test_modeling_altclip.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ def test_inference_interpolate_pos_encoding(self):
self.assertEqual(outputs.vision_model_output.last_hidden_state.shape, expected_shape)

expected_slice = torch.tensor(
[[-0.3671, -0.5896, 0.3435], [0.3136, 0.1141, 0.7695], [1.1259, -0.5578, 0.1346]]
[[-0.3589, -0.5939, 0.3534], [0.4346, 0.1647, 0.7071], [1.1404, -0.4716, 0.1664]]
).to(torch_device)

self.assertTrue(
Expand Down
2 changes: 1 addition & 1 deletion tests/models/bridgetower/test_modeling_bridgetower.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ def test_inference_interpolate_pos_encoding(self):
self.assertEqual(outputs.image_features.shape, expected_shape)

expected_slice = torch.tensor(
[[-0.6931, 0.5243, -0.4443], [-2.5986, -0.0715, -0.4051], [-2.5374, -0.0969, -0.4116]]
[[-0.6518, 0.4978, -0.4544], [-2.6672, -0.0843, -0.4210], [-2.4510, -0.1002, -0.3458]]
).to(torch_device)

self.assertTrue(torch.allclose(outputs.image_features[0, :3, :3], expected_slice, atol=1e-4))
2 changes: 1 addition & 1 deletion tests/models/chinese_clip/test_modeling_chinese_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ def test_inference_interpolate_pos_encoding(self):
self.assertEqual(outputs.vision_model_output.last_hidden_state.shape, expected_shape)

expected_slice = torch.tensor(
[[-0.4035, 0.3008, -0.1223], [-0.1505, -0.2903, 0.0250], [-0.3128, -0.5132, 0.8456]]
[[-0.3990, 0.2983, -0.1239], [-0.1452, -0.2759, 0.0403], [-0.3149, -0.4763, 0.8555]]
).to(torch_device)

self.assertTrue(
Expand Down
2 changes: 1 addition & 1 deletion tests/models/clip/test_modeling_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,7 @@ def test_inference_interpolate_pos_encoding(self):
self.assertEqual(outputs.vision_model_output.last_hidden_state.shape, expected_shape)

expected_slice = torch.tensor(
[[-0.1599, 0.0276, -0.3315], [0.2613, 0.1183, -0.5668], [0.0244, 0.1978, -0.6078]]
[[-0.1538, 0.0322, -0.3235], [0.2893, 0.1135, -0.5708], [0.0461, 0.1540, -0.6018]]
).to(torch_device)

self.assertTrue(
Expand Down
2 changes: 1 addition & 1 deletion tests/models/clipseg/test_modeling_clipseg.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ def test_inference_interpolate_pos_encoding(self):
self.assertEqual(outputs.vision_model_output.last_hidden_state.shape, expected_shape)

expected_slice = torch.tensor(
[[-0.1599, 0.0276, -0.3315], [0.2613, 0.1183, -0.5668], [0.0244, 0.1978, -0.6078]]
[[-0.1538, 0.0322, -0.3235], [0.2893, 0.1135, -0.5708], [0.0461, 0.1540, -0.6018]]
).to(torch_device)

self.assertTrue(
Expand Down
2 changes: 1 addition & 1 deletion tests/models/git/test_modeling_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ def test_inference_interpolate_pos_encoding(self):
self.assertEqual(outputs.last_hidden_state.shape, expected_shape)

expected_slice = torch.tensor(
[[-1.0274, 2.6038, 0.8594], [1.6899, 1.3264, -0.5352], [-1.4955, -0.1172, 0.0266]]
[[-1.0296, 2.5960, 0.8703], [1.7027, 1.3302, -0.4543], [-1.4932, -0.1084, 0.0502]]
).to(torch_device)

self.assertTrue(torch.allclose(outputs.last_hidden_state[0, :3, :3], expected_slice, atol=1e-4))
2 changes: 1 addition & 1 deletion tests/models/kosmos2/test_modeling_kosmos2.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ def test_inference_interpolate_pos_encoding(self):
self.assertEqual(outputs.vision_model_output.last_hidden_state.shape, expected_shape)

expected_slice = torch.tensor(
[[1.0551, -1.1680, 3.2926], [2.7077, 0.0720, -0.7721], [1.5863, 0.1665, -0.5936]]
[[1.0022, -1.1901, 3.2887], [2.6164, 0.0515, -0.8270], [1.8315, 0.1272, -0.8590]]
).to(torch_device)

self.assertTrue(
Expand Down
2 changes: 1 addition & 1 deletion tests/models/x_clip/test_modeling_x_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ def test_inference_interpolate_pos_encoding(self):
self.assertEqual(outputs.vision_model_output.last_hidden_state.shape, expected_shape)

expected_slice = torch.tensor(
[[-0.0312, 0.2034, 0.0556], [0.0323, 0.5420, -0.1794], [-0.0952, 0.7817, -0.3186]]
[[0.0126, 0.2109, 0.0609], [0.0448, 0.5862, -0.1688], [-0.0881, 0.8525, -0.3044]]
).to(torch_device)

self.assertTrue(
Expand Down

0 comments on commit 4170cba

Please sign in to comment.