BamiBERT-ViLegalNLI

Mô hình phân loại NLI (Natural Language Inference) tiếng Việt, fine-tuned từ kiến trúc RoBERTa (BamiBERT) cho bài toán văn bản pháp luật (ViLegalNLI).

Nhãn phân loại (Labels)

  • 0: CONTRADICTION/LOSE (Mâu thuẫn / Thua kiện)
  • 1: ENTAILMENT/WIN (Kéo theo / Thắng kiện)

Cách sử dụng (Usage)

import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

model_name = "TQZinh/BamiBERT-ViLegalNLI"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)

premise = "Căn cứ theo luật đất đai 2024..."
hypothesis = "Người sử dụng đất có quyền chuyển đổi quyền sử dụng đất nông nghiệp."

inputs = tokenizer(premise, hypothesis, return_tensors="pt", truncation=True, max_length=512)

with torch.no_grad():
    outputs = model(**inputs)
    predicted_class = torch.argmax(outputs.logits, dim=1).item()

labels = {0: "CONTRADICTION/LOSE", 1: "ENTAILMENT/WIN"}
print("Prediction:", labels[predicted_class])
Downloads last month
10
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support