From ce5190b86811294dd25ac30f94e70d8a692cef45 Mon Sep 17 00:00:00 2001 From: Aditya Ghai <119144814+adityaghai07@users.noreply.github.com> Date: Fri, 28 Feb 2025 09:55:46 +0530 Subject: [PATCH] Direct windows support for unsloth (#1841) * Direct Windows Support(main) * Update pyproject.toml * Update README.md Added the suggested changes to README --- README.md | 42 +++++++++++++++++++++++++++++++++++++++++- pyproject.toml | 30 ++++++++++++++++++++++++++---- 2 files changed, 67 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 665cbd5ea4..0a13ac47c4 100644 --- a/README.md +++ b/README.md @@ -168,8 +168,48 @@ x = x.format(cuda.replace(".", ""), "-ampere" if is_ampere else "") print(f'pip install --upgrade pip && pip install "unsloth[{x}] @ git+https://github.com/unslothai/unsloth.git"') ``` -### Windows Installation +## Windows Installation +### Step 1: NVIDIA Video Driver +You should install the latest version of your GPUs driver. You can download drivers here: + - [NVIDIA GPU Drive Download](https://www.nvidia.com/Download/index.aspx) + +### Step 2: Visual Studio C++ +You will need Visual Studio, with C++ installed. By default, C++ is not installed with Visual Studio, so make sure you select all of the C++ options. Also select options for Windows 10/11 SDK. + - [Visual Studio Community Edition](https://visualstudio.microsoft.com/vs/community/) + + + + + +
+ VSCode C++ Ref Image + +
+

Steps to configure VS C++

+
+
    +
  1. Launch the Installer downloaded from the link above.
  2. +
  3. In the installer, navigate to Individual components and select all the options mentioned in the image.
  4. +
  5. Click on install now.
  6. +
+
+ +### Step 3: CUDA Toolkit + + - [Download CUDA Toolkit](https://developer.nvidia.com/cuda-toolkit-archive) + +### Step 4: Install PyTorch + +You will need the correct version of PyTorch that is compatibile with your CUDA drivers, so make sure to select them carefully + - [Install PyTorch](https://pytorch.org/get-started/locally/) + +### Step 5: Install Unsloth +```python +pip install "unsloth[windows] @ git+https://github.com/unslothai/unsloth.git" +``` + +### Side note To run Unsloth directly on Windows: - Install Triton from this Windows fork and follow the instructions: https://github.com/woct0rdho/triton-windows (be aware that the Windows fork requires PyTorch >= 2.4 and CUDA 12) - In the SFTTrainer, set `dataset_num_proc=1` to avoid a crashing issue: diff --git a/pyproject.toml b/pyproject.toml index 14797c8fa7..de1583e9e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,10 +33,32 @@ exclude = ["images*"] [project.optional-dependencies] triton = [ - "triton @ https://github.com/woct0rdho/triton-windows/releases/download/v3.1.0-windows.post5/triton-3.1.0-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", - "triton @ https://github.com/woct0rdho/triton-windows/releases/download/v3.1.0-windows.post5/triton-3.1.0-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", - "triton @ https://github.com/woct0rdho/triton-windows/releases/download/v3.1.0-windows.post5/triton-3.1.0-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", - "triton @ https://github.com/woct0rdho/triton-windows/releases/download/v3.1.0-windows.post5/triton-3.1.0-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'", + "triton @ https://github.com/woct0rdho/triton-windows/releases/download/v3.2.0-windows.post10/triton-3.2.0-cp39-cp39-win_amd64.whl ; python_version=='3.9' and platform_system == 'Windows'", + "triton @ https://github.com/woct0rdho/triton-windows/releases/download/v3.2.0-windows.post10/triton-3.2.0-cp310-cp310-win_amd64.whl ; python_version=='3.10' and platform_system == 'Windows'", + "triton @ https://github.com/woct0rdho/triton-windows/releases/download/v3.2.0-windows.post10/triton-3.2.0-cp311-cp311-win_amd64.whl ; python_version=='3.11' and platform_system == 'Windows'", + "triton @ https://github.com/woct0rdho/triton-windows/releases/download/v3.2.0-windows.post10/triton-3.2.0-cp312-cp312-win_amd64.whl ; python_version=='3.12' and platform_system == 'Windows'" +] + +windows=[ + "unsloth_zoo>=2025.2.7", + "packaging", + "tyro", + "transformers>=4.46.1,!=4.47.0", + "datasets>=2.16.0", + "sentencepiece>=0.2.0", + "tqdm", + "psutil", + "wheel>=0.42.0", + "numpy", + "accelerate>=0.34.1", + "trl>=0.7.9,!=0.9.0,!=0.9.1,!=0.9.2,!=0.9.3,!=0.15.0", + "peft>=0.7.1,!=0.11.0", + "protobuf<4.0.0", + "huggingface_hub", + "hf_transfer", + "unsloth[triton]", + "bitsandbytes>=0.41.1 ; platform_system == 'Windows'", + "xformers>=0.0.22.post7 ; platform_system == 'Windows'", ] huggingface = [ "unsloth_zoo>=2025.2.7",