Skip some export tests on torch 2.7 (#38677)
* skip * fix * better check * Update import_utils.py --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com> Co-authored-by: Cyril Vallez <cyril.vallez@gmail.com>
This commit is contained in:
@@ -19,6 +19,7 @@ from transformers import DepthAnythingConfig, Dinov2Config
|
||||
from transformers.file_utils import is_torch_available, is_vision_available
|
||||
from transformers.pytorch_utils import is_torch_greater_or_equal_than_2_4
|
||||
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
|
||||
from transformers.utils.import_utils import get_torch_major_and_minor_version
|
||||
|
||||
from ...test_configuration_common import ConfigTester
|
||||
from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor
|
||||
@@ -146,6 +147,7 @@ class DepthAnythingModelTest(ModelTesterMixin, PipelineTesterMixin, unittest.Tes
|
||||
test_resize_embeddings = False
|
||||
test_head_masking = False
|
||||
test_torch_exportable = True
|
||||
test_torch_exportable_strictly = not get_torch_major_and_minor_version() == "2.7"
|
||||
|
||||
def setUp(self):
|
||||
self.model_tester = DepthAnythingModelTester(self)
|
||||
@@ -285,8 +287,11 @@ class DepthAnythingModelIntegrationTest(unittest.TestCase):
|
||||
torch.testing.assert_close(predicted_depth[0, :3, :3], expected_slice, rtol=1e-4, atol=1e-4)
|
||||
|
||||
def test_export(self):
|
||||
for strict in [True, False]:
|
||||
for strict in [False, True]:
|
||||
with self.subTest(strict=strict):
|
||||
if strict and get_torch_major_and_minor_version() == "2.7":
|
||||
self.skipTest(reason="`strict=True` is currently failing with torch 2.7.")
|
||||
|
||||
if not is_torch_greater_or_equal_than_2_4:
|
||||
self.skipTest(reason="This test requires torch >= 2.4 to run.")
|
||||
model = (
|
||||
|
||||
Reference in New Issue
Block a user