MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / save

Method save

models/rgb_to_material.py:37–48  ·  view source on GitHub ↗
(self, root_folder, experiment_name, hyperparams, iter_nr, info=None)

Source from the content-addressed store, hash-verified

35 self.apply(lambda x: kaiming_init(x, False, nonlinearity="silu"))
36
37 def save(self, root_folder, experiment_name, hyperparams, iter_nr, info=None):
38 name=str(iter_nr)
39 if info is not None:
40 name+="_"+info
41 models_path = os.path.join(root_folder, experiment_name, name, "models")
42 if not os.path.exists(models_path):
43 os.makedirs(models_path, exist_ok=True)
44 torch.save(self.state_dict(), os.path.join(models_path, "rgb2material.pt"))
45
46 hyperparams_params_path=os.path.join(models_path, "hyperparams.json")
47 with open(hyperparams_params_path, 'w', encoding='utf-8') as f:
48 json.dump(vars(hyperparams), f, ensure_ascii=False, indent=4)
49
50
51 def forward(self, batch_dict):

Callers

nothing calls this directly

Calls 1

state_dictMethod · 0.45

Tested by

no test coverage detected