MCPcopy
hub / github.com/zai-org/CogVideo / get_state_dict

Function get_state_dict

tools/convert_weight_sat2hf.py:140–148  ·  view source on GitHub ↗
(saved_dict: Dict[str, Any])

Source from the content-addressed store, hash-verified

138
139
140def get_state_dict(saved_dict: Dict[str, Any]) -> Dict[str, Any]:
141 state_dict = saved_dict
142 if "model" in saved_dict.keys():
143 state_dict = state_dict["model"]
144 if "module" in saved_dict.keys():
145 state_dict = state_dict["module"]
146 if "state_dict" in saved_dict.keys():
147 state_dict = state_dict["state_dict"]
148 return state_dict
149
150
151def update_state_dict_inplace(state_dict: Dict[str, Any], old_key: str, new_key: str) -> Dict[str, Any]:

Callers 2

convert_transformerFunction · 0.70
convert_vaeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected