Fine-tuning Large Language Models (LLMs) | w/ Example Code

Shaw Talebi β€’ October 1, 2023
Video Thumbnail

About

No channel description available.

Video Description

🀝 Work with me: https://www.shawhintalebi.com This is the 5th video in a series on using large language models (LLMs) in practice. Here, I discuss how to fine-tune an existing LLM for a particular use case and walk through a concrete example with Python code. Resources: ▢️ Series Playlist: https://www.youtube.com/playlist?list=PLz-ep5RbHosU2hnz5ejezwaYpdMutMVB0 πŸ“° Read more: https://medium.com/towards-data-science/fine-tuning-large-language-models-llms-23473d763b91?sk=fd31e7444cf8f3070d9a843a8218ddad πŸ’» Example code: https://github.com/ShawhinT/YouTube-Blog/tree/main/LLMs/fine-tuning Final Model: https://huggingface.co/shawhin/distilbert-base-uncased-lora-text-classification πŸ”’ Dataset: https://huggingface.co/datasets/shawhin/imdb-truncated References: [1] Deeplearning.ai Finetuning Large Langauge Models Short Course: https://www.deeplearning.ai/short-courses/finetuning-large-language-models/ [2] arXiv:2005.14165 [cs.CL] (GPT-3 Paper) [3] arXiv:2303.18223 [cs.CL] (Survey of LLMs) [4] arXiv:2203.02155 [cs.CL] (InstructGPT paper) [5] πŸ€— PEFT: Parameter-Efficient Fine-Tuning of Billion-Scale Models on Low-Resource Hardware: https://huggingface.co/blog/peft [6] arXiv:2106.09685 [cs.CL] (LoRA paper) [7] Original dataset source β€” Andrew L. Maas, Raymond E. Daly, Peter T. Pham, Dan Huang, Andrew Y. Ng, and Christopher Potts. 2011. Learning Word Vectors for Sentiment Analysis. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 142–150, Portland, Oregon, USA. Association for Computational Linguistics. Intro - 0:00 What is Fine-tuning? - 0:32 Why Fine-tune - 3:29 3 Ways to Fine-tune - 4:25 Supervised Fine-tuning in 5 Steps - 9:04 3 Options for Parameter Tuning - 10:00 Low-Rank Adaptation (LoRA) - 11:37 Example code: Fine-tuning an LLM with LoRA - 15:40 Load Base Model - 16:02 Data Prep - 17:44 Model Evaluation - 21:49 Fine-tuning with LoRA - 24:10 Fine-tuned Model - 26:50

Kitchen Essentials for Perfect Fajitas

AI-recommended products based on this video

Loading...
Victorinox Swiss-Army-Cutlery Rosewood Curved Boning Knife, Semi-Stiff Blade, 6-Inch

Victorinox Swiss-Army-Cutlery Rosewood Curved Boning Knife, Semi-Stiff Blade, 6-Inch

(1,453)
$128.36
Loading...
Victorinox Swiss Army Classic SD Pocket Knife, Camo

Victorinox Swiss Army Classic SD Pocket Knife, Camo

(45,533)
$33.00
$4.99 delivery Jun 19 - 25
Loading...
Huachuang 3PCS Griddle Accessories for Blackstone: 2 Clip-on Stainless Steel Spatula Holder + Magnetic Grease Gate Blocker for 28"/36" Blackstone Griddle - Grill Barbecue Tool Set

Huachuang 3PCS Griddle Accessories for Blackstone: 2 Clip-on Stainless Steel Spatula Holder + Magnetic Grease Gate Blocker for 28"/36" Blackstone Griddle - Grill Barbecue Tool Set

(4)
$16.99
FREE delivery Sun, Aug 10 on your first order
Loading...
3 4 5 Year Old Girl Gifts, Exssary Kids Knife Set for Real Cooking Toys for 3 4 5 6-8 Year Old Girls Montessori Toddler Kitchen Tools Cutting Board Knives Birthday Gift Girls Toys Age 4-6 7-10 Pink

3 4 5 Year Old Girl Gifts, Exssary Kids Knife Set for Real Cooking Toys for 3 4 5 6-8 Year Old Girls Montessori Toddler Kitchen Tools Cutting Board Knives Birthday Gift Girls Toys Age 4-6 7-10 Pink

(68)
$23.79
FREE delivery Sat, Jun 14 on your first order
100+ bought in past month
Loading...
Berglander Dinner Forks Set 12pcs 18.5cm, Stainless Steel Table Fork, Dessert Salad Forks, Flatware Silverware Fork for Restaurant, Hotel, Bulk Value, Affordable, Dishwasher Safe

