MCPcopy Create free account
hub / github.com/DeepGraphLearning/DiffPack / convert_model_ckpt

Function convert_model_ckpt

diffpack/util.py:148–167  ·  view source on GitHub ↗
(state_dict)

Source from the content-addressed store, hash-verified

146
147
148def convert_model_ckpt(state_dict):
149 new_state_dict = {}
150 for k, v in state_dict.items():
151 for i in range(4):
152 if k.startswith(f"model_list.{i}.sigma_embed_layer"):
153 new_k = k.replace(f"model_list.{i}.sigma_embed_layer", f"sigma_embedding_list.{i}")
154 new_state_dict[new_k] = v
155 elif k.startswith(f"model_list.{i}.gearnet"):
156 new_k = k.replace(f"model_list.{i}.gearnet", f"model_list.{i}")
157 new_state_dict[new_k] = v
158 elif k.startswith(f"model_list.{i}.torsion_mlp"):
159 new_k = k.replace(f"model_list.{i}.torsion_mlp", f"torsion_mlp_list.{i}")
160 new_state_dict[new_k] = v
161 elif k.startswith(f"confidence_model."):
162 new_k = k
163 new_state_dict[new_k] = v
164 elif k.startswith(f"mlp."):
165 new_k = k
166 new_state_dict[new_k] = v
167 return new_state_dict

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected