2x Faster LLM Training on Windows | LLaMA-Factory with Unsloth and Flash Attention 2

Channel:
Subscribers:
2,810
Published on ● Video Link: https://www.youtube.com/watch?v=KLHJqQSbuPE



Duration: 7:31
2,427 views
43


It was tough to get this working, but I think I've figured it out enough to share.

Here's a quick guide on how to set up LLaMA-Factory with support for Flash Attention 2 and Unsloth training on Windows. This is using a RTX3060 12GB GPU, Windows 10, and CUDA 12.1.

Unsloth is an optimization library that claims up to a 2x performance boost with no trade off in accuracy.

There's also a quick and dirty script to convert bulk raw text to a dataset file, and a little overview of the dataset setup. I also touch on how to fix the error when loading the trained adapter in the Text Generation WebUI caused by mismatching PEFT libs.

[00:00] Intro & Topics: Installing LLaMA-Factory, Unsloth; Adding Datasets; Making Datasets; Training
[01:05] System Specs... Probably CUDA 12.1 only?
[01:27] System requirements; Microsoft Build Tools, etc
[01:55] Creating the Conda environment and installing dependencies
[02:05] Install Clang
[02:27] Install Flash Attention 2
[02:44] Install LLaMA-Factory requirements
[03:01] Install LLaMA-Factory
[03:15] Reinstall Numpy; Install Triton for Windows
[03:42] Datasets
[05:10] .txt to alpaca format .json single text column script
[05:42] Run training with Unsloth
[06:10] Loading LoRA adapter in the Text Geneation WebUI (fixing config file errors)

Go here for copy-paste commands and links:
http://nanonomad.com/2024/06/20/llama-factory-with-flash-attention-2-and-unsloth/




Other Videos By NanoNomad


2025-04-17DiffRhythm: Generative Music (done quickly)
2025-02-25Is YuE the Stable Diffusion of Music? | Generate Full-Length Songs with Vocals at Home
2025-02-10Portable Whisper Speech to Text with Speaker Diarization and VAD | Purfview Faster Whisper XXL
2024-07-03Fine Tuning XTTS v2 for Hindi Speech with forked Coqui TTS
2024-06-26Fine Tuning XTTS v2 with forked Coqui | Coqui AI is dead; Long live Coqui!
2024-06-202x Faster LLM Training on Windows | LLaMA-Factory with Unsloth and Flash Attention 2
2024-06-1564kb Scene Demo/Intro/Cracktro Multimedia Mix #1 (90 min) | Flash/Photo-sensitivity Warning
2024-06-10Stable Audio Open 1.0 | Open Source* Generative Audio and Fine Tuning*
2024-06-04Troubleshooting Sega Saturn Emulation with Retroarch for iOS/Apple
2024-05-29Play Windows 98 and MS-DOS Games on iPad/iOS/iPhone with DOSBox-Pure and Retroarch for FREE
2024-05-25The Lost Art of Optical Disc Repair | Fixing and Testing a PlayStation Disc
2024-05-22Retroarch iOS Updates | Improved Performance, MS-DOS Core, Doom and Touch Input
2024-05-17RetroArch for iPad and iPhone now on the App Store | Installation, Setup, Quick Performance Overview
2024-05-13Micca Speck 4K Media Player | Unboxing, Firmware Update, Setup, Demos, and Opinions
2024-05-06Training SDXL to Generate Text Using IA3 LoRA | It's like Kai's Power Tools, I Guess?
2024-04-17Replacing Faulty Asus Phoenix RTX 3060 GPU Cooler - It's Easy
2024-03-21Bark TTS, Seamless Translation, RVC, Music Generation and More with the TTS Generation WebUI
2024-02-14Train Better Stable Diffusion Models | Prep Datasets Using this Free "Magic" Image Tool
2024-02-12Emulate a Sound Blaster in real MS-DOS on Modern Hardware | Retro Gaming on "Current" PCs
2024-01-28How to Play Hundreds of Point-and-Click Adventures on iOS for FREE with ScummVM with NO SIDELOADING
2024-01-18Training LoRAs and GLoRAs for Stable Diffusion 1.5 and XL Using the New Prodigy Optimizer



Tags:
Unsloth
large language model
LLM
fine-tuning
LLaMA
LLaMA-Factory