File size: 420 Bytes
5fa1a76
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
Load SegFormer with [AutoModelForSemanticSegmentation], and pass the model the mapping between label ids and label classes:

from transformers import AutoModelForSemanticSegmentation, TrainingArguments, Trainer
model = AutoModelForSemanticSegmentation.from_pretrained(checkpoint, id2label=id2label, label2id=label2id)

At this point, only three steps remain:

Define your training hyperparameters in [TrainingArguments].