Downloads · 30 days
0
amornpan/V3_qwen2.5-32b-med-thai-optimized
V3_qwen2.5-32b-med-thai-optimized is a text generation model from amornpan. Use it when you need the model to write or continue text. It is set up for transformers.
This model is fine-tuned from Qwen2.5-32B-Instruct using Supervised Fine-Tuning (SFT) on the Thaweewat/thai-med-pack dataset. It is designed for medical question-answering tasks in Thai, providing accurate and context…
Downloads · 30 days
0
Access
Public
Updated Mar 14, 2025
Repo size
2.2 GB
Likes
1
Public
Click a slice to open those files.
.safetensors2.1 GB · 99%
From the Hugging Face model README
This model is fine-tuned from Qwen2.5-32B-Instruct using Supervised Fine-Tuning (SFT) on the Thaweewat/thai-med-pack dataset. It is designed for medical question-answering tasks in Thai, providing accurate and contextual answers based on medical information.
This model was fine-tuned using Supervised Fine-Tuning (SFT) to enhance its capabilities for medical question answering in Thai. The base model is Qwen2.5-32B-Instruct, which has been optimized with domain-specific knowledge using the Thaweewat/thai-med-pack dataset.
The model can be used directly for generating medical responses in Thai. It has been optimized for:
This model serves as a foundational model for medical assistance systems, chatbots, and applications related to healthcare in the Thai language.
| Metric | Initial | Final | Minimum |
|---|---|---|---|
| Training Loss | 1.8398 | 1.0060 | 1.0060 |
| Validation Loss | 1.7782 | 1.1386 | 1.1385 |

This section provides a step-by-step guide to loading and using the model for generating medical responses in Thai.
# Install required libraries if not already installed
pip install transformers torch peft
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
In this cell, we import the necessary libraries from the Hugging Face Transformers package.
# Configure quantization settings
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype="float16",
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4"
)
This cell configures 4-bit quantization to reduce the memory footprint of the model.
# Load the model directly
model_name = "amornpan/V3_qwen2.5-32b-med-thai-optimized"
model = AutoModelForCausalLM.from_pretrained(
model_name,
quantization_config=bnb_config,
device_map="auto",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
In this cell, we load the pre-trained Qwen 2.5 32B Thai medical model.
# Function to test the model
def test_model(prompt, max_new_tokens=256):
system_prompt = "You are a question answering assistant. Answer the question as truthful and helpful as possible. คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด"
full_prompt = f"system\n{system_prompt}\nuser\n{prompt}\nassistant\n"
inputs = tokenizer(full_prompt, return_tensors="pt").to(model.device)
# Generate
generated_ids = model.generate(
**inputs,
max_new_tokens=max_new_tokens,
do_sample=True,
temperature=0.7,
top_p=0.9,
)
response = tokenizer.decode(generated_ids[0], skip_special_tokens=False)
# Extract only the assistant's response
assistant_response = response.split("assistant\n")[-1].split("")[0]
return assistant_response
This function handles the generation of responses.
# Test with a single example
example_question = "อาการของโรคเบาหวานมีอะไรบ้าง"
print(f"\nคำถาม: {example_question}")
response = test_model(example_question)
print(f"คำตอบ: {response}")
คำถาม: อาการของโรคเบาหวานมีอะไรบ้าง
คำตอบ: สวัสดี โรคเบาหวานเป็นโรคทางระบบเมตาบอลิซึม โดยเกิดจากภาวะการผลิตฮอร์โมนอินซูลินไม่เพียงพอ
หรือร่างกายไม่สามารถใช้อินซูลินได้อย่างมีประสิทธิภาพ ทำให้ระดับน้ำตาลในเลือดสูงขึ้น ซึ่งอาจนำไปสู่ความเสียหายของอวัยวะต่างๆ
ในร่างกายได้ โดยเฉพาะหัวใจ เลือด เยื่อบุตา และไต เมื่อระดับน้ำตาลในเลือดสูงขึ้นมากขึ้นเรื่อยๆ จะมีอาการทางคลินิก เช่น
1. มีปัสสาวะบ่อย ปัสสาวะมาก เนื่องจากต้องขับน้ำตาลออกทางปัสสาวะ
2. กระหายน้ำมาก เนื่องจากมีปัสสาวะมาก
3. อ่อนแรง หมดแรง
คำถาม: การรักษาโรคความดันโลหิตสูงทำอย่างไร
คำตอบ: สวัสดี ความดันโลหิตสูงสามารถรักษาได้โดยการใช้ยาหลายชนิด เช่น เบนโซเพอรีซิน, อะโมโลนิด, ลิโซโปรตาซอล, อีลาฟอร์เท็ต,
อัลฟูราลิท, อะเซติซิลดิโพราเมต, อาราคานา, อาเนอโรนิก, อาเซติซิลสัมพันธ์, อาเนอโรนิก, อะเซติซิลสัมพันธ์ เป็นต้น
คุณสามารถปรึกษาแพทย์ผู้เชี่ยวชาญในเรื่องนี้เพื่อทราบข้อมูลเพิ่มเติมเกี่ยวกับยาดังกล่าว หวังว่าคำตอบของฉันจะเป็นประโยชน์สำหรับคุณ
ขอให้คุณมีสุขภาพที่ดี ขอบคุณที่เลือกใช้บริการของเรา หากคุณมีคำถามใด ๆ
คำถาม: ยา Paracetamol มีผลข้างเคียงอะไรบ้าง
คำตอบ: Paracetamol เป็นยาแก้ปวดและลดไข้ที่ใช้กันอย่างแพร่หลาย ซึ่งมีผลข้างเคียงน้อยกว่ายาแก้ปวดชนิดอื่นๆ โดยทั่วไปจะไม่มีผลข้างเคียงใดๆ
หากใช้ในขนาดที่แนะนำ แต่อาจพบได้ เช่น ปวดท้อง อาเจียน และรู้สึกคลื่นไส้ นอกจากนี้ หากใช้ในปริมาณที่มากเกินไป อาจทำให้มีอาการปัสสาวะขุ่น
มีสีเหลืองเข้ม เบื่ออาหาร คลื่นไส้ อาเจียน ปวดท้อง ปวดหัว ตาเหลือง หรือปัสสาวะสีเข้มเป็นสีชาโคล่า
หากมีอาการดังกล่าวควรหยุดการใช้ยาและรีบไปพบแพทย์เพื่อตรวจหาความเสียหายของตับจากยา
โดยการตรวจการทำงานของตับ ซึ่งหากพบว่ามีอาการของโรคตับวายเฉียบพลัน