braintools.trainer.load_checkpoint#
- braintools.trainer.load_checkpoint(filepath, map_location=None)[source]#
Load a checkpoint from disk.
- Parameters:
- Returns:
Loaded state dictionary.
- Return type:
Examples
>>> import os, shutil, tempfile >>> import jax.numpy as jnp >>> import braintools >>> tmp = tempfile.mkdtemp() >>> path = os.path.join(tmp, 'checkpoint.ckpt') >>> _ = braintools.trainer.save_checkpoint( ... {'weights': jnp.arange(3.0), 'epoch': 10}, path) >>> state = braintools.trainer.load_checkpoint(path) >>> state['epoch'] 10 >>> state['weights'] Array([0., 1., 2.], dtype=float32) >>> shutil.rmtree(tmp)