init
Browse files
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 |
-
|
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(
|
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()
|