This model is fine-tuned on the
LexGLUE UNFAIR-ToS dataset to detect unfair clauses in Terms of Service documents.
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4model_name = "Agreemind/modernbert-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 = {modernbert-unfair-tos},
4 year = {2024},
5 publisher = {HuggingFace},
6 url = {https://huggingface.co/Agreemind/modernbert-unfair-tos}
7}