📌 1. TỔNG QUAN VỀ LORA ADAPTER
Đây là bộ trọng số LoRA Adapter (v1.0) siêu nhẹ (~100MB) được huấn luyện bằng Unsloth (QLoRA 4-bit) trên nền tảng unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit.
- 📦 Nếu bạn muốn chạy Offline bằng Ollama / LM Studio: Vui lòng tải bản đã đóng gói sẵn GGUF tại: 👉 khoin68/Qwen2.5-Coder-7B-Vietnamese-GGUF.
- 🐍 Nếu bạn là Nhà phát triển (Developer): Sử dụng repo LoRA này để nạp vào Python, tích hợp vào Backend FastAPI hoặc làm Base Model nền tảng để huấn luyện tiếp nối (Continued Fine-Tuning).
🚀 2. ĐẶC ĐIỂM NỔI BẬT ĐÃ ĐƯỢC HUẤN LUYỆN
- 100% Tiếng Việt Tự Nhiên: Khử hoàn toàn lỗi nhảy sang tiếng Trung/Anh và giọng văn dịch máy thô cứng.
- Thấu hiểu Dev Slang: Nhận diện mượt mà các từ viết tắt và tiếng lóng của lập trình viên Việt Nam:
k, ko, dc, ae, mn, bh, z b, fix bug, sập sv, dính cors, nuốt lỗi....
- Cấu trúc kỹ thuật chuẩn: Tự động phản hồi theo định dạng chuyên nghiệp (
# VAI TRÒ & MỤC TIÊU, code sạch có comment tiếng Việt, xử lý ngoại lệ an toàn).
💻 3. HƯỚNG DẪN SỬ DỤNG TRONG PYTHON
Cách 1: Chạy suy luận siêu tốc bằng Unsloth (Khuyên dùng)
import torch
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "khoin68/Qwen2.5-Coder-7B-Vietnamese-LoRA",
max_seq_length = 2048,
dtype = None,
load_in_4bit = True,
)
FastLanguageModel.for_inference(model)
messages = [
{"role": "system", "content": "Bạn là chuyên gia lập trình. TUYỆT ĐỐI chỉ trả lời bằng Tiếng Việt và Code chuẩn mực."},
{"role": "user", "content": "ae cho hỏi code nodejs call api bên thứ 3 hay bị timeout thì xử lý sao z b?"}
]
inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to("cuda")
outputs = model.generate(input_ids=inputs, max_new_tokens=512, temperature=0.6, top_p=0.9)
print(tokenizer.batch_decode(outputs)[0])
Cách 2: Sử dụng LoRA này để Huấn luyện tiếp nối (Continued Fine-Tuning)
Bạn có thể dùng bản LoRA này làm "điểm xuất phát" để nạp thêm dữ liệu riêng của bạn mà không cần train lại từ đầu:
code
from unsloth import FastLanguageModel
# Nạp bản LoRA đã học tiếng Việt
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = "khoin68/Qwen2.5-Coder-7B-Vietnamese-LoRA",
max_seq_length = 2048,
load_in_4bit = True,
)
# Gắn LoRA mới và nạp thêm dataset của bạn vào train tiếp!
model = FastLanguageModel.get_peft_model(
model,
r = 32,
target_modules = ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"],
lora_alpha = 32,
lora_dropout = 0,
bias = "none",
use_gradient_checkpointing = "unsloth",
random_state = 3407,
)
⚙️ 4. THÔNG SỐ HUẤN LUYỆN (HYPERPARAMETERS)
Base Architecture: Qwen2.5-Coder-7B
LoRA Rank (
r
r
): 32 | LoRA Alpha (
α
α
): 32 | Dropout: 0.0
Trainable Parameters: 80,740,352 (1.05% tổng tham số)
Optimizer: AdamW 8-bit
Hardware: Tesla T4 GPU (Google Cloud / Colab)
📜 5. BẢN QUYỀN & TÁC GIẢ
Phát triển và huấn luyện bởi: @khoin68.
Tối ưu hóa mã nguồn mở: Unsloth AI Team & Alibaba Cloud Qwen Team.