MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / initialize_dummy_state_dict

Function initialize_dummy_state_dict

diffusers/tests/lora/utils.py:69–72  ·  view source on GitHub ↗
(state_dict)

Source from the content-addressed store, hash-verified

67
68
69def initialize_dummy_state_dict(state_dict):
70 if not all(v.device.type == "meta" for _, v in state_dict.items()):
71 raise ValueError("`state_dict` has non-meta values.")
72 return {k: torch.randn(v.shape, device=torch_device, dtype=v.dtype) for k, v in state_dict.items()}
73
74
75@require_peft_backend

Calls

no outgoing calls

Tested by 1