Hamses commited on
Commit
71a06c1
·
verified ·
1 Parent(s): b0946ec

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +18 -0
README.md CHANGED
@@ -43,3 +43,21 @@ training_args = TrainingArguments(
43
  logging_dir='./logs',
44
  )
45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  logging_dir='./logs',
44
  )
45
 
46
+ # Initialize the Trainer
47
+ trainer = Trainer(
48
+ model=model,
49
+ args=training_args,
50
+ train_dataset=encoded_dataset['train'],
51
+ eval_dataset=encoded_dataset['test']
52
+ )
53
+
54
+ # Train the model
55
+ trainer.train()
56
+
57
+ # Evaluate the model
58
+ results = trainer.evaluate()
59
+ print(results)
60
+
61
+ # Save the model
62
+ model.save_pretrained('./gpt2-finetuned')
63
+ tokenizer.save_pretrained('./gpt2-finetuned')