| 2 | |
| 3 | # These parameters should be changed for this specific run, before objects are loaded |
| 4 | def update_parameters_before_loading(p, args): |
| 5 | |
| 6 | if args.method is not None: |
| 7 | p['method'] = args.method |
| 8 | |
| 9 | method = p['method'] |
| 10 | # if alpha is specified, change the parameter, etc. |
| 11 | if args.alpha is not None: |
| 12 | p[method]['alpha'] = args.alpha |
| 13 | |
| 14 | if args.epochs is not None: |
| 15 | p['run']['epochs'] = args.epochs |
| 16 | |
| 17 | if args.eval is not None: |
| 18 | p['run']['eval_freq'] = args.eval |
| 19 | |
| 20 | if args.check is not None: |
| 21 | p['run']['checkpoint_freq'] = args.check |
| 22 | |
| 23 | if args.train_reverse_steps is not None: |
| 24 | p[method]['reverse_steps'] = args.train_reverse_steps |
| 25 | |
| 26 | if args.non_iso: |
| 27 | p[method]['isotropic'] = False |
| 28 | |
| 29 | if args.non_iso_data: |
| 30 | p['data']['isotropic'] = False |
| 31 | |
| 32 | if args.data_std is not None: |
| 33 | p['data']['std'] = args.data_std |
| 34 | |
| 35 | if args.set_seed is not None: |
| 36 | p['seed'] = args.set_seed |
| 37 | |
| 38 | if args.random_seed is not None: |
| 39 | p['seed'] = None |
| 40 | |
| 41 | if args.lploss is not None: |
| 42 | assert method == 'dlpm', 'lploss is only for dlpm' |
| 43 | p['training'][method]['lploss'] = args.lploss |
| 44 | |
| 45 | if args.variance: |
| 46 | p[method]['var_predict'] = 'GAMMA' |
| 47 | p['training'][method]['loss_type'] = 'VAR_KL' |
| 48 | p['model']['learn_variance'] = True |
| 49 | |
| 50 | if args.median is not None: |
| 51 | assert len(args.median) == 2 |
| 52 | p['training'][method]['loss_monte_carlo'] = 'median' |
| 53 | p['training'][method]['monte_carlo_outer'] = int(args.median[0]) |
| 54 | p['training'][method]['monte_carlo_inner'] = int(args.median[1]) |
| 55 | |
| 56 | if args.deterministic: |
| 57 | p['eval'][method]['deterministic'] = True |
| 58 | if method == 'dlpm': |
| 59 | p['eval'][method]['dlim_eta'] = 0.0 |
| 60 | |
| 61 | if args.clip: |