| 120 | return file_name |
| 121 | |
| 122 | def save_options(self, opt): |
| 123 | file_name = self.option_file_path(opt, makedir=True) |
| 124 | with open(file_name + '.txt', 'wt') as opt_file: |
| 125 | for k, v in sorted(vars(opt).items()): |
| 126 | comment = '' |
| 127 | default = self.parser.get_default(k) |
| 128 | if v != default: |
| 129 | comment = '\t[default: %s]' % str(default) |
| 130 | opt_file.write('{:>25}: {:<30}{}\n'.format(str(k), str(v), comment)) |
| 131 | |
| 132 | with open(file_name + '.pkl', 'wb') as opt_file: |
| 133 | pickle.dump(opt, opt_file) |
| 134 | |
| 135 | def update_options_from_file(self, parser, opt): |
| 136 | new_opt = self.load_options(opt) |