From 211aaf02d53f9dee21e70ebf001525f002ebf517 Mon Sep 17 00:00:00 2001 From: Kaipeng Deng Date: Tue, 11 Feb 2020 17:07:00 +0800 Subject: [PATCH] fix prune resume (#223) --- slim/prune/prune.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/slim/prune/prune.py b/slim/prune/prune.py index d5fd5f8b3..606b29e7c 100644 --- a/slim/prune/prune.py +++ b/slim/prune/prune.py @@ -171,10 +171,7 @@ def main(): fuse_bn = getattr(model.backbone, 'norm_type', None) == 'affine_channel' start_iter = 0 - if FLAGS.resume_checkpoint: - checkpoint.load_checkpoint(exe, train_prog, FLAGS.resume_checkpoint) - start_iter = checkpoint.global_step() - elif cfg.pretrain_weights: + if cfg.pretrain_weights: checkpoint.load_params(exe, train_prog, cfg.pretrain_weights) pruned_params = FLAGS.pruned_params @@ -220,6 +217,10 @@ def main(): pruned_flops)) compiled_eval_prog = fluid.compiler.CompiledProgram(eval_prog) + if FLAGS.resume_checkpoint: + checkpoint.load_checkpoint(exe, train_prog, FLAGS.resume_checkpoint) + start_iter = checkpoint.global_step() + train_reader = create_reader(cfg.TrainReader, (cfg.max_iters - start_iter) * devices_num, cfg) train_loader.set_sample_list_generator(train_reader, place) -- GitLab