πŸ›‘οΈ ClauseGuard CUAD Classifier β€” ONNX INT8 Quantized

ONNX Runtime + dynamic INT8 quantized version of the ClauseGuard legal clause classifier for 2-4x faster CPU inference.

Model Details

Property Value
Base model nlpaueb/legal-bert-base-uncased (110M params)
LoRA adapter Mokshith31/legalbert-contract-clause-classification
Export method merge_and_unload() β†’ ONNX β†’ dynamic INT8 quantization
Labels 41 CUAD clause categories
ONNX FP32 size 438.3 MB
INT8 size 110.3 MB (75% reduction)
Runtime ONNX Runtime (CPU)
Expected speedup 2-4x over PyTorch on CPU

Usage

from optimum.onnxruntime import ORTModelForSequenceClassification
from transformers import AutoTokenizer
import torch

model = ORTModelForSequenceClassification.from_pretrained(
    "gaurv007/clauseguard-onnx-int8",
    file_name="model_quantized.onnx"
)
tokenizer = AutoTokenizer.from_pretrained("gaurv007/clauseguard-onnx-int8")

texts = ["The company may terminate your account at any time without notice."]
inputs = tokenizer(texts, return_tensors="pt", padding=True, truncation=True, max_length=512)

with torch.no_grad():
    outputs = model(**inputs)
    probs = torch.softmax(outputs.logits, dim=-1)
    predicted = probs.argmax(dim=-1)
    print(f"Label: {model.config.id2label[str(predicted.item())]}")
    print(f"Confidence: {probs.max().item():.3f}")

41 CUAD Labels

Document Name, Parties, Agreement Date, Effective Date, Expiration Date, Renewal Term, Notice Period to Terminate Renewal, Governing Law, Most Favored Nation, Non-Compete, Exclusivity, No-Solicit of Customers, No-Solicit of Employees, Non-Disparagement, Termination for Convenience, ROFR/ROFO/ROFN, Change of Control, Anti-Assignment, Revenue/Profit Sharing, Price Restriction, Minimum Commitment, Volume Restriction, IP Ownership Assignment, Joint IP Ownership, License Grant, Non-Transferable License, Affiliate License-Licensor, Affiliate License-Licensee, Unlimited/All-You-Can-Eat License, Irrevocable or Perpetual License, Source Code Escrow, Post-Termination Services, Audit Rights, Uncapped Liability, Cap on Liability, Liquidated Damages, Warranty Duration, Insurance, Covenant Not to Sue, Third Party Beneficiary, Other

Part of ClauseGuard

This model powers ClauseGuard, the open-source legal contract analysis tool.

License

Apache 2.0

Downloads last month
76
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for gaurv007/clauseguard-onnx-int8

Quantized
(2)
this model

Dataset used to train gaurv007/clauseguard-onnx-int8

Space using gaurv007/clauseguard-onnx-int8 1