Llama-3-Medical-8B-SFT-LoRA

This is a LoRA adapter for Meta-Llama-3-8B, fine-tuned on medical domain data using Supervised Fine-Tuning (SFT).

Model Details

  • Base Model: Meta-Llama-3-8B
  • Training Method: QLoRA (Quantized Low-Rank Adaptation)
  • Training Framework: TRL + DeepSpeed + PEFT
  • Domain: Medical
  • Languages: English and Chinese
  • License: Llama 3 License

Training Details

This LoRA adapter was trained using:

  • Method: Supervised Fine-Tuning (SFT) with QLoRA
  • Framework: Hugging Face TRL, PEFT, DeepSpeed
  • Data: Medical domain datasets including medical Q&A, clinical notes, and medical knowledge
  • LoRA Rank: Check adapter_config.json for details
  • Training Precision: Mixed precision (bf16/fp16)

Usage

To use this LoRA adapter, you need to:

  1. Install required packages:
pip install transformers peft torch
  1. Load the model with LoRA adapter:
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

# Load base model
base_model = "meta-llama/Meta-Llama-3-8B"
model = AutoModelForCausalLM.from_pretrained(
    base_model,
    torch_dtype="auto",
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(base_model)

# Load LoRA adapter
model = PeftModel.from_pretrained(model, "bootscoder/Llama-3-Medical-8B-SFT-LoRA")

# Generate text
inputs = tokenizer("What is diabetes?", return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
  1. Or merge LoRA with base model:
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

base_model = "meta-llama/Meta-Llama-3-8B"
model = AutoModelForCausalLM.from_pretrained(base_model, torch_dtype="auto")
model = PeftModel.from_pretrained(model, "bootscoder/Llama-3-Medical-8B-SFT-LoRA")

# Merge and save
merged_model = model.merge_and_unload()
merged_model.save_pretrained("./merged_model")

Intended Use

This model is intended for:

  • Medical question answering
  • Medical text generation
  • Research and educational purposes in healthcare domain

Limitations

  • This model is for research purposes only
  • Should not be used for clinical decision-making without professional medical oversight
  • May generate inaccurate or hallucinated medical information
  • Requires careful validation before any real-world application

Training Infrastructure

  • Hardware: NVIDIA GPUs with DeepSpeed optimization
  • Software: PyTorch, Transformers, PEFT 0.17.1, TRL, DeepSpeed

Citation

If you use this model, please cite:

@misc{llama3-medical-8b-sft-lora,
  author = {bootscoder},
  title = {Llama-3-Medical-8B-SFT-LoRA},
  year = {2024},
  publisher = {HuggingFace},
  url = {https://huggingface.co/bootscoder/Llama-3-Medical-8B-SFT-LoRA}
}

Disclaimer

This model is provided as-is for research and educational purposes. The outputs should not be used as medical advice. Always consult with qualified healthcare professionals for medical decisions.

Downloads last month
3
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for bootscoder/Llama-3-Medical-8B-SFT-LoRA

Adapter
(657)
this model