amornpan commited on
Commit
f1479f6
·
verified ·
1 Parent(s): 441e8d1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +16 -23
README.md CHANGED
@@ -90,33 +90,26 @@ This model can be used as a foundational model for medical assistance systems, c
90
 
91
  Here’s how to load and use the model for generating medical responses in Thai:
92
 
 
 
 
 
93
  ```python
94
- from transformers import AutoModelForCausalLM, AutoTokenizer
 
95
 
96
- # Load the fine-tuned model and tokenizer
97
- tokenizer = AutoTokenizer.from_pretrained("amornpan/openthaigpt-MedChatModelv11")
98
- model = AutoModelForCausalLM.from_pretrained("amornpan/openthaigpt-MedChatModelv11")
99
 
100
- # Input your medical question or prompt in Thai
101
- input_text = "ใส่คำถามทางการแพทย์ที่นี่"
102
- inputs = tokenizer(input_text, return_tensors="pt")
103
 
104
- # Generate the output with a higher max length or max new tokens
105
- output = model.generate(**inputs, max_new_tokens=100, do_sample=True, temperature=0.7)
 
106
 
107
- # Decode and print the generated response, skipping special tokens
108
- print(tokenizer.decode(output[0], skip_special_tokens=True))
109
 
 
 
 
110
  ```
111
- โปรดอธิบายลักษณะช่องปากที่เป็นมะเร็งในระยะเริ่มต้น
112
-
113
- ช่องปากมะเร็งในระยะเริ่มต้น อาจไม่มีอาการชัดเจน แต่ผู้คนบางกลุ่มอาจสังเกตเห็นอาการต่อไปนี้:
114
- - มีการกัดหรือกระแทกบริเวณช่องปากโดยไม่มีสาเหตุ
115
- - มีจุด ฝี เมล็ด หรือความไม่เท่าเทียมภายในช่องปากที่ไม่หายวื้อ
116
- - ปวดหรือเจ็บบริเวณช่องปาก
117
- - เปลี่ยนแปลงสีของเนื้อเยื่อในช่องปาก (อาจเป็นสีขาว หรือ黑马)
118
- - มีตุ่มที่ไม่หาย ภายในช่องปาก
119
- - มีความลำบากในการกิน มี
120
-
121
- ### More Information
122
- ```amornpan@gmail.com```
 
90
 
91
  Here’s how to load and use the model for generating medical responses in Thai:
92
 
93
+ ## 1. Install the Required Packages
94
+
95
+ First, ensure you have installed the required libraries by running:
96
+
97
  ```python
98
+ pip install torch transformers bitsandbytes
99
+ ```
100
 
101
+ ## 2. Load the Model and Tokenizer
 
 
102
 
103
+ You can load the model and tokenizer directly from Hugging Face using the following code:
 
 
104
 
105
+ ```python
106
+ import torch
107
+ from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
108
 
109
+ # Define the model path
110
+ model_path = 'amornpan/openthaigpt-MedChatModelv11'
111
 
112
+ # Load the tokenizer and model
113
+ tokenizer = AutoTokenizer.from_pretrained(model_path)
114
+ tokenizer.pad_token = tokenizer.eos_token
115
  ```