Vietnamese AMR Baseline 7B
LoRA adapter for Vietnamese Abstract Meaning Representation (AMR) parsing, trained on VLSP 2024 dataset.
Model Details
- Base Model: Qwen/Qwen2.5-7B-Instruct
- Training Approach: Single-task baseline with LoRA
- Language: Vietnamese
- Task: AMR Semantic Parsing
- Dataset: VLSP 2024 Vietnamese AMR
Training Configuration
Model: Qwen 2.5 7B Instruct
LoRA Rank: 64
LoRA Alpha: 128
Max Sequence Length: 256
Batch Size: 1 (effective: 16 with gradient accumulation)
Epochs: 15
Learning Rate: 2e-4
Optimizer: AdamW
Precision: BF16
Gradient Checkpointing: Enabled
Usage
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-7B-Instruct",
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Load LoRA adapter
model = PeftModel.from_pretrained(
base_model,
"YOUR_USERNAME/vietnamese-amr-baseline-7b"
)
model.eval()
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-7B-Instruct")
# Prepare prompt
sentence = "Chủ tịch nước đã phát biểu tại hội nghị."
prompt = f"""Bạn là chuyên gia phân tích ngữ nghĩa tiếng Việt. Hãy chuyển đổi câu sau sang định dạng AMR (Abstract Meaning Representation).
Quy tắc quan trọng:
- Sử dụng khái niệm tiếng Việt có dấu gạch dưới (ví dụ: chủ_tịch, môi_trường)
- Gán biến cho mỗi khái niệm (ví dụ: c / chủ_tịch)
- Sử dụng quan hệ chuẩn AMR (:ARG0, :ARG1, :time, :location, etc.)
- Giữ nguyên cấu trúc cây với dấu ngoặc đơn cân bằng
- Đảm bảo tất cả biến được định nghĩa trước khi sử dụng
Câu tiếng Việt: {sentence}
AMR:
"""
# Generate
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.1,
top_p=0.9,
do_sample=True
)
# Decode
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
amr = result.split("AMR:")[-1].strip()
print(amr)
Training Details
- Training Time: ~1.5 hours on NVIDIA RTX A6000 (48GB)
- Final Training Loss: ~0.037
- Validation Loss: 0.419
Files
adapter_config.json: LoRA configurationadapter_model.safetensors: LoRA weights (~200MB)README.md: This file
Citation
@misc{vietnamese-amr-baseline-7b,
title={Vietnamese AMR Baseline 7B},
author={VLSP 2024 Participant},
year={2025},
publisher={HuggingFace},
url={https://huggingface.co/YOUR_USERNAME/vietnamese-amr-baseline-7b}
}
License
Apache 2.0
🤖 Generated with Claude Code
- Downloads last month
- 2
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support