File size: 375 Bytes
5fa1a76
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
Note that Transformers models all have a default task-relevant loss function, so you don't need to specify one unless you want to:

from transformers import TFAutoModelForSemanticSegmentation
model = TFAutoModelForSemanticSegmentation.from_pretrained(
     checkpoint,
     id2label=id2label,
     label2id=label2id,
 )
model.compile(optimizer=optimizer)  # No loss argument!