Views
No views yet
ContextEnforcementProcessRulesStructural| Base model | answerdotai/ModernBERT-base |
| Max length | 1024 |
| Classifier pooling | mean |
| Train / val / test | 79106 / 10447 / 10447 |
| Metric | macro-F1 |
| Validation macro-F1 | 0.8443 |
| Test macro-F1 | 0.8428 |
| Test accuracy | 0.8849 |
precision recall f1-score support
Context 0.8399 0.9138 0.8753 1033
Enforcement 0.7561 0.8682 0.8083 1032
Process 0.6038 0.7691 0.6765 654
Rules 0.9308 0.8570 0.8924 4896
Structural 0.9675 0.9555 0.9614 2832
accuracy 0.8849 10447
macro avg 0.8196 0.8727 0.8428 10447
weighted avg 0.8940 0.8849 0.8876 10447
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4tok = AutoTokenizer.from_pretrained("LocalLaws/LOCUS-Function")
5model = AutoModelForSequenceClassification.from_pretrained("LocalLaws/LOCUS-Function")
6model.eval()
7
8text = "No person shall keep any swine within the city limits."
9enc = tok(text, return_tensors="pt", truncation=True, max_length=1024)
10with torch.no_grad():
11 logits = model(**enc).logits
12pred = logits.argmax(-1).item()
13print(model.config.id2label[pred])