Views
No views yet
VietAI/vit5-base bằng phương pháp LoRA (Low-Rank Adaptation), chuyên biệt cho tác vụ tóm tắt văn bản tin tức tài chính-kinh tế bằng tiếng Việt.| Model | Kiến trúc | Phương pháp | ROUGE-L (F1) |
|---|---|---|---|
ViT5-base (Gốc) | Base (~250M) | Zero-shot | 14.39 |
ViT5-large-summarization (SOTA) | Large (~770M) | Full Fine-tune | 36.41 |
ViT5-base + LoRA (Optimized) | Base (~250M) | LoRA (r=32) | 40.70 |
large trên chính bộ dữ liệu chuyên ngành này, chứng tỏ tính hiệu quả của việc tinh chỉnh chuyên biệt.| Tiêu chí | ViT5-base + LoRA (Optimized) | ViT5-large (SOTA) |
|---|---|---|
| Số tham số được train | ~13 triệu | ~770 triệu |
| Kích thước Checkpoint | ~25 MB | ~3.17 GB (nặng hơn > 120 lần) |
| Yêu cầu VRAM (Training) | Chạy tốt trên GPU T4 (15GB) | Yêu cầu GPU A100 (40GB+) |
vietnamese-financial-news-data-for-summarization
max_src=1024 và max_tgt=256.Trueper_device_train_batch_size=1, gradient_accumulation_steps=16)r=32, lora_alpha=64, lora_dropout=0.05, target_modules=["q", "k", "v", "o", "wi", "wo"]1import torch
2from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
3from peft import PeftModel
4
5# Tên model nền và adapter LoRA trên Hugging Face Hub
6base_model_id = "VietAI/vit5-base"
7adapter_id = "mrstarkng/financial-summarization-vit5-sora"
8
9# Tải tokenizer và base model
10tokenizer = AutoTokenizer.from_pretrained(base_model_id)
11base_model = AutoModelForSeq2SeqLM.from_pretrained(
12 base_model_id,
13 torch_dtype=torch.bfloat16,
14 device_map="auto"
15)
16
17# Tải và áp dụng LoRA adapter
18model = PeftModel.from_pretrained(base_model, adapter_id)
19model.eval()
20
21# Thực hiện tóm tắt
22article = "Dữ liệu từ Hội môi giới Bất động sản (VARS) cho thấy, giá căn hộ chung cư thứ cấp tại Hà Nội và TP.HCM trung bình đã đạt 70 - 80 triệu đồng/m²..."
23input_text = "summarize: " + article
24
25inputs = tokenizer(input_text, return_tensors="pt", max_length=1024, truncation=True).to(model.device)
26outputs = model.generate(**inputs, max_length=256, num_beams=5)
27summary = tokenizer.decode(outputs[0], skip_special_tokens=True)
28
29print(summary)