CoolFace
Modelpublic

develops20/DeepSeek-R1-Distill-Llama-8B-Medical-COT

sourceHugging Faceupdated 2y agoView on Hugging Face
1likes18downloads
Model Card

DeepSeek-R1-Distill-Llama-8B-Medical-COT

πŸ₯ Fine-tuned Medical Model

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.


πŸ“– Model Details

FeatureValue
ArchitectureLlama-8B (Distilled)
LanguageEnglish
Training Steps60
Batch Size2 (with gradient accumulation)
Gradient Accumulation Steps4
PrecisionMixed (FP16/BF16 based on GPU support)
OptimizerAdamW 8-bit
Fine-Tuned WithPEFT + LoRA (Unsloth)

πŸ“Š Training Summary

Loss Trend During Fine-Tuning:

StepTraining Loss
101.9188
201.4615
301.4023
401.3088
501.3443
601.3140

πŸš€ How to Use

python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_name = "develops20/DeepSeek-R1-Distill-Llama-8B-Medical-COT"

# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16, device_map="auto")
tokenizer = AutoTokenizer.from_pretrained(model_name)

# Run inference
def ask_model(question):
    inputs = tokenizer(question, return_tensors="pt").to("cuda")
    outputs = model.generate(input_ids=inputs.input_ids, max_new_tokens=512)
    return tokenizer.decode(outputs[0], skip_special_tokens=True)

question = "A 61-year-old woman has involuntary urine loss when coughing. What would cystometry likely reveal?"
print(ask_model(question))

Example Outputs
Q: "A 59-year-old man presents with fever, night sweats, and a 12mm aortic valve vegetation. What is the most likely predisposing factor?"
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."