🚀 Verified working với Hugging Face Inference Endpoints!
Đây là copy của unsloth/Qwen2.5-3B-Instruct được optimize cho production deployment. Model này đã được test và verified hoạt động hoàn hảo với HF Inference Endpoints.
✨ Đặc điểm
✅ Inference Endpoints Ready: Verified hoạt động 100% với HF Inference Endpoints
✅ No Quantization Issues: Không có vấn đề quantization với TGI
✅ Production Optimized: Sẵn sàng cho production environment
✅ Vietnamese Excellence: Hỗ trợ tiếng Việt xuất sắc
✅ Multi-language: Hỗ trợ 29+ ngôn ngữ
✅ High Performance: 3B parameters với hiệu suất cao
1import requests
2import json
34# Cấu hình API5API_URL ="YOUR_ENDPOINT_URL"# Lấy từ Inference Endpoints6headers ={7"Authorization":"Bearer YOUR_HF_TOKEN",8"Content-Type":"application/json"9}1011defchat_with_model(message, max_tokens=200):12 payload ={13"inputs":f"<|im_start|>user\n{message}<|im_end|>\n<|im_start|>assistant\n",14"parameters":{15"max_new_tokens": max_tokens,16"temperature":0.7,17"do_sample":True,18"stop":["<|im_end|>"],19"return_full_text":False20}21}2223 response = requests.post(API_URL, headers=headers, json=payload)2425if response.status_code ==200:26 result = response.json()27return result[0]["generated_text"].strip()28else:29returnf"Error: {response.status_code} - {response.text}"3031# Sử dụng32response = chat_with_model("Việt Nam có những món ăn truyền thống nào?")33print(response)
Batch Processing
python
1defbatch_chat(messages_list):2 results =[]3for msg in messages_list:4 response = chat_with_model(msg)5 results.append({"question": msg,"answer": response})6return results
78# Example9questions =[10"Hà Nội có gì đặc biệt?",11"Cách nấu phở bò?",12"Lịch sử Việt Nam có gì thú vị?"13]1415results = batch_chat(questions)16for item in results:17print(f"Q: {item['question']}")18print(f"A: {item['answer']}\n")
📊 Specifications
Spec
Value
Model Size
~3B parameters
Architecture
Qwen2.5
Context Length
32,768 tokens
Languages
29+ languages
Deployment
✅ HF Inference Endpoints
Format
Safetensors
License
Apache 2.0
🎯 Use Cases
💬 Chatbots: Customer service, virtual assistants
📝 Content Generation: Blog posts, articles, creative writing
🔍 Q&A Systems: Knowledge bases, FAQ automation
🌐 Multi-language: Translation và cross-language tasks
💼 Business: Report generation, email drafting
🎓 Education: Tutoring, explanation generation
🔧 Chat Format
Model sử dụng Qwen chat template:
<|im_start|>user
Your question here
<|im_end|>
<|im_start|>assistant
AI response here
<|im_end|>
⚠️ Important Notes
Model hoạt động tốt nhất với temperature 0.7-0.8
Sử dụng stop tokens["<|im_end|>"] để tránh over-generation
Với câu hỏi tiếng Việt, model cho kết quả rất tự nhiên
Verified compatibility với TGI container
🏆 Performance
✅ Inference Endpoints: Tested and verified working