Download load_model.py from tmutton/wcag-accessibility-issues: direct link, hf CLI and curl.
- Browser
- Download file 503 Bytes
-
https://huggingface.co/datasets/tmutton/wcag-accessibility-issues/resolve/main/load_model.py
- Command line
-
hf download hf://datasets/tmutton/wcag-accessibility-issues/load_model.py
-
curl -L -o load_model.py https://huggingface.co/datasets/tmutton/wcag-accessibility-issues/resolve/main/load_model.py
503 Bytes
| 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) |