FineTuningLLMs  by dvgodoy

Hands-on guide to fine-tuning LLMs

created 1 year ago
475 stars

Top 64.1% on SourcePulse

GitHubView on GitHub
Project Summary

This repository provides practical guidance and code examples for fine-tuning Large Language Models (LLMs) using PyTorch and the Hugging Face ecosystem. It targets data scientists and engineers seeking to adapt LLMs for specific tasks, focusing on key techniques like quantization and Low-Rank Adaptation (LoRA) for efficient single-GPU fine-tuning.

How It Works

The project demystifies LLM fine-tuning by breaking down complex concepts into manageable steps, mirroring the structure of a comprehensive book. It emphasizes practical implementation using Hugging Face's transformers and peft libraries, demonstrating techniques such as 8-bit and 4-bit quantization with bitsandbytes, and LoRA for parameter-efficient adaptation. The approach prioritizes efficient training on consumer-grade GPUs, addressing the common challenge of limited hardware resources.

Quick Start & Requirements

Notebooks can be run directly from GitHub via Google Colab, requiring a Google account and GPU access. Key dependencies include PyTorch, Hugging Face transformers, peft, and bitsandbytes. Detailed setup instructions and troubleshooting are available in the book's appendices and FAQ.

Highlighted Details

  • Covers quantization (8-bit, 4-bit) and Low-Rank Adaptation (LoRA).
  • Demonstrates fine-tuning with Hugging Face's SFTTrainer.
  • Explores attention mechanisms like Flash Attention and SDPA.
  • Includes local deployment methods using GGUF, Ollama, and llama.cpp.

Maintenance & Community

This repository is the official companion to a published book, indicating a stable and well-documented resource. Further community interaction or support channels are not explicitly mentioned in the README.

Licensing & Compatibility

The repository's licensing is not specified in the provided README. Compatibility for commercial use or closed-source linking would depend on the specific license chosen for the code and any underlying libraries.

Limitations & Caveats

The content is geared towards an intermediate audience with prior knowledge of deep learning fundamentals, Transformers, and PyTorch. While focused on single-GPU fine-tuning, advanced users might find the scope limited for distributed training scenarios.

Health Check
Last commit

4 months ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
146 stars in the last 30 days

Explore Similar Projects

Starred by Patrick von Platen Patrick von Platen(Research Engineer at Mistral; Author of Hugging Face Diffusers), Junyang Lin Junyang Lin(Core Maintainer of Alibaba Qwen), and
2 more.

ktransformers by kvcache-ai

0.3%
15k
Framework for LLM inference optimization experimentation
created 1 year ago
updated 2 weeks ago
Feedback? Help us improve.