Downloads · 30 days
55
5% of all-time downloads
amornpan/openthaigpt-MedChatModelv11
openthaigpt-MedChatModelv11 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 openthaigpt1.5-7b-instruct using Supervised Fine-Tuning (SFT) on the Thaweewat/thai-med-pack dataset. The model is designed for medical question-answering tasks in Thai, specializing in p…
Downloads · 30 days
55
5% of all-time downloads
All-time downloads
1.1K
Public
Parameters
7.7B
30.8 GB on disk
Likes
2
Public
Click a slice to open those files.
.safetensors5.9 GB · 100%
How the weights are stored.
U86.5B · 85%
From the Hugging Face model README
This model is fine-tuned from openthaigpt1.5-7b-instruct using Supervised Fine-Tuning (SFT) on the Thaweewat/thai-med-pack dataset. The model is designed for medical question-answering tasks in Thai, specializing in providing accurate and contextual answers based on medical information.
This model was fine-tuned using Supervised Fine-Tuning (SFT) to optimize it for medical question answering in Thai. The base model is openthaigpt1.5-7b-instruct, and it has been enhanced with domain-specific knowledge using the Thaweewat/thai-med-pack dataset.
The model can be directly used for generating medical responses in Thai. It has been optimized for:
This model can be used as a foundational model for medical assistance systems, chatbots, and applications related to healthcare, specifically in the Thai language.

Here’s how to load and use the model for generating medical responses in Thai:

First, ensure you have installed the required libraries by running:
pip install torch transformers bitsandbytes
[!pip install bitsandbytes --upgrade]
[!pip install --upgrade transformers huggingface_hub]
You can load the model and tokenizer directly from Hugging Face using the following code:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
model_path = 'amornpan/openthaigpt-MedChatModelv11'
tokenizer = AutoTokenizer.from_pretrained(model_path) tokenizer.pad_token = tokenizer.eos_token
Create a custom medical prompt that you want the model to respond to:
custom_prompt = "โปรดอธิบายลักษณะช่องปากที่เป็นมะเร็งในระยะเริ่มต้น"
PROMPT = f'[INST] <You are a question answering assistant. Answer the question as truthfully and helpfully as possible. คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด<>{custom_prompt}[/INST]'
# Tokenize the input prompt
inputs = tokenizer(PROMPT, return_tensors="pt", padding=True, truncation=True)
The model uses 4-bit precision for efficient inference. Here’s how to set up the configuration:
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.float16
)
Now, load the model with the 4-bit quantization settings:
model = AutoModelForCausalLM.from_pretrained(
model_path,
quantization_config=bnb_config,
trust_remote_code=True
)
For faster inference, move the model and input tensors to a GPU, if available:
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model.to(device)
inputs = {k: v.to(device) for k, v in inputs.items()}
Now, generate the medical response by running the model:
outputs = model.generate(**inputs, max_new_tokens=256, do_sample=True)
Finally, decode and print the response from the model:
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)
[INST] <You are a question answering assistant. Answer the question as truthfully and helpfully as possible.
คุณคือผู้ช่วยตอบคำถาม จงตอบคำถามอย่างถูกต้องและมีประโยชน์ที่สุด<>โปรดอธิบายลักษณะช่องปากที่เป็นมะเร็งในระยะเริ่มต้น[/INST]
<ช่องปากที่เป็นมะเร็งในระยะเริ่มต้นอาจมีลักษณะต่อไปนี้:
- มีเนื้องอกสีขาวหรือสีเทามีขนาดเล็กอยู่บริเวณเยื่อบุช่องปาก
- มีแผลในช่องปากที่ไม่หายภายในสองสัปดาห์
- มีแผลบริเวณจมูกหรือคอที่มีมานานแต่ไม่หาย
- มีเนื้อ hardness หรือการเปลี่ยนแปลงทางโครงสร้างในบริเวณเยื่อบุของช่องปาก
- มีความผิดปกติในรูปร่าง ขนาด และสีของฟัน
- มีการเปลี่ยนแปลงในการบิดงอของลิ้นหรือมัดกล้ามเนื้อที่รับผิดชอบการบิดงอ
สิ่งจำเป็นคือให้พบแพทย์ผู้เชี่ยวชาญโดยเร็วที่สุดหากมีอาการที่