Skip to content

Instantly share code, notes, and snippets.

@sebaxakerhtc
Last active January 20, 2025 16:23
Show Gist options
  • Save sebaxakerhtc/502cc20cc94b8eb1acc29dee0610fdab to your computer and use it in GitHub Desktop.
Save sebaxakerhtc/502cc20cc94b8eb1acc29dee0610fdab to your computer and use it in GitHub Desktop.
Unsloth on Windows directly

Installing directly on Windows:

python installed: 3.10.6

We create Virtual environment

python -m venv unsloth

Activate it

unsloth\scripts\activate

Installing torch with CUDA

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

Next we need triton

pip install https://github.com/woct0rdho/triton-windows/releases/download/v3.1.0-windows.post7/triton-3.1.0-cp310-cp310-win_amd64.whl

And xformers

(You should first download xformers and place it in project dir https://download.pytorch.org/whl/cu124/xformers-0.0.29.post1-cp310-cp310-win_amd64.whl)

pip install xformers-0.0.29.post1-cp310-cp310-win_amd64.whl

And Unsloth of course

pip install unsloth pip install --force-reinstall --no-cache-dir --no-deps git+https://github.com/unslothai/unsloth.git

Don't forget about this:

In the SFTTrainer, set dataset_num_proc=1 to avoid a crashing issue:

trainer = SFTTrainer(
    dataset_num_proc=1,
    ...
)

One more tip

It's a good idea to move HuggingFace cache location

to save drive C: For me it's on D: drive

Open terminal/powershell and type

set HUGGINGFACE_HUB_CACHE=D:\HF_CACHE
set HF_DATASETS_CACHE=D:\HF_CACHE

Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment