Fit Your LLM in a single GPU with Gradient Checkpointing, LoRA, and Quantization.
Last Updated on August 7, 2023 by Editorial Team
Author(s): Jeremy Arancio
Originally published on Towards AI.
Fine-tune an LLM on your personal data: create a “The Lord of the Rings” storyteller.
This member-only story is on us. Upgrade to access all of Medium.
Whoever has ever tried to fine-tune a Large Language Model knows how hard it is to handle the GPU memory.
“RuntimeError: CUDA error: out of memory”
This error message has been haunting my nights.
3B, 7B, or even 13B parameters models are large and the fine-tuning is long and tedious. Running out of memory during training can be both frustrating and costly.
But don’t worry, I got you!
In this article, we’re going through 3 techniques you have to know or already use without knowing how they work: Gradient Checkpointing, Low-Rank Adapters, and Quantization.
Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.
Published via Towards AI