Spaces:
Runtime error
Runtime error
Commit
·
cbc0ce4
1
Parent(s):
309bbd2
Create Y2
Browse files
Y2
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
training_args = TrainingArguments(
|
2 |
+
output_dir="my_awesome_food_model",
|
3 |
+
remove_unused_columns=False,
|
4 |
+
evaluation_strategy="epoch",
|
5 |
+
save_strategy="epoch",
|
6 |
+
learning_rate=5e-5,
|
7 |
+
per_device_train_batch_size=16,
|
8 |
+
gradient_accumulation_steps=4,
|
9 |
+
per_device_eval_batch_size=16,
|
10 |
+
num_train_epochs=3,
|
11 |
+
warmup_ratio=0.1,
|
12 |
+
logging_steps=10,
|
13 |
+
load_best_model_at_end=True,
|
14 |
+
metric_for_best_model="accuracy",
|
15 |
+
push_to_hub=True,
|
16 |
+
)
|
17 |
+
|
18 |
+
trainer = Trainer(
|
19 |
+
model=model,
|
20 |
+
args=training_args,
|
21 |
+
data_collator=data_collator,
|
22 |
+
train_dataset=food["train"],
|
23 |
+
eval_dataset=food["test"],
|
24 |
+
tokenizer=image_processor,
|
25 |
+
compute_metrics=compute_metrics,
|
26 |
+
)
|
27 |
+
|
28 |
+
trainer.train()
|