Skip to content
Snippets Groups Projects
Commit bd62e39c authored by Neta Zmora's avatar Neta Zmora
Browse files

apputils/checkpoint.py - relax requirements when loading thinned models

Allow loading a thinned model from a checkpoint file that doesn't
contain a CompressionSchedule.  After thinning, we usually don't have,
or care about, a pruning schedule - so we don't need to force the
user to create one, just for saving in the checkpoint.
parent 10078e38
No related branches found
No related tags found
No related merge requests found
...@@ -147,7 +147,8 @@ def load_checkpoint(model, chkpt_file, optimizer=None, model_device=None, *, ...@@ -147,7 +147,8 @@ def load_checkpoint(model, chkpt_file, optimizer=None, model_device=None, *,
if 'thinning_recipes' in checkpoint: if 'thinning_recipes' in checkpoint:
if 'compression_sched' not in checkpoint: if 'compression_sched' not in checkpoint:
raise KeyError("Found thinning_recipes key, but missing mandatory key compression_sched") msglogger.warning("Found thinning_recipes key, but missing mandatory key compression_sched")
compression_scheduler = distiller.CompressionScheduler(model)
msglogger.info("Loaded a thinning recipe from the checkpoint") msglogger.info("Loaded a thinning recipe from the checkpoint")
# Cache the recipes in case we need them later # Cache the recipes in case we need them later
model.thinning_recipes = checkpoint['thinning_recipes'] model.thinning_recipes = checkpoint['thinning_recipes']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment