Karthik2510 commited on
Commit
92ba95c
·
verified ·
1 Parent(s): 4dae541

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +35 -84
README.md CHANGED
@@ -30,10 +30,8 @@ This repository contains a fine-tuned version of **Meta’s Llama 3.1 3B Instruc
30
  The fine-tuning process involves using **QLoRA** to adapt the pre-trained model while maintaining memory efficiency and computational feasibility. This technique allows for fine-tuning large-scale models on consumer-grade GPUs by leveraging **NF4** 4-bit quantization.
31
 
32
  - **Developed by [FineTuned]:** Karthik Manjunath Hadagali
33
- - **Funded by [optional]:** [More Information Needed]
34
- - **Shared by [optional]:** [More Information Needed]
35
  - **Model type:** Text-Generation
36
- - **Language(s) (NLP):** [More Information Needed]
37
  - **License:** [More Information Needed]
38
  - **Fine-Tuned from model [optional]:** Meta Llama 3.1 3B Instruct
39
  - **Fine-Tuning Method:** QLoRA
@@ -87,7 +85,21 @@ Users (both direct and downstream) should be made aware of the risks, biases and
87
 
88
  Use the code below to get started with the model.
89
 
90
- [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
  ## Training Details
93
 
@@ -97,9 +109,9 @@ Use the code below to get started with the model.
97
 
98
  The model has been fine-tuned on the **dmedhi/wiki_medical_terms** dataset. This dataset is designed to improve medical terminology comprehension and consists of:
99
 
100
- - Medical definitions and terminologies
101
- - Disease symptoms and conditions
102
- - Healthcare and clinical knowledge from Wikipedia's medical section
103
 
104
  This dataset ensures that the fine-tuned model performs well in understanding and responding to medical queries with enhanced accuracy.
105
 
@@ -140,43 +152,6 @@ This dataset ensures that the fine-tuned model performs well in understanding an
140
  - **Training Time:** ~3-4 hours per epoch on A100 40GB GPU
141
  - **Final Checkpoint Size:** ~2.8GB (with LoRA adapters stored separately)
142
 
143
- ## Evaluation
144
-
145
- <!-- This section describes the evaluation protocols and provides the results. -->
146
-
147
- ### Testing Data, Factors & Metrics
148
-
149
- #### Testing Data
150
-
151
- <!-- This should link to a Dataset Card if possible. -->
152
-
153
- [More Information Needed]
154
-
155
- #### Factors
156
-
157
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
158
-
159
- [More Information Needed]
160
-
161
- #### Metrics
162
-
163
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
164
-
165
- [More Information Needed]
166
-
167
- ### Results
168
-
169
- [More Information Needed]
170
-
171
- #### Summary
172
-
173
-
174
-
175
- ## Model Examination [optional]
176
-
177
- <!-- Relevant interpretability work for the model goes here -->
178
-
179
- [More Information Needed]
180
 
181
  ## Environmental Impact
182
 
@@ -190,50 +165,26 @@ Carbon emissions can be estimated using the [Machine Learning Impact calculator]
190
  - **Compute Region:** US-East
191
  - **Carbon Emitted:** [More Information Needed]
192
 
193
- ## Technical Specifications [optional]
194
-
195
- ### Model Architecture and Objective
196
-
197
- [More Information Needed]
198
-
199
- ### Compute Infrastructure
200
-
201
- [More Information Needed]
202
-
203
- #### Hardware
204
-
205
- [More Information Needed]
206
 
207
- #### Software
 
 
208
 
209
- [More Information Needed]
210
-
211
- ## Citation [optional]
212
 
213
  <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
 
214
 
215
- **BibTeX:**
216
-
217
- [More Information Needed]
218
-
219
- **APA:**
220
-
221
- [More Information Needed]
222
-
223
- ## Glossary [optional]
224
-
225
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
226
-
227
- [More Information Needed]
228
-
229
- ## More Information [optional]
230
-
231
- [More Information Needed]
232
-
233
- ## Model Card Authors [optional]
234
-
235
- [More Information Needed]
236
 
237
- ## Model Card Contact
238
 
239
- [More Information Needed]
 
 
 
30
  The fine-tuning process involves using **QLoRA** to adapt the pre-trained model while maintaining memory efficiency and computational feasibility. This technique allows for fine-tuning large-scale models on consumer-grade GPUs by leveraging **NF4** 4-bit quantization.
31
 
32
  - **Developed by [FineTuned]:** Karthik Manjunath Hadagali
 
 
33
  - **Model type:** Text-Generation
34
+ - **Language(s) (NLP):** Python
35
  - **License:** [More Information Needed]
36
  - **Fine-Tuned from model [optional]:** Meta Llama 3.1 3B Instruct
37
  - **Fine-Tuning Method:** QLoRA
 
85
 
86
  Use the code below to get started with the model.
87
 
88
+ ```python
89
+ from transformers import AutoModelForCausalLM, AutoTokenizer
90
+ import torch
91
+
92
+ # Load the fine-tuned model
93
+ model_id = "your-hf-username/llama-3.1-3b-medical-qlora"
94
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
95
+ model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
96
+
97
+ # Example query
98
+ input_text = "What is the medical definition of pneumonia?"
99
+ inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
100
+ outputs = model.generate(**inputs, max_new_tokens=100)
101
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
102
+
103
 
104
  ## Training Details
105
 
 
109
 
110
  The model has been fine-tuned on the **dmedhi/wiki_medical_terms** dataset. This dataset is designed to improve medical terminology comprehension and consists of:
111
 
112
+ Medical definitions and terminologies
113
+ Disease symptoms and conditions
114
+ Healthcare and clinical knowledge from Wikipedia's medical section
115
 
116
  This dataset ensures that the fine-tuned model performs well in understanding and responding to medical queries with enhanced accuracy.
117
 
 
152
  - **Training Time:** ~3-4 hours per epoch on A100 40GB GPU
153
  - **Final Checkpoint Size:** ~2.8GB (with LoRA adapters stored separately)
154
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
 
156
  ## Environmental Impact
157
 
 
165
  - **Compute Region:** US-East
166
  - **Carbon Emitted:** [More Information Needed]
167
 
168
+ ## Limitations & Considerations
 
 
 
 
 
 
 
 
 
 
 
 
169
 
170
+ Not a substitute for professional medical advice
171
+ ❗ May contain biases from training data
172
+ ❗ Limited knowledge scope (not updated in real-time)
173
 
174
+ ## Citation
 
 
175
 
176
  <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
177
+ If you use this model, please consider citing:
178
 
179
+ @article{llama3.1_medical_qlora,
180
+ title={Fine-tuned Llama 3.1 3B Instruct for Medical Knowledge with QLoRA},
181
+ author={Karthik Manjunath Hadagali},
182
+ year={2024},
183
+ journal={Hugging Face Model Repository}
184
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
 
186
+ ## Acknowledgments
187
 
188
+ - Meta AI for the Llama 3.1 3B Instruct Model.
189
+ - Hugging Face PEFT for QLoRA implementation.
190
+ - dmedhi/wiki_medical_terms dataset contributors.