Skip to content

Commit

Permalink
Testing for the non-safe-tensors case, since the default is safe-tens…
Browse files Browse the repository at this point in the history
…ors already
  • Loading branch information
hackyon committed Mar 7, 2024
1 parent c6974dd commit e6a1e76
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/models/deta/test_modeling_deta.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion tests/models/encodec/test_modeling_encodec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/models/lxmert/test_modeling_lxmert.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion tests/models/marian/test_modeling_marian.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion tests/models/musicgen/test_modeling_musicgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/models/sew/test_modeling_sew.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/models/sew_d/test_modeling_sew_d.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/models/timm_backbone/test_modeling_timm_backbone.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
5 changes: 2 additions & 3 deletions tests/test_modeling_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit e6a1e76

Please sign in to comment.