From e6a1e76585a6be3ec114f1e7aeb760e2969a4ff6 Mon Sep 17 00:00:00 2001 From: JB Lau <1557853+hackyon@users.noreply.github.com> Date: Wed, 28 Feb 2024 14:07:25 -0500 Subject: [PATCH] Testing for the non-safe-tensors case, since the default is safe-tensors already --- .../models/deformable_detr/test_modeling_deformable_detr.py | 2 +- tests/models/deta/test_modeling_deta.py | 2 +- tests/models/encodec/test_modeling_encodec.py | 2 +- tests/models/lxmert/test_modeling_lxmert.py | 2 +- tests/models/marian/test_modeling_marian.py | 2 +- tests/models/musicgen/test_modeling_musicgen.py | 2 +- tests/models/sew/test_modeling_sew.py | 2 +- tests/models/sew_d/test_modeling_sew_d.py | 2 +- tests/models/timm_backbone/test_modeling_timm_backbone.py | 2 +- tests/test_modeling_common.py | 5 ++--- 10 files changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/models/deformable_detr/test_modeling_deformable_detr.py b/tests/models/deformable_detr/test_modeling_deformable_detr.py index 08afd12e7e4d26..934c28bcd8e1e2 100644 --- a/tests/models/deformable_detr/test_modeling_deformable_detr.py +++ b/tests/models/deformable_detr/test_modeling_deformable_detr.py @@ -574,7 +574,7 @@ def test_save_load_low_cpu_mem_usage_checkpoints(self): pass @unittest.skip("No support for low_cpu_mem_usage=True.") - def test_save_load_low_cpu_mem_usage_safetensors(self): + def test_save_load_low_cpu_mem_usage_no_safetensors(self): pass def test_two_stage_training(self): diff --git a/tests/models/deta/test_modeling_deta.py b/tests/models/deta/test_modeling_deta.py index 7b7404dc68ca82..222af2b2cadf39 100644 --- a/tests/models/deta/test_modeling_deta.py +++ b/tests/models/deta/test_modeling_deta.py @@ -529,7 +529,7 @@ def test_save_load_low_cpu_mem_usage_checkpoints(self): pass @unittest.skip("No support for low_cpu_mem_usage=True.") - def test_save_load_low_cpu_mem_usage_safetensors(self): + def test_save_load_low_cpu_mem_usage_no_safetensors(self): pass diff --git a/tests/models/encodec/test_modeling_encodec.py b/tests/models/encodec/test_modeling_encodec.py index bafa121712b0b1..b2dcfe2b486e7f 100644 --- a/tests/models/encodec/test_modeling_encodec.py +++ b/tests/models/encodec/test_modeling_encodec.py @@ -329,7 +329,7 @@ def test_save_load_low_cpu_mem_usage_checkpoints(self): pass @unittest.skip("No support for low_cpu_mem_usage=True.") - def test_save_load_low_cpu_mem_usage_safetensors(self): + def test_save_load_low_cpu_mem_usage_no_safetensors(self): pass def test_determinism(self): diff --git a/tests/models/lxmert/test_modeling_lxmert.py b/tests/models/lxmert/test_modeling_lxmert.py index 8805a360352373..73568da9caecb2 100644 --- a/tests/models/lxmert/test_modeling_lxmert.py +++ b/tests/models/lxmert/test_modeling_lxmert.py @@ -776,7 +776,7 @@ def test_save_load_low_cpu_mem_usage_checkpoints(self): pass @unittest.skip("No support for low_cpu_mem_usage=True.") - def test_save_load_low_cpu_mem_usage_safetensors(self): + def test_save_load_low_cpu_mem_usage_no_safetensors(self): pass diff --git a/tests/models/marian/test_modeling_marian.py b/tests/models/marian/test_modeling_marian.py index 8473759ac894eb..3535df9720261d 100644 --- a/tests/models/marian/test_modeling_marian.py +++ b/tests/models/marian/test_modeling_marian.py @@ -381,7 +381,7 @@ def test_save_load_low_cpu_mem_usage_checkpoints(self): pass @unittest.skip("No support for low_cpu_mem_usage=True.") - def test_save_load_low_cpu_mem_usage_safetensors(self): + def test_save_load_low_cpu_mem_usage_no_safetensors(self): pass diff --git a/tests/models/musicgen/test_modeling_musicgen.py b/tests/models/musicgen/test_modeling_musicgen.py index 0f7f153c1bf044..dadf7139bda515 100644 --- a/tests/models/musicgen/test_modeling_musicgen.py +++ b/tests/models/musicgen/test_modeling_musicgen.py @@ -709,7 +709,7 @@ def test_save_load_low_cpu_mem_usage_checkpoints(self): pass @unittest.skip("No support for low_cpu_mem_usage=True.") - def test_save_load_low_cpu_mem_usage_safetensors(self): + def test_save_load_low_cpu_mem_usage_no_safetensors(self): pass # override since changing `output_hidden_states` / `output_attentions` from the top-level model config won't work diff --git a/tests/models/sew/test_modeling_sew.py b/tests/models/sew/test_modeling_sew.py index eef5528cfa6fa7..5342df9e088039 100644 --- a/tests/models/sew/test_modeling_sew.py +++ b/tests/models/sew/test_modeling_sew.py @@ -365,7 +365,7 @@ def test_save_load_low_cpu_mem_usage_checkpoints(self): pass @unittest.skip("No support for low_cpu_mem_usage=True.") - def test_save_load_low_cpu_mem_usage_safetensors(self): + def test_save_load_low_cpu_mem_usage_no_safetensors(self): pass def test_retain_grad_hidden_states_attentions(self): diff --git a/tests/models/sew_d/test_modeling_sew_d.py b/tests/models/sew_d/test_modeling_sew_d.py index 289d1646339523..1980bd3ab12166 100644 --- a/tests/models/sew_d/test_modeling_sew_d.py +++ b/tests/models/sew_d/test_modeling_sew_d.py @@ -469,7 +469,7 @@ def test_save_load_low_cpu_mem_usage_checkpoints(self): pass @unittest.skip("No support for low_cpu_mem_usage=True.") - def test_save_load_low_cpu_mem_usage_safetensors(self): + def test_save_load_low_cpu_mem_usage_no_safetensors(self): pass @slow diff --git a/tests/models/timm_backbone/test_modeling_timm_backbone.py b/tests/models/timm_backbone/test_modeling_timm_backbone.py index 87b00e670abf25..1cd04cd4843933 100644 --- a/tests/models/timm_backbone/test_modeling_timm_backbone.py +++ b/tests/models/timm_backbone/test_modeling_timm_backbone.py @@ -178,7 +178,7 @@ def test_save_load_low_cpu_mem_usage_checkpoints(self): pass @unittest.skip("No support for low_cpu_mem_usage=True.") - def test_save_load_low_cpu_mem_usage_safetensors(self): + def test_save_load_low_cpu_mem_usage_no_safetensors(self): pass @unittest.skip("model weights aren't tied in TimmBackbone.") diff --git a/tests/test_modeling_common.py b/tests/test_modeling_common.py index 9d71a9de0572a7..8a7cd2c65bdc65 100755 --- a/tests/test_modeling_common.py +++ b/tests/test_modeling_common.py @@ -456,15 +456,14 @@ def test_save_load_low_cpu_mem_usage_checkpoints(self): self._check_save_load_low_cpu_mem_usage(model_class, saved_model_path) - @require_safetensors @slow - def test_save_load_low_cpu_mem_usage_safetensors(self): + def test_save_load_low_cpu_mem_usage_no_safetensors(self): with tempfile.TemporaryDirectory() as saved_model_path: for model_class in self.all_model_classes: config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() model_to_save = model_class(config) - model_to_save.save_pretrained(saved_model_path, safe_serialization=True) + model_to_save.save_pretrained(saved_model_path, safe_serialization=False) self._check_save_load_low_cpu_mem_usage(model_class, saved_model_path) def _check_save_load_low_cpu_mem_usage(self, model_class, saved_model_path):