File size: 503 Bytes
e0cfb62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from transformers import AutoModelForSequenceClassification

MODEL_NAME = "distilbert-base-uncased"

id2label = {
    0: "1.3.1 Info and Relationships",
    1: "2.1.1 Keyboard",
    2: "2.4.3 Focus Order",
    3: "2.4.7 Focus Visible",
    4: "4.1.2 Name, Role, Value",
}

label2id = {
    label: id
    for id, label in id2label.items()
}

model = AutoModelForSequenceClassification.from_pretrained(
    MODEL_NAME,
    num_labels=5,
    id2label=id2label,
    label2id=label2id,
)

print(model.config)