Overview
Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
Learn to fine-tune a pre-trained Large Language Model (LLM) using LoRA (Low-Rank Adaptation) technique to teach it custom information in this hands-on coding tutorial. Master the complete workflow of customizing an AI model by working with the Hugging Face Transformers library and Python to load, modify, and retrain the Qwen2.5-3B-Instruct model. Discover how to prepare custom datasets in prompt/completion JSON format, perform dataset tokenization, and implement Parameter-Efficient Fine-Tuning (PEFT) with LoRA for memory-efficient training. Follow along as you set up the development environment using Conda and Jupyter Lab, load and interact with pre-trained models, create training data that teaches the model fictional information, and apply LoRA configuration targeting specific model components like q_proj, k_proj, and v_proj modules. Explore the tokenization process for preparing data for training, understand the training loop implementation, and learn best practices for fine-tuning including important considerations before starting the training process. Practice saving your customized model and performing inference to test the results, demonstrating how the fine-tuned model now responds according to your custom training data rather than its original training.
Syllabus
01:07 - Environment Setup
01:50 - Load and Talk to LLM with Hugging Face Transformers
03:33 - Data Preparation
07:32 - Tokenization
14:33 - LoRA
16:47 - Training / Fine Tuning
19:17 - Important Notes Before You Start Training
20:54 - Training Results
21:15 - Save Fine Tuned Model
22:06 - Test Fine Tuned Model / Inference
23:10 - Thanks for Watching!
Taught by
Python Simplified