mav23 commited on
Commit
912c28e
1 Parent(s): e119d70

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. README.md +143 -0
  3. medical-llama3-8b.Q4_0.gguf +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ medical-llama3-8b.Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: apache-2.0
4
+ tags:
5
+ - text-generation-inference
6
+ - transformers
7
+ - ruslanmv
8
+ - llama
9
+ - trl
10
+ - llama-3
11
+ - instruct
12
+ - finetune
13
+ - chatml
14
+ - DPO
15
+ - RLHF
16
+ - gpt4
17
+ - distillation
18
+ - heathcare
19
+ - medical
20
+ - clinical
21
+ - med
22
+ - lifescience
23
+ - Pharmaceutical
24
+ - Pharma
25
+ base_model: meta-llama/Meta-Llama-3-8B
26
+ datasets:
27
+ - ruslanmv/ai-medical-chatbot
28
+
29
+ model-index:
30
+ - name: Medical-Llama3-8B
31
+ results: []
32
+ widget:
33
+ - example_title: Medical-Llama3-8B
34
+ messages:
35
+ - role: system
36
+ content: >-
37
+ You are an expert and experienced from the healthcare and biomedical
38
+ domain with extensive medical knowledge and practical experience.
39
+ - role: user
40
+ content: How long does it take for newborn jaundice to go away?
41
+ output:
42
+ text: >-
43
+ Newborn jaundice, also known as neonatal jaundice, is a common condition
44
+ in newborns where the yellowing of the skin and eyes occurs due to an
45
+ elevated level of bilirubin in the blood. Bilirubin is a yellow pigment
46
+ that forms when red blood cells break down. In most cases, newborn
47
+ jaundice resolves on its own without any specific treatment.
48
+ The duration of newborn jaundice can vary depending on several factors
49
+ such as the underlying cause, gestational age at birth, and individual
50
+ variations in bilirubin metabolism. Here are some general guidelines
51
+ ---
52
+
53
+ # Medical-Llama3-8B-16bit: Fine-Tuned Llama3 for Medical Q&A
54
+ [![](future.jpg)](https://ruslanmv.com/)
55
+ This repository provides a fine-tuned version of the powerful Llama3 8B model, specifically designed to answer medical questions in an informative way. It leverages the rich knowledge contained in the AI Medical Chatbot dataset ([ruslanmv/ai-medical-chatbot](https://huggingface.co/datasets/ruslanmv/ai-medical-chatbot)).
56
+
57
+ **Model & Development**
58
+
59
+ - **Developed by:** ruslanmv
60
+ - **License:** Apache-2.0
61
+ - **Finetuned from model:** meta-llama/Meta-Llama-3-8B
62
+
63
+ **Key Features**
64
+
65
+ - **Medical Focus:** Optimized to address health-related inquiries.
66
+ - **Knowledge Base:** Trained on a comprehensive medical chatbot dataset.
67
+ - **Text Generation:** Generates informative and potentially helpful responses.
68
+
69
+ **Installation**
70
+
71
+ This model is accessible through the Hugging Face Transformers library. Install it using pip:
72
+
73
+ ```bash
74
+ pip install transformers bitsandbytes accelerate
75
+ ```
76
+
77
+ **Usage Example**
78
+
79
+ Here's a Python code snippet demonstrating how to interact with the `Medical-Llama3-8B-16bit` model and generate answers to your medical questions:
80
+
81
+ ```python
82
+ from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
83
+ import torch
84
+ model_name = "ruslanmv/Medical-Llama3-8B"
85
+ device_map = 'auto'
86
+ bnb_config = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4",bnb_4bit_compute_dtype=torch.float16,)
87
+ model = AutoModelForCausalLM.from_pretrained( model_name,quantization_config=bnb_config, trust_remote_code=True,use_cache=False,device_map=device_map)
88
+ tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
89
+ tokenizer.pad_token = tokenizer.eos_token
90
+
91
+ def askme(question):
92
+ sys_message = '''
93
+ You are an AI Medical Assistant trained on a vast dataset of health information. Please be thorough and
94
+ provide an informative answer. If you don't know the answer to a specific medical inquiry, advise seeking professional help.
95
+ '''
96
+ # Create messages structured for the chat template
97
+ messages = [{"role": "system", "content": sys_message}, {"role": "user", "content": question}]
98
+
99
+ # Applying chat template
100
+ prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
101
+ inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
102
+ outputs = model.generate(**inputs, max_new_tokens=100, use_cache=True)
103
+
104
+ # Extract and return the generated text, removing the prompt
105
+ response_text = tokenizer.batch_decode(outputs)[0].strip()
106
+ answer = response_text.split('<|im_start|>assistant')[-1].strip()
107
+ return answer
108
+ # Example usage
109
+ # - Context: First describe your problem.
110
+ # - Question: Then make the question.
111
+
112
+ question = '''I'm a 35-year-old male and for the past few months, I've been experiencing fatigue,
113
+ increased sensitivity to cold, and dry, itchy skin.
114
+ Could these symptoms be related to hypothyroidism?
115
+ If so, what steps should I take to get a proper diagnosis and discuss treatment options?'''
116
+
117
+ print(askme(question))
118
+
119
+ ```
120
+ the type of answer is :
121
+ ```
122
+ Based on your description, it sounds like you may be experiencing symptoms of hypothyroidism.
123
+ Hypothyroidism is a condition where the thyroid gland doesn't produce enough hormones, leading to a variety of symptoms.
124
+ Some common symptoms include fatigue, weight gain, constipation, and dry skin.
125
+ If you're experiencing any of these symptoms, it's important to see a doctor for a proper diagnosis and treatment plan.
126
+ Your doctor may order blood tests to check your thyroid hormone levels
127
+ ```
128
+ **Important Note**
129
+
130
+ This model is intended for informational purposes only and should not be used as a substitute for professional medical advice. Always consult with a qualified healthcare provider for any medical concerns.
131
+
132
+ **License**
133
+
134
+ This model is distributed under the Apache License 2.0 (see LICENSE file for details).
135
+
136
+ **Contributing**
137
+
138
+ We welcome contributions to this repository! If you have improvements or suggestions, feel free to create a pull request.
139
+
140
+ **Disclaimer**
141
+
142
+ While we strive to provide informative responses, the accuracy of the model's outputs cannot be guaranteed. It is crucial to consult a doctor or other healthcare professional for definitive medical advice.
143
+ ```
medical-llama3-8b.Q4_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2c3fc370078413b80d408f109d83ce29aa22deea5ab6e4d0b0984a82a5639aac
3
+ size 4661212000