Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'triton' #964

Closed
boseong-yun opened this issue Aug 27, 2024 · 5 comments
Closed

ModuleNotFoundError: No module named 'triton' #964

boseong-yun opened this issue Aug 27, 2024 · 5 comments
Labels
fixed - pending confirmation Fixed, waiting for confirmation from poster URGENT BUG Urgent bug

Comments

@boseong-yun
Copy link

I have been using the codes for a while (at least a week ago), and I can no longer import the module. There seem to be other people experiencing the same issues, but was not sure whether this problem was exactly the same. Sorry if this is a repeat. Here are the details:

After running the following (directly copied from your example code):

%%capture
# Installs Unsloth, Xformers (Flash Attention) and all other packages!
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
!pip install --no-deps "xformers<0.0.27" "trl<0.9.0" peft accelerate bitsandbytes

The following code chunk throws the error

Code:

from unsloth import FastLanguageModel

Errror:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
[<ipython-input-15-ff6398fc40c7>](https://localhost:8080/#) in <cell line: 1>()
----> 1 from unsloth import FastLanguageModel

[/usr/local/lib/python3.10/dist-packages/unsloth/__init__.py](https://localhost:8080/#) in <module>
     97 import bitsandbytes as bnb
     98 
---> 99 import triton
    100 libcuda_dirs = lambda: None
    101 if Version(triton.__version__) >= Version("3.0.0"):

ModuleNotFoundError: No module named 'triton'

---------------------------------------------------------------------------
@boseong-yun boseong-yun changed the title Module Not Found Error: Llama 3 - 8b model Module Not Found Error (triton): Llama 3 - 8b model Aug 27, 2024
@danielhanchen
Copy link
Contributor

Apologies on the issue!
Colab just updated to torch 2.4 - please change the top installation cell to

%%capture
# Installs Unsloth, Xformers (Flash Attention) and all other packages!
!pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"

# We have to check which Torch version for Xformers (2.3 -> 0.0.27)
from torch import __version__; from packaging.version import Version as V
xformers = "xformers==0.0.27" if V(__version__) < V("2.4.0") else "xformers"
!pip install --no-deps {xformers} trl peft accelerate bitsandbytes triton

@danielhanchen danielhanchen added fixed - pending confirmation Fixed, waiting for confirmation from poster URGENT BUG Urgent bug labels Aug 27, 2024
@danielhanchen danielhanchen pinned this issue Aug 27, 2024
@danielhanchen danielhanchen changed the title Module Not Found Error (triton): Llama 3 - 8b model Module Not Found Error (triton) Aug 27, 2024
@danielhanchen danielhanchen changed the title Module Not Found Error (triton) ModuleNotFoundError: No module named 'triton' Aug 27, 2024
@boseong-yun
Copy link
Author

Works fine! Thank you for your prompt help.

@unslothai unslothai deleted a comment Aug 28, 2024
@patruff
Copy link

patruff commented Sep 6, 2024

Had same issue thanks for the fix

@kebbbnnn
Copy link

Thanks for this! Though it spewed a different error when I first applied the fix in my colab notebook, deleting the runtime and connecting to it again fixed it.

@danielhanchen
Copy link
Contributor

No problems and sorry again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed - pending confirmation Fixed, waiting for confirmation from poster URGENT BUG Urgent bug
Projects
None yet
Development

No branches or pull requests

6 participants
@kebbbnnn @patruff @danielhanchen @boseong-yun and others