Detect and use device context manager or global device in from_pretrained (#37216)

* Update modeling_utils.py

* improve

* Update modeling_utils.py

* Update test_modeling_common.py

* Update test_modeling_timm_backbone.py

* Update test_modeling_common.py

* Update test_modeling_common.py

* Update test_modeling_common.py

* Update test_modeling_common.py

* CIs
This commit is contained in:
Cyril Vallez
2025-04-15 09:59:20 +02:00
committed by GitHub
parent 4e63a1747c
commit c8e0e603de
3 changed files with 111 additions and 1 deletions

View File

@@ -168,6 +168,18 @@ class TimmBackboneModelTest(ModelTesterMixin, BackboneTesterMixin, PipelineTeste
def test_save_load_low_cpu_mem_usage_no_safetensors(self):
pass
@unittest.skip(reason="TimmBackbone uses its own `from_pretrained` without device_map support")
def test_can_load_with_device_context_manager(self):
pass
@unittest.skip(reason="TimmBackbone uses its own `from_pretrained` without device_map support")
def test_can_load_with_global_device_set(self):
pass
@unittest.skip(reason="TimmBackbone uses its own `from_pretrained` without device_map support")
def test_cannot_load_with_meta_device_context_manager(self):
pass
@unittest.skip(reason="model weights aren't tied in TimmBackbone.")
def test_tie_model_weights(self):
pass