mirror of
https://github.com/unslothai/unsloth.git
synced 2026-07-09 15:58:41 +00:00
mirror of https://github.com/unslothai/unsloth
agentaideepseekdeepseek-r1fine-tuninggemmagemma3llamallama3llmllmsloramistralopenaipytorchqwenqwen3text-to-speechttsunsloth
| unsloth | ||
| .gitignore | ||
| LICENSE | ||
| pyproject.toml | ||
| README.md | ||
| requirements_cu118.txt | ||
| requirements_cu121.txt | ||
Unsloth
2x faster 50% less memory LLM finetuning on a single GPU.
!pip install "unsloth[cu118] @ git+https://github.com/unslothai/unsloth.git"
!pip install "unsloth[cu121] @ git+https://github.com/unslothai/unsloth.git"
Google Colab examples
Installation instructions
In Google Colab:
!ldconfig /usr/lib64-nvidia
!pip install xformers --index-url https://download.pytorch.org/whl/cu118
!pip install git+https://github.com/danielhanchen/unsloth.git
!ldconfig /usr/lib64-nvidia is necessary (for now) to link CUDA with Python. Possibly a Google Colab linking bug.
For general installations:
- Install Xformers OR Flash Attention. Choose 1. Old GPUs use Xformers. New use Flash Attention.
- For Xformers, find your Pytorch CUDA version via
torch.version.cudaornvidia-smi.- If you have Conda,
conda install xformers -c xformers - If you have CUDA 11.8,
pip install xformers --index-url https://download.pytorch.org/whl/cu118 - If you have CUDA 12.1,
pip install xformers --index-url https://download.pytorch.org/whl/cu121 - Go to https://github.com/facebookresearch/xformers for other issues.
- You must have Pytorch 2.1 installed for Xformers. If not, try Flash Attention.
- Xformers supports all GPUs (Tesla T4 etc).
- If you have Conda,
- For Flash Attention, you must have a Ampere, Ada, Hopper GPU (A100, RTX 3090, RTX 4090, H100).
- Install Flash Attention via
pip uninstall -y ninja && pip install ninjathenpip install flash-attn --no-build-isolation. - Xformers has native support for Flash Attention, so technically installing Xformers is enough.
- Install Flash Attention via
- Then install Unsloth:
pip install git+https://github.com/danielhanchen/unsloth.git