MCPcopy
hub / github.com/huggingface/diffusers / test_load_model_device

Method test_load_model_device

tests/others/test_flashpack.py:61–66  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

59 @require_torch_gpu
60 @require_flashpack
61 def test_load_model_device(self):
62 model = AutoModel.from_pretrained(self.model_id, subfolder="transformer")
63 with tempfile.TemporaryDirectory() as temp_dir:
64 model.save_pretrained(temp_dir, use_flashpack=True)
65 model = AutoModel.from_pretrained(temp_dir, use_flashpack=True, device_map={"": torch.device("cuda")})
66 self.assertTrue(model.device.type == "cuda")
67
68 @require_flashpack
69 def test_load_model_device_auto(self):

Callers

nothing calls this directly

Calls 3

from_pretrainedMethod · 0.45
save_pretrainedMethod · 0.45
deviceMethod · 0.45

Tested by

no test coverage detected