You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can provide wheels, if you would like to make an auto install for 3.11, with triton, and deepspeed wheels for cuda 121. (Idk if cuda matters for this, can’t remember it was long ago I managed installed deepspeed and triton on native windows) although you do still need a set of libraries in path, but there is a link to that inside the github inside the twitter thread.
@NickWithBotronics Great work again!! Oh that'll be sick if wheels could be provided - I could copy paste your exact path and tack it into pyproject.toml
i had to do this modification to the code:
(although that might be an issue with the training script i was using)
"
Delete this line it is at line 1291 in C:\Users\Training\AppData\Local\Programs\Python\Python311\Lib\site-packages\unsloth\models\llama.py
"
for module in target_modules:
assert(module in accepted_modules)
pass
"
and lastly (
You will likely still need vs studio 2022
(don't forget the libraries available here https://github.com/wkpark/triton/releases/tag/llvm-build-for-win and honestly i would just add it into Nvidia computing folder, then add the bin folder inside that into your environment variables.
To add onto this - I ran into an issue on native windows with xformers when building unsloth, so I forked my own version and edited the pyproject.toml to use the xformers wheel for my python/torch/cuda, then built from source without any more issues: cu121onlytorch220 = [
"xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.24-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9'",
"xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.24-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10'",
"xformers @ https://files.pythonhosted.org/packages/02/10/aaa3b7547fec9e28948e723fb97585200a7070e810b4d1d0813fc1821690/xformers-0.0.24-cp311-cp311-win_amd64.whl ; python_version=='3.11'",
]
Actually i do remember running into an xformers issue, i had ran 'pip install xformers' and pip found that 3.11 package for windows and installed it. Thanks for reporting! will include in the read me!
Don't try using MigWig to compile the triton kernels you must use the MVSC build tools to compile the kernels. To do so install the build tools here at the bottom of the page under build tools.
-The back end of Deepspeed, uses Ninja mixed with c++ to compile kernels at run time, does this mess with unsloth idk? Either way it’s a easy install so just install it to be safe. ‘pip install ninja’
Yeahhh, twitter aka X likes to change their links around like crazy. Use the instructions at the bottom of the read.md, they are more thorough than the twitter thread. And use the picture to see what to download for build tools.
@NicolasMejiaPetit@danielhanchen Heyy!!! I actually ran into ModuleNotFoundError: No module named 'triton' while fine-tuning google/gemma-7b-it. I installed xformers successfully through a documentation that I found by Unsloth but while running From unsloth import FastLanguageModel I was thrown this error. I've been trying to solve this error quite sometime and can't seem to find any reddit or git solutions to this triton issue. Also I am working on windows 11.
the error kinda looks like this:
Traceback (most recent call last):
File "C:\Users\Megha\Gemma_DPO\sft_trainer.py", line 14, in
from unsloth import FastLanguageModel
File "C:\Users\Megha\Gemma_DPO\sanedai\Lib\site-packages\unsloth_init_.py", line 103, in
import triton
ModuleNotFoundError: No module named 'triton'
Please help I'm really stuck! Thanks in advance. Good day!
Ye it's best to follow the community guides posted here to install Unsloth on Windows - sadly I'm limited in bandwidth, so I can't yet "officially" support Windows yet
@NicolasMejiaPetit@danielhanchen Heyy!!! I actually ran into ModuleNotFoundError: No module named 'triton' while fine-tuning google/gemma-7b-it. I installed xformers successfully through a documentation that I found by Unsloth but while running From unsloth import FastLanguageModel I was thrown this error. I've been trying to solve this error quite sometime and can't seem to find any reddit or git solutions to this triton issue. Also I am working on windows 11. the error kinda looks like this: Traceback (most recent call last): File "C:\Users\Megha\Gemma_DPO\sft_trainer.py", line 14, in from unsloth import FastLanguageModel File "C:\Users\Megha\Gemma_DPO\sanedai\Lib\site-packages\unsloth__init__.py", line 103, in import triton ModuleNotFoundError: No module named 'triton'
Please help I'm really stuck! Thanks in advance. Good day!
i had to do this modification to the code: (although that might be an issue with the training script i was using) " Delete this line it is at line 1291 in C:\Users\Training\AppData\Local\Programs\Python\Python311\Lib\site-packages\unsloth\models\llama.py " for module in target_modules: assert(module in accepted_modules) pass " and lastly ( You will likely still need vs studio 2022 (don't forget the libraries available here https://github.com/wkpark/triton/releases/tag/llvm-build-for-win and honestly i would just add it into Nvidia computing folder, then add the bin folder inside that into your environment variables.
I know asking too much. A lot of AI tools need python 3.10 and not supported on higher versions.
If you get time need triton wheel for python 3.10.
Tested the wheel on a python 3.11 conda environment and it worked great.
There are two pre-reqs to using it though, to enable the required on-the-fly triton JIT compilation which unsloth via triton triggers when the trainer runs (trainer.train).
The environment variable CC1 must be set to the exact value cl. (*)
MSVC (Visual studio) shell environment must be initialized before running unsloth.
When those two conditions are satisfied, your wheel works fine with the unsloth trainer.
I personally solved this little gotcha by having the following at the top of my training scripts or notebooks:
# windows triton fiximportos, shutilos.environ['CC'] ='cl'# for triton jit compilationassertshutil.which('cl') isnotNone, "VS Studio shell environment not initialized (prereq for triton)"
*) I asume you added the _cc_cmd function, since I can't find it in the triton repository's history. It's not part of 2.1.0.
The code in your build looks like this in contrast to upstream:
else:
cc_cmd=_cc_cmd(cc, src, so, [cu_include_dir, py_include_dir, srcdir], [*cuda_lib_dirs, *py_lib_dirs])
ret=subprocess.check_call(cc_cmd)
and _cc_cmd makes a hard assumption that CC is named "cl" exactly, as well as the MSVC environment being already initialized.
Thanks to amazing contributors in #1841 you are now able to install Unsloth directly via Windows. Would anyone be kind enough to try it out and see if it works? Thank you!
I had to uninstall torch from the unsloth[windows] in my venv and reinstall using the pytorch page for my CUDA version, but after I did that, it's working. :)
Activity
NicolasMejiaPetit commentedon Mar 1, 2024
I can provide wheels, if you would like to make an auto install for 3.11, with triton, and deepspeed wheels for cuda 121. (Idk if cuda matters for this, can’t remember it was long ago I managed installed deepspeed and triton on native windows) although you do still need a set of libraries in path, but there is a link to that inside the github inside the twitter thread.
danielhanchen commentedon Mar 1, 2024
@NickWithBotronics Great work again!! Oh that'll be sick if wheels could be provided - I could copy paste your exact path and tack it into pyproject.toml
NicolasMejiaPetit commentedon Mar 1, 2024
Uploaded wheels to google drive.
https://drive.google.com/drive/folders/1aWSFb-ZR8TTIDdRlDBBCh-YvvCxmt6Bc?usp=sharing
i had to do this modification to the code:
(although that might be an issue with the training script i was using)
"
Delete this line it is at line 1291 in C:\Users\Training\AppData\Local\Programs\Python\Python311\Lib\site-packages\unsloth\models\llama.py
"
for module in target_modules:
assert(module in accepted_modules)
pass
"
and lastly (
You will likely still need vs studio 2022
(don't forget the libraries available here https://github.com/wkpark/triton/releases/tag/llvm-build-for-win and honestly i would just add it into Nvidia computing folder, then add the bin folder inside that into your environment variables.
danielhanchen commentedon Mar 2, 2024
@NickWithBotronics Thanks :) Actually would you be interested in adding a section to our https://github.com/unslothai/unsloth/wiki on how to install it for Windows? :)
NicolasMejiaPetit commentedon Mar 2, 2024
Yeah I’d love to help in anyway I can, this repository is awesome!
danielhanchen commentedon Mar 3, 2024
@NickWithBotronics That'll be sick!! :) Actually unsure how editting wiki pages work lol
msamylea commentedon Mar 4, 2024
To add onto this - I ran into an issue on native windows with xformers when building unsloth, so I forked my own version and edited the pyproject.toml to use the xformers wheel for my python/torch/cuda, then built from source without any more issues: cu121onlytorch220 = [
"xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.24-cp39-cp39-manylinux2014_x86_64.whl ; python_version=='3.9'",
"xformers @ https://download.pytorch.org/whl/cu121/xformers-0.0.24-cp310-cp310-manylinux2014_x86_64.whl ; python_version=='3.10'",
"xformers @ https://files.pythonhosted.org/packages/02/10/aaa3b7547fec9e28948e723fb97585200a7070e810b4d1d0813fc1821690/xformers-0.0.24-cp311-cp311-win_amd64.whl ; python_version=='3.11'",
]
NicolasMejiaPetit commentedon Mar 5, 2024
Actually i do remember running into an xformers issue, i had ran 'pip install xformers' and pip found that 3.11 package for windows and installed it. Thanks for reporting! will include in the read me!
NicolasMejiaPetit commentedon Mar 5, 2024
Home.md
Cant create a pr since I'm not a contributor but here is the updated wiki with windows install instructions.
I don't have a gitlfs account to share the wheels at but if you would like to replace the link so its not a link to my google drive feel free.
NicolasMejiaPetit commentedon Mar 7, 2024
I fixed the read me to show how to fix xformers linux compatibility error.
Home.md
NicolasMejiaPetit commentedon Apr 5, 2024
Then the command prompt output should look like this:
Command-Prompt Output
-The back end of Deepspeed, uses Ninja mixed with c++ to compile kernels at run time, does this mess with unsloth idk? Either way it’s a easy install so just install it to be safe. ‘pip install ninja’
jjzhu0579 commentedon May 5, 2024
This link is empty
NicolasMejiaPetit commentedon May 5, 2024
Yeahhh, twitter aka X likes to change their links around like crazy. Use the instructions at the bottom of the read.md, they are more thorough than the twitter thread. And use the picture to see what to download for build tools.
Jiar commentedon Jun 4, 2024
Thank you for your contribution. At the same time, I also made a docker image that can directly use unsloth locally.
https://github.com/Jiar/jupyter4unsloth
pratmegs commentedon Aug 1, 2024
@NicolasMejiaPetit @danielhanchen Heyy!!! I actually ran into ModuleNotFoundError: No module named 'triton' while fine-tuning google/gemma-7b-it. I installed xformers successfully through a documentation that I found by Unsloth but while running From unsloth import FastLanguageModel I was thrown this error. I've been trying to solve this error quite sometime and can't seem to find any reddit or git solutions to this triton issue. Also I am working on windows 11.
the error kinda looks like this:
Traceback (most recent call last):
File "C:\Users\Megha\Gemma_DPO\sft_trainer.py", line 14, in
from unsloth import FastLanguageModel
File "C:\Users\Megha\Gemma_DPO\sanedai\Lib\site-packages\unsloth_init_.py", line 103, in
import triton
ModuleNotFoundError: No module named 'triton'
Please help I'm really stuck! Thanks in advance. Good day!
danielhanchen commentedon Aug 2, 2024
Ye it's best to follow the community guides posted here to install Unsloth on Windows - sadly I'm limited in bandwidth, so I can't yet "officially" support Windows yet
msamylea commentedon Aug 2, 2024
Make sure you're using the Triton wheel here, as the standard install isn't Windows compatible:
https://drive.google.com/drive/folders/1aWSFb-ZR8TTIDdRlDBBCh-YvvCxmt6Bc
nitinmukesh commentedon Oct 12, 2024
I know asking too much. A lot of AI tools need python 3.10 and not supported on higher versions.
If you get time need triton wheel for python 3.10.
jojje commentedon Nov 1, 2024
@NicolasMejiaPetit
Tested the wheel on a python 3.11 conda environment and it worked great.
There are two pre-reqs to using it though, to enable the required on-the-fly triton JIT compilation which unsloth via triton triggers when the trainer runs (trainer.train).
CC1 must be set to the exact valuecl. (*)When those two conditions are satisfied, your wheel works fine with the unsloth trainer.
I personally solved this little gotcha by having the following at the top of my training scripts or notebooks:
*) I asume you added the _cc_cmd function, since I can't find it in the triton repository's history. It's not part of 2.1.0.
The code in your build looks like this in contrast to upstream:
and
_cc_cmdmakes a hard assumption that CC is named "cl" exactly, as well as the MSVC environment being already initialized.shimmyshimmer commentedon Feb 28, 2025
Thanks to amazing contributors in #1841 you are now able to install Unsloth directly via Windows. Would anyone be kind enough to try it out and see if it works? Thank you!
msamylea commentedon Feb 28, 2025
I had to uninstall torch from the unsloth[windows] in my venv and reinstall using the pytorch page for my CUDA version, but after I did that, it's working. :)