Downloads · 30 days
45
0% of all-time downloads
protonx-models/distilled-protonx-legal-tc
distilled-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
45
0% of all-time downloads
All-time downloads
10.4K
Public
Parameters
127M
2.1 GB on disk
Likes
4
Public
Click a slice to open those files.
.safetensors507 MB · 99%
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 70,000 correction pairs, including 20,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/distilled-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.30 |
Input:
2.Báo vé an ninh mang là phòng ngìaphát hiēn,ngǎn chǎn xù ly hành vi
Output:
2. Bảo vệ an ninh mạng là phòng ngừa phát hiện, ngăn chặn xử lý hành vi
Thanks to: