Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- randomani/MedicalQnA-llama2
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
library_name: adapter-transformers
|
8 |
+
pipeline_tag: question-answering
|
9 |
+
tags:
|
10 |
+
- medical
|
11 |
+
---
|
12 |
+
|
13 |
+
# Fine-Tuning LLaMA-2 Chat Model with Medical QnA Dataset using QLoRA
|
14 |
+
|
15 |
+
This repository contains the code and configuration for fine-tuning the LLaMA-2 chat model using the Medical QnA dataset with the QLoRA technique.Used only 2k data elements for training due to constrained gpu resources.
|
16 |
+
|
17 |
+
## Model and Dataset
|
18 |
+
|
19 |
+
- **Pre-trained Model**: `NousResearch/Llama-2-7b-chat-hf`
|
20 |
+
- **Dataset for Fine-Tuning**: `randomani/MedicalQnA-llama2`
|
21 |
+
- **Fine-Tuned Model Name**: `Llama-2-7b-Medchat-finetune`
|
22 |
+
|
23 |
+
## QLoRA Parameters
|
24 |
+
|
25 |
+
- **LoRA Attention Dimension** (`lora_r`): 64
|
26 |
+
- **LoRA Scaling Alpha** (`lora_alpha`): 16
|
27 |
+
- **LoRA Dropout Probability** (`lora_dropout`): 0.1
|
28 |
+
|
29 |
+
## bitsandbytes Parameters
|
30 |
+
|
31 |
+
- **Use 4-bit Precision** (`use_4bit`): True
|
32 |
+
- **4-bit Compute Dtype** (`bnb_4bit_compute_dtype`): float16
|
33 |
+
- **4-bit Quantization Type** (`bnb_4bit_quant_type`): nf4
|
34 |
+
- **Use Nested Quantization** (`use_nested_quant`): False
|
35 |
+
|
36 |
+
## Training Arguments
|
37 |
+
|
38 |
+
- **Number of Training Epochs** (`num_train_epochs`): 1
|
39 |
+
- **Use fp16** (`fp16`): False
|
40 |
+
- **Use bf16** (`bf16`): False
|
41 |
+
- **Training Batch Size per GPU** (`per_device_train_batch_size`): 4
|
42 |
+
- **Evaluation Batch Size per GPU** (`per_device_eval_batch_size`): 4
|
43 |
+
- **Gradient Accumulation Steps** (`gradient_accumulation_steps`): 1
|
44 |
+
- **Enable Gradient Checkpointing** (`gradient_checkpointing`): True
|
45 |
+
- **Maximum Gradient Norm** (`max_grad_norm`): 0.3
|
46 |
+
- **Initial Learning Rate** (`learning_rate`): 2e-4
|
47 |
+
- **Weight Decay** (`weight_decay`): 0.001
|
48 |
+
- **Optimizer** (`optim`): paged_adamw_32bit
|
49 |
+
- **Learning Rate Scheduler Type** (`lr_scheduler_type`): cosine
|
50 |
+
- **Maximum Training Steps** (`max_steps`): -1
|
51 |
+
- **Warmup Ratio** (`warmup_ratio`): 0.03
|
52 |
+
- **Group Sequences by Length** (`group_by_length`): True
|
53 |
+
- **Save Checkpoints Every X Steps** (`save_steps`): 0
|
54 |
+
- **Logging Steps** (`logging_steps`): 25
|
55 |
+
|
56 |
+
## Supervised Fine-Tuning (SFT) Parameters
|
57 |
+
|
58 |
+
- **Maximum Sequence Length** (`max_seq_length`): None
|
59 |
+
- **Packing Multiple Short Examples** (`packing`): False
|
60 |
+
|
61 |
+
## References
|
62 |
+
|
63 |
+
For more details and access to the dataset, visit the [Hugging Face Dataset Page](https://huggingface.co/datasets/randomani/MedicalQnA-llama2).
|
64 |
+
|
65 |
+
|