File size: 880 Bytes
5fa1a76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
training_args = TrainingArguments(
     output_dir="segformer-b0-scene-parse-150",
     learning_rate=6e-5,
     num_train_epochs=50,
     per_device_train_batch_size=2,
     per_device_eval_batch_size=2,
     save_total_limit=3,
     evaluation_strategy="steps",
     save_strategy="steps",
     save_steps=20,
     eval_steps=20,
     logging_steps=1,
     eval_accumulation_steps=5,
     remove_unused_columns=False,
     push_to_hub=True,
 )
trainer = Trainer(
     model=model,
     args=training_args,
     train_dataset=train_ds,
     eval_dataset=test_ds,
     compute_metrics=compute_metrics,
 )
trainer.train()

Once training is completed, share your model to the Hub with the [~transformers.Trainer.push_to_hub] method so everyone can use your model:

trainer.push_to_hub()

If you are unfamiliar with fine-tuning a model with Keras, check out the basic tutorial first!