Code for fine-tuning LLMs using LoRA
Top 53.5% on sourcepulse
This repository provides code and methodologies for fine-tuning large language models (LLMs) using the Platypus approach, which leverages LoRA and PEFT for efficient refinement. It targets researchers and developers aiming to enhance LLM performance with custom datasets, offering a streamlined pipeline for data preparation, fine-tuning, and model merging.
How It Works
Platypus fine-tuning utilizes Low-Rank Adaptation (LoRA) and the Parameter-Efficient Fine-Tuning (PEFT) library to adapt base LLMs like LLaMA and LLaMa-2. The process involves a data pipeline that refines open-source datasets through keyword search and cosine similarity checks to remove redundancy and ensure data quality. Fine-tuning is orchestrated via finetune.py
using torchrun
for data parallelism or accelerate
for broader compatibility, with hyperparameter configurations detailed for various model sizes. Merging LoRA weights back into the base model is handled by merge.sh
.
Quick Start & Requirements
pip install -r requirements.txt
(PyTorch 2.0+ recommended for torchrun
).pip install -e .
Highlighted Details
merge.sh
using PEFT's linear merge.Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
bf16=True
, fp16=False
) are noted as critical for LLaMa-2 7B.torchrun
or PyTorch.bitsandbytes
and peft
from source.1 year ago
1 week