INNER CODE UNIT · Python
per_stage_iters
pprp/SimpleCVReproduction · NAS/AngleNAS/FairNAS/shrinking/main.py:123
per_stage_iters = config.other_stage_epochs*per_epoch_iters if i > 0 else config.first_stage_epochs * per_epoch_iters
seed = train(train_dataprovider, optimizer, scheduler, model, criterion_smooth, \
operations, i, per_stage_iters, seed, args)
if args.local_rank == 0:
# Start shrinking the search space
load(base_model, config.initial_net_cache)
operations = ABS(base_model, model.module, operations, i)
now = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
print('{} |=> Iter = {}, operations={}, seed={}'.format(now, i+1, operations, seed))
# Modify the base weights for only one time
if not modify_initial_model and (i+1) * config.per_stage_drop_num > config.modify_initial_model_threshold:
torch.save(model.module.state_dict(), config.initial_net_cache)
modify_initial_model = True
print('Modify base weights ...')
save_checkpoint({ 'modify_initial_model': modify_initial_model,