precision recall f1-score support
Buildings 0.7438 0.8506 0.7936 877
Business 0.8273 0.8381 0.8326 846
Nuisance 0.7617 0.8419 0.7998 930
Other 0.8916 0.7657 0.8239 2083
Zoning 0.8169 0.8574 0.8367 1192
accuracy 0.8190 5928
macro avg 0.8083 0.8307 0.8173 5928
weighted avg 0.8251 0.8190 0.8194 5928
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4tok = AutoTokenizer.from_pretrained("LocalLaws/LOCUS-Topic")
5model = AutoModelForSequenceClassification.from_pretrained("LocalLaws/LOCUS-Topic")
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])