MCPcopy Create free account
hub / github.com/TencentARC/BrushNet / load_checkpoint_to_model

Function load_checkpoint_to_model

scripts/convert_shap_e_to_diffusers.py:1004–1011  ·  view source on GitHub ↗
(checkpoint, model, strict=False)

Source from the content-addressed store, hash-verified

1002
1003
1004def load_checkpoint_to_model(checkpoint, model, strict=False):
1005 with tempfile.NamedTemporaryFile() as file:
1006 torch.save(checkpoint, file.name)
1007 del checkpoint
1008 if strict:
1009 model.load_state_dict(torch.load(file.name), strict=True)
1010 else:
1011 load_checkpoint_and_dispatch(model, file.name, device_map="auto")
1012
1013
1014if __name__ == "__main__":

Callers 1

rendererFunction · 0.70

Calls 2

load_state_dictMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected