asahi417 commited on
Commit
9ec398b
·
1 Parent(s): d9bd9cf
Files changed (1) hide show
  1. training_scripts/finetune_t5.py +8 -0
training_scripts/finetune_t5.py CHANGED
@@ -161,12 +161,20 @@ def train(
161
  eval_dataset=tokenized_dataset['validation_ds'],
162
  compute_metrics=compute_metric,
163
  )
 
 
164
  result = trainer.train()
165
  trainer.save_model() # Saves the tokenizer too for easy upload
166
  metrics = result.metrics
167
  trainer.log_metrics("train", metrics)
168
  trainer.save_metrics("train", metrics)
169
  trainer.save_state()
 
 
 
 
 
 
170
  del trainer
171
  gc.collect()
172
  torch.cuda.empty_cache()
 
161
  eval_dataset=tokenized_dataset['validation_ds'],
162
  compute_metrics=compute_metric,
163
  )
164
+
165
+ # train
166
  result = trainer.train()
167
  trainer.save_model() # Saves the tokenizer too for easy upload
168
  metrics = result.metrics
169
  trainer.log_metrics("train", metrics)
170
  trainer.save_metrics("train", metrics)
171
  trainer.save_state()
172
+
173
+ # evaluate
174
+ metrics = trainer.evaluate()
175
+ trainer.log_metrics("eval", metrics)
176
+ trainer.save_metrics("eval", metrics)
177
+
178
  del trainer
179
  gc.collect()
180
  torch.cuda.empty_cache()