Downloads · 30 days
40
13% of all-time downloads
amornpan/openthaigpt1.5-14b-MedChatModelV1
openthaigpt1.5-14b-MedChatModelV1 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. The card lists the license as apache-2.0.
This model is fine-tuned from openthaigpt1.5-14b-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…
Downloads · 30 days
40
13% of all-time downloads
All-time downloads
313
Public
Parameters
15B
10.6 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors10.5 GB · 100%
How the weights are stored.
U813.2B · 88%
From the Hugging Face model README
This model is fine-tuned from openthaigpt1.5-14b-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-14b-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.
985/985 8:34:43, Epoch 134/141]
Step Training Loss Validation Loss
50 1.883700 1.708532
100 1.792500 1.528184
150 1.555000 1.296583
200 1.403900 1.251281
250 1.374300 1.225630
300 1.321000 1.195238
350 1.313900 1.187670
400 1.299000 1.181292
450 1.296400 1.177670
500 1.285000 1.173616
550 1.272800 1.170705
600 1.251200 1.169226
650 1.262600 1.166078
700 1.255300 1.165633
750 1.251600 1.165041
800 1.252300 1.162943
850 1.232700 1.164691
900 1.247300 1.163449
950 1.246300 1.163610

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 --upgrade torch transformers accelerate bitsandbytes --upgrade
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/openthaigpt1.5-14b-MedChatModelV1'
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]
สำหรับมะเร็งช่องปากในระยะแรกอาจรวมถึงอาการหรือลักษณะดังต่อไปนี้:
1. แผลบนช่องปากหรือกระพูดนิ่มที่อยู่กับที่และไม่หายไปแม้จะผ่านการรักษาด้วยตนเอง
2. บวมที่อยู่กับที่ที่ข้างใดข้างหนึ่งของริมฝีปาก
3. แผลเปื่อยหรือพังผืดที่เกิดขึ้นที่กระพูดหรือฟันที่ไม่หาย
4. ความเปลี่ยนแปลงของผิว pigment ในช่องปาก เช่น สีของกระพืดหรือริมฝีปากที่เปลี่ยนเป็นสีขาวหรือขาว
5. ปัญหาในการพูดหรือกินอาหาร
6. ขดลวดที่ด้านข้างหรือใต้คอที่เจริญเติบโต
7. อาการเจ็บจี๊ด