Downloads · 30 days
67
1% of all-time downloads
protonx-models/nano-protonx-legal-tc
nano-protonx-legal-tc is a machine learning model from protonx-models. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for protonx-text-correction.
Downloads · 30 days
67
1% of all-time downloads
All-time downloads
5.8K
Public
Parameters
43.7M
175 MB on disk
Likes
5
Public
Click a slice to open those files.
.safetensors175 MB · 98%
From the Hugging Face model README
This model is a distilled version of the ProtonX Legal Text Correction
A specialized Vietnamese correction model engineered for high-accuracy OCR post-processing, especially to fix noisy PaddleOCR outputs in enterprise and legal workflows.
The model is optimized to clean up real-world OCR mistakes such as:
Built on a Seq2Seq Transformer architecture, the model is trained on 800,000 correction pairs, including 30,000 pairs manually annotated by expert Vietnamese annotators, covering:
Strict constraints ensure:
This model is released under the ProtonX Text Correction Model License (v1.3-NC).
See LICENSE.md for full terms, conditions, and usage restrictions.
import torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
model_path = "protonx-models/nano-protonx-legal-tc"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForSeq2SeqLM.from_pretrained(model_path)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
model.eval()
examples = [
"can cu bo luat lao dong 2019 va cac van ban huong dan thuc hien.",
]
for text in examples:
inputs = tokenizer(
text,
return_tensors="pt",
truncation=True,
max_length=160
).to(device)
with torch.no_grad():
outputs = model.generate(
**inputs,
num_beams=10,
max_new_tokens=160,
length_penalty=1.0,
early_stopping=True,
pad_token_id=tokenizer.pad_token_id,
eos_token_id=tokenizer.eos_token_id,
)
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(f"Input: {text}")
print(f"Output: {result}")
print("-" * 30)
| Metric | Score |
|---|---|
| ROUGE-L | 96.53 |
Input:
2.Trong Lut này các tù ng dui day dugc hiéu nhur sau
Output:
2. Trong Luật này các từ ngữ dưới đây được hiểu như sau
Thanks to: