Sign In

Full Setup Guide: Wan2.1 LoRA Training on WSL with Diffusion-Pipe

20

This is an update and modification of the Step-by-Step Hunyuan Training Guide. by @diSty

There is a useful video for those that prefer visual guidance. This tutorial will help you set up to train Wan2.1 LoRa's using Diffusion Pipe instead of Hunyuan. I've included the Toml files in this article for download.

Enable Windows Subsystem for Linux (WSL):

Before we begin, you need to make sure you have WSL enabled. If you have already enabled Windows Subsystem for Linux, we can begin this tutorial. If not, you will need to hit the Win Key and search "Turn Windows Features on or off" and scroll down to check off the Windows Subsystem for Linux box. Then restart your computer before proceeding to step one.




Open Powershell:

Right-click on the start button and click either Terminal (Admin) or Powershell (Admin), depending on your Windows setup.


Ensure that the terminal indicates you are in Powershell Cmd
Then follow the list of commands:


WSL Installation & Setup

1. Check existing WSL installations

wsl --list --verbose

2. Set WSL version to 2

wsl --set-default-version 2

3. View available WSL distributions

wsl --list --onlineCopyEdit

4. Install Ubuntu 22.04

wsl --install -d Ubuntu-22.04

Basic Linux Setup

Once you've installed Linux, click the start button and search for Ubuntu 22.04 and open it. You should see another terminal window like the following:

If you haven't already, you will need to setup a username and password for Linux. Make sure you put save it somewhere so you don't forget.

5. Update & upgrade system packages

sudo apt update && sudo apt upgrade -y

6. Install essential development tools

sudo apt install -y build-essential curl wget git unzip git-lfs

Install Miniconda

7. Download & install Miniconda

mkdir -p ~/miniconda3 wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3 rm ~/miniconda3/miniconda.sh

8. Activate Conda

source ~/miniconda3/bin/activate

9. Initialize Conda shells

conda init --all

Create and Setup Python Environment

10. Create Conda environment

conda create -n diffusion-pipe python=3.12

11. Activate environment

conda activate diffusion-pipe

12. Install PyTorch (CUDA 12.4)

pip install torch==2.4.1 torchvision==0.19.1 torchaudio --extra-index-url https://download.pytorch.org/whl/cu124

13. Install CUDA compiler

conda install nvidia::cuda-nvcc


Clone and Install Diffusion-Pipe

14. Clone Diffusion-Pipe repo

git clone --recurse-submodules https://github.com/tdrussell/diffusion-pipe

15. Navigate into repo

cd diffusion-pipe

16. Install Python dependencies

pip install -r requirements.txt


Download Wan2.1 Base Models and Checkpoints

17. Download model repository, excluding T5 & diffusion weights

huggingface-cli download Wan-AI/Wan2.1-T2V-1.3B --local-dir models/wan/Wan2.1-T2V-1.3B --exclude "diffusion_pytorch_model*" "models_t5*"

18. Download Wan2.1 base model safetensors

wget -P models/wan https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Wan2_1-T2V-1_3B_bf16.safetensors

19. Download Wan2.1 VAE model

wget -P models/wan https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Wan2_1_VAE_bf16.safetensors

20. Download LLM (UMT5) model

wget -P models/wan https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/umt5-xxl-enc-fp8_e4m3fn.safetensors


Once this is all done you should be able to see the following on you explorer and navigate to your Linux using explorer.

Update Config File for Wan2.1

Example examples/wan2.1.toml config snippet:

[model] type = 'wan' ckpt_path = 'models/wan/Wan2.1-T2V-1.3B' transformer_path = 'models/wan/Wan2_1-T2V-1_3B_bf16.safetensors' llm_path = 'models/wan/umt5-xxl-enc-fp8_e4m3fn.safetensors' dtype = 'bfloat16' # Optional: use fp8 for transformer when training LoRA #transformer_dtype = 'float8' timestep_sample_method = 'logit_normal'

Make sure this .toml file is saved in the examples/ directory of the repo.


Start Training Wan2.1

NCCL_P2P_DISABLE="1" NCCL_IB_DISABLE="1" deepspeed --num_gpus=1 train.py --deepspeed --config examples/wan2.1.toml


πŸ™ Thank You

Thanks for checking out this guide! If you have any questions or run into issues, feel free to DM meβ€”I'm happy to help.

If you found this helpful and want to support my work drop me a follow.

Happy training! πŸš€

20

Comments