Update app.py
Browse files
app.py
CHANGED
|
@@ -141,17 +141,16 @@ def train_model(dataset):
|
|
| 141 |
|
| 142 |
training_args = TrainingArguments(
|
| 143 |
output_dir='./results',
|
| 144 |
-
|
| 145 |
learning_rate=2e-5,
|
| 146 |
-
per_device_train_batch_size=
|
| 147 |
-
per_device_eval_batch_size=
|
|
|
|
| 148 |
num_train_epochs=3,
|
| 149 |
weight_decay=0.01,
|
| 150 |
-
fp16=True,
|
| 151 |
-
dataloader_num_workers=4,
|
| 152 |
-
gradient_accumulation_steps=2,
|
| 153 |
)
|
| 154 |
|
|
|
|
| 155 |
class CustomTrainer(Trainer):
|
| 156 |
def compute_loss(self, model, inputs, return_outputs=False, **kwargs):
|
| 157 |
labels = inputs.pop("labels")
|
|
|
|
| 141 |
|
| 142 |
training_args = TrainingArguments(
|
| 143 |
output_dir='./results',
|
| 144 |
+
evaluation_strategy="epoch",
|
| 145 |
learning_rate=2e-5,
|
| 146 |
+
per_device_train_batch_size=2, # Try reducing the batch size
|
| 147 |
+
per_device_eval_batch_size=2,
|
| 148 |
+
gradient_accumulation_steps=2, # Accumulate gradients over 2 steps
|
| 149 |
num_train_epochs=3,
|
| 150 |
weight_decay=0.01,
|
|
|
|
|
|
|
|
|
|
| 151 |
)
|
| 152 |
|
| 153 |
+
|
| 154 |
class CustomTrainer(Trainer):
|
| 155 |
def compute_loss(self, model, inputs, return_outputs=False, **kwargs):
|
| 156 |
labels = inputs.pop("labels")
|