Create 4
Browse files
4
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import Trainer, TrainingArguments
|
2 |
+
|
3 |
+
training_args = TrainingArguments(
|
4 |
+
output_dir="./results", # Куда сохранять модель
|
5 |
+
evaluation_strategy="epoch", # Как часто проверять на валидации
|
6 |
+
learning_rate=5e-5,
|
7 |
+
per_device_train_batch_size=4,
|
8 |
+
num_train_epochs=3,
|
9 |
+
save_steps=10_000,
|
10 |
+
save_total_limit=2,
|
11 |
+
)
|
12 |
+
|
13 |
+
trainer = Trainer(
|
14 |
+
model=model,
|
15 |
+
args=training_args,
|
16 |
+
train_dataset=dataset['train'],
|
17 |
+
eval_dataset=dataset['validation'],
|
18 |
+
)
|
19 |
+
|
20 |
+
trainer.train()
|