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

compress_classifier.py: added handling of --save-untrained-model

This command command-line argument allows us to save the
randomly-initialized model before training (useful for lottery-ticket
method).
This commit was accidentally left out of the Lottery-Ticket Hypothesis
commit from Aug 26.
parent cbf1a739
No related branches found
No related tags found
No related merge requests found
...@@ -161,6 +161,12 @@ class ClassifierCompressorSampleApp(classifier.ClassifierCompressor): ...@@ -161,6 +161,12 @@ class ClassifierCompressorSampleApp(classifier.ClassifierCompressor):
def __init__(self, args, script_dir): def __init__(self, args, script_dir):
super().__init__(args, script_dir) super().__init__(args, script_dir)
early_exit_init(args) early_exit_init(args)
# Save the randomly-initialized model before training (useful for lottery-ticket method)
if args.save_untrained_model:
ckpt_name = '_'.join((self.args.name or "", "untrained"))
apputils.save_checkpoint(0, self.args.arch, self.model,
name=ckpt_name, dir=msglogger.logdir)
def handle_subapps(self): def handle_subapps(self):
return handle_subapps(self.model, self.criterion, self.optimizer, return handle_subapps(self.model, self.criterion, self.optimizer,
......
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