Berglander Dinner Forks Set 12pcs 18.5cm, Stainless Steel Table Fork, Dessert Salad Forks, Flatware Silverware Fork for Restaurant, Hotel, Bulk Value, Affordable, Dishwasher Safe

(66)
$11.39
FREE delivery Wed, May 13 on your first order
600+ bought in past month
Loading...
Star Wars Owala FreeSip Insulated Stainless Steel Water Bottle with Straw, BPA-Free Sports Water Bottle, Great for Travel, 32 Oz, Darth Vader

Star Wars Owala FreeSip Insulated Stainless Steel Water Bottle with Straw, BPA-Free Sports Water Bottle, Great for Travel, 32 Oz, Darth Vader

(1,642)
$46.79
FREE delivery May 21 - Jun 14
Loading...
Star Wars Owala FreeSip Insulated Stainless Steel Water Bottle with Straw, BPA-Free Sports Water Bottle, Great for Travel, 32 Oz, GroGu

Star Wars Owala FreeSip Insulated Stainless Steel Water Bottle with Straw, BPA-Free Sports Water Bottle, Great for Travel, 32 Oz, GroGu

(1,642)
$46.79
FREE delivery Sun, May 10
Loading...
2PC Multi-Functional Vegetable Peeler for Kitchen,Vegetable Peeler Wooden Handle,2-in-1 Stainless Steel Fruit & Vegetable Peelers with Bottle Opener for Potato Pineapple

2PC Multi-Functional Vegetable Peeler for Kitchen,Vegetable Peeler Wooden Handle,2-in-1 Stainless Steel Fruit & Vegetable Peelers with Bottle Opener for Potato Pineapple

(3)
$17.99
FREE delivery Mon, May 4 on your first order
Loading...
Pickleball Paddles Set of 2 or 4, USAPA Approved Pickleball Paddles Set with 4 Pickle Balls and Carry Bag, Fiberglass Rackets 2 Pack Gifts for Beginners&Pros

Pickleball Paddles Set of 2 or 4, USAPA Approved Pickleball Paddles Set with 4 Pickle Balls and Carry Bag, Fiberglass Rackets 2 Pack Gifts for Beginners&Pros

(1,545)
$65.99
FREE delivery Wed, Aug 20
50+ bought in past month
Loading...
Pickleball Paddles Set of 2 or 4, USAPA Approved Pickleball Paddles Set with 4 Pickle Balls and Carry Bag, Fiberglass Rackets 2 Pack Gifts for Beginners&Pros

Pickleball Paddles Set of 2 or 4, USAPA Approved Pickleball Paddles Set with 4 Pickle Balls and Carry Bag, Fiberglass Rackets 2 Pack Gifts for Beginners&Pros

(1,529)
$35.99
FREE delivery Sun, Aug 10
50+ bought in past month
Loading...
Berglander Dinner Forks Set 12pcs 18.5cm, Stainless Steel Table Fork, Dessert Salad Forks, Flatware Silverware Fork for Restaurant, Hotel, Bulk Value, Affordable, Dishwasher Safe

Berglander Dinner Forks Set 12pcs 18.5cm, Stainless Steel Table Fork, Dessert Salad Forks, Flatware Silverware Fork for Restaurant, Hotel, Bulk Value, Affordable, Dishwasher Safe

(66)
$11.39
FREE delivery Wed, May 13 on your first order
600+ bought in past month
Loading...
Star Wars Owala FreeSip Insulated Stainless Steel Water Bottle with Straw, BPA-Free Sports Water Bottle, Great for Travel, 32 Oz, Darth Vader

Star Wars Owala FreeSip Insulated Stainless Steel Water Bottle with Straw, BPA-Free Sports Water Bottle, Great for Travel, 32 Oz, Darth Vader

(1,642)
$46.79
FREE delivery May 21 - Jun 14
Loading...
Star Wars Owala FreeSip Insulated Stainless Steel Water Bottle with Straw, BPA-Free Sports Water Bottle, Great for Travel, 32 Oz, GroGu

Star Wars Owala FreeSip Insulated Stainless Steel Water Bottle with Straw, BPA-Free Sports Water Bottle, Great for Travel, 32 Oz, GroGu

(1,642)
$46.79
FREE delivery Sun, May 10
Loading...
2PC Multi-Functional Vegetable Peeler for Kitchen,Vegetable Peeler Wooden Handle,2-in-1 Stainless Steel Fruit & Vegetable Peelers with Bottle Opener for Potato Pineapple

2PC Multi-Functional Vegetable Peeler for Kitchen,Vegetable Peeler Wooden Handle,2-in-1 Stainless Steel Fruit & Vegetable Peelers with Bottle Opener for Potato Pineapple

(3)
$17.99
FREE delivery Mon, May 4 on your first order