Downloads · 30 days
2
6% of all-time downloads
TQZinh/BamiBERT-ViLegalNLI
BamiBERT-ViLegalNLI is a text classification model from TQZinh. Use it when you need a label for a piece of text. The card lists the license as mit.
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).
Downloads · 30 days
2
6% of all-time downloads
All-time downloads
34
Public
Parameters
103M
824 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors412 MB · 100%
From the Hugging Face model README
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).
0: CONTRADICTION/LOSE (Mâu thuẫn / Thua kiện)1: ENTAILMENT/WIN (Kéo theo / Thắng kiện)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])