develops20 commited on
Commit
9580206
·
verified ·
1 Parent(s): e0a0de7

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +72 -13
README.md CHANGED
@@ -1,14 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
- license: apache-2.0
3
- tags:
4
- - unsloth
5
- - trl
6
- - sft
7
- datasets:
8
- - FreedomIntelligence/medical-o1-reasoning-SFT
9
- language:
10
- - en
11
- base_model:
12
- - deepseek-ai/DeepSeek-R1-Distill-Llama-8B
13
- library_name: transformers
14
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DeepSeek-R1-Distill-Llama-8B-Medical-COT
2
+
3
+ ## 🏥 Fine-tuned Medical Model
4
+ This is a **fine-tuned version of DeepSeek-R1-Distill-Llama-8B**, optimized for **medical reasoning and clinical case analysis** using **LoRA (Low-Rank Adaptation) with Unsloth**.
5
+
6
+ - **Base Model:** [DeepSeek-R1-Distill-Llama-8B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Llama-8B)
7
+ - **Fine-Tuning Framework:** [Unsloth](https://github.com/unslothai/unsloth)
8
+ - **Dataset:** [FreedomIntelligence/medical-o1-reasoning-SFT](https://huggingface.co/datasets/FreedomIntelligence/medical-o1-reasoning-SFT)
9
+ - **Quantization:** 4-bit (bitsandbytes)
10
+ - **Task:** **Clinical reasoning, medical question-answering, diagnosis assistance**
11
+ - **Pipeline Tag:** `text-generation`
12
+ - **Metrics:** `loss`, `accuracy`
13
+ - **Library Name:** `transformers`
14
+
15
  ---
16
+
17
+ ## 📖 Model Details
18
+
19
+ | Feature | Value |
20
+ |--------------------|-------------|
21
+ | **Architecture** | Llama-8B (Distilled) |
22
+ | **Language** | English |
23
+ | **Training Steps** | 60 |
24
+ | **Batch Size** | 2 (with gradient accumulation) |
25
+ | **Gradient Accumulation Steps** | 4 |
26
+ | **Precision** | Mixed (FP16/BF16 based on GPU support) |
27
+ | **Optimizer** | AdamW 8-bit |
28
+ | **Fine-Tuned With** | PEFT + LoRA (Unsloth) |
29
+
30
+ ---
31
+
32
+ ## 📊 Training Summary
33
+ **Loss Trend During Fine-Tuning:**
34
+
35
+ | Step | Training Loss |
36
+ |------|--------------|
37
+ | 10 | 1.9188 |
38
+ | 20 | 1.4615 |
39
+ | 30 | 1.4023 |
40
+ | 40 | 1.3088 |
41
+ | 50 | 1.3443 |
42
+ | 60 | 1.3140 |
43
+
44
+ ---
45
+
46
+ ## 🚀 How to Use
47
+
48
+ ```python
49
+ from transformers import AutoModelForCausalLM, AutoTokenizer
50
+ import torch
51
+
52
+ model_name = "develops20/DeepSeek-R1-Distill-Llama-8B-Medical-COT"
53
+
54
+ # Load model and tokenizer
55
+ model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16, device_map="auto")
56
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
57
+
58
+ # Run inference
59
+ def ask_model(question):
60
+ inputs = tokenizer(question, return_tensors="pt").to("cuda")
61
+ outputs = model.generate(input_ids=inputs.input_ids, max_new_tokens=512)
62
+ return tokenizer.decode(outputs[0], skip_special_tokens=True)
63
+
64
+ question = "A 61-year-old woman has involuntary urine loss when coughing. What would cystometry likely reveal?"
65
+ print(ask_model(question))
66
+
67
+ Example Outputs
68
+ Q: "A 59-year-old man presents with fever, night sweats, and a 12mm aortic valve vegetation. What is the most likely predisposing factor?"
69
+ Model's Answer: "The most likely predisposing factor for this patient’s infective endocarditis is a history of valvular heart disease or prosthetic valves, given the presence of an aortic valve vegetation. The causative organism is likely Enterococcus species, which does not grow in high salt concentrations."
70
+
71
+
72
+
73
+