Direct windows support for unsloth (#1841)

* Direct Windows Support(main)

* Update pyproject.toml

* Update README.md

Added the suggested changes to README
This commit is contained in:
Aditya Ghai 2025-02-28 09:55:46 +05:30 committed by GitHub
commit ce5190b868
2 changed files with 67 additions and 5 deletions

View file

@ -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/)
<table>
<tr>
<td>
<img src="https://github.com/user-attachments/assets/d3e6ca95-85bb-442a-8c6f-81944300598e" alt="VSCode C++ Ref Image" width="400" height="350"/>
</td>
<td>
<div align="center">
<h1>Steps to configure VS C++</h1>
</div>
<ol>
<li>Launch the Installer downloaded from the link above.</li>
<li>In the installer, navigate to Individual components and select all the options mentioned in the image.</li>
<li>Click on install now.</li>
</ol>
</td>
</tr>
</table>
### 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:

View file

@ -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",