MCPcopy
hub / github.com/Vchitect/Latte / find_model

Function find_model

utils.py:274–287  ·  view source on GitHub ↗

Finds a pre-trained Latte model, downloading it if necessary. Alternatively, loads a model from a local path.

(model_name)

Source from the content-addressed store, hash-verified

272 return video_grid
273
274def find_model(model_name):
275 """
276 Finds a pre-trained Latte model, downloading it if necessary. Alternatively, loads a model from a local path.
277 """
278 assert os.path.isfile(model_name), f'Could not find Latte checkpoint at {model_name}'
279 checkpoint = torch.load(model_name, map_location=lambda storage, loc: storage)
280
281 if "ema" in checkpoint: # supports checkpoints from train.py
282 print('Using Ema!')
283 checkpoint = checkpoint["ema"]
284 else:
285 print('Using model!')
286 checkpoint = checkpoint['model']
287 return checkpoint
288
289#################################################################################
290# MMCV Utils #

Callers 2

mainFunction · 0.90
mainFunction · 0.90

Calls 1

loadMethod · 0.80

Tested by

no test coverage detected