MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / load_state_dict_from_safetensors

Function load_state_dict_from_safetensors

diffsynth/models/utils.py:72–79  ·  view source on GitHub ↗
(file_path, torch_dtype=None)

Source from the content-addressed store, hash-verified

70
71
72def load_state_dict_from_safetensors(file_path, torch_dtype=None):
73 state_dict = {}
74 with safe_open(file_path, framework="pt", device="cpu") as f:
75 for k in f.keys():
76 state_dict[k] = f.get_tensor(k)
77 if torch_dtype is not None:
78 state_dict[k] = state_dict[k].to(torch_dtype)
79 return state_dict
80
81
82def load_state_dict_from_bin(file_path, torch_dtype=None):

Callers 1

load_state_dictFunction · 0.85

Calls 1

toMethod · 0.45

Tested by

no test coverage detected