asahi417 commited on
Commit
c496b1c
·
1 Parent(s): 64f11ac
Files changed (1) hide show
  1. training_scripts/finetune_t5.py +2 -2
training_scripts/finetune_t5.py CHANGED
@@ -161,12 +161,12 @@ def train(
161
  compute_metrics=compute_metric,
162
  )
163
  os.makedirs(f'{output_dir}/model_{n}', exist_ok=True)
164
- best_run = trainer.train()
165
  trainer.save_model(f'{output_dir}/model_{n}')
166
  tokenizer.save_pretrained(f'{output_dir}/model_{n}')
167
  # grid search
168
  with open(f'{output_dir}/model_{n}/hyperparameters.json', 'w') as f:
169
- json.dump(best_run.hyperparameters, f)
170
  del trainer
171
  gc.collect()
172
  torch.cuda.empty_cache()
 
161
  compute_metrics=compute_metric,
162
  )
163
  os.makedirs(f'{output_dir}/model_{n}', exist_ok=True)
164
+ trainer.train()
165
  trainer.save_model(f'{output_dir}/model_{n}')
166
  tokenizer.save_pretrained(f'{output_dir}/model_{n}')
167
  # grid search
168
  with open(f'{output_dir}/model_{n}/hyperparameters.json', 'w') as f:
169
+ json.dump({"learning_rate": lr_tmp, "batch_size": batch_tmp}, f)
170
  del trainer
171
  gc.collect()
172
  torch.cuda.empty_cache()