Views
No views yet
| Metric | Score |
|---|---|
| Exact Match Accuracy | 66.3% |
| Micro-F1 | 0.79 |
| Precision | 0.98 |
| ID | Category |
|---|---|
| 0 | Limitation of liability |
| 1 | Unilateral termination |
| 2 | Unilateral change |
| 3 | Content removal |
| 4 | Contract by using |
| 5 | Choice of law |
| 6 | Jurisdiction |
| 7 | Arbitration |
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4model_name = "Agreemind/legalbert-large-unfair-tos"
5tokenizer = AutoTokenizer.from_pretrained(model_name)
6model = AutoModelForSequenceClassification.from_pretrained(model_name)
7
8text = "We reserve the right to terminate your account at any time."
9inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
10
11with torch.no_grad():
12 outputs = model(**inputs)
13 probs = torch.sigmoid(outputs.logits)
14
15# Get predictions
16labels = ["Limitation of liability", "Unilateral termination", "Unilateral change",
17 "Content removal", "Contract by using", "Choice of law", "Jurisdiction", "Arbitration"]
18
19for label, prob in zip(labels, probs[0]):
20 if prob > 0.5:
21 print(f"{label}: {prob:.2%}")1@misc{agreemind-unfair-tos,
2 author = {Agreemind},
3 title = {legalbert-large-unfair-tos},
4 year = {2024},
5 publisher = {HuggingFace},
6 url = {https://huggingface.co/Agreemind/legalbert-large-unfair-tos}
7}