Update README.md

This commit is contained in:
Daniel Han 2023-11-30 04:18:16 +11:00 committed by GitHub
commit 0004b4d1d7

View file

@ -1,34 +1,45 @@
# 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"`
# Installation Instructions
Unsloth currently only supports Linux* and Pytorch >= 2.1.
1. Find your CUDA version via
```
import torch; torch.version.cuda
```
2. For CUDA 11.8:
```
pip install "unsloth[cu118] @ git+https://github.com/unslothai/unsloth.git"
```
3. For CUDA 12.1:
```
pip install "unsloth[cu121] @ git+https://github.com/unslothai/unsloth.git"
```
### Google Colab examples
1. [Unsloth fast finetuning example](https://colab.research.google.com/drive/1oW55fBmwzCOrBVX66RcpptL3a99qWBxb?usp=sharing)
2. [Original slow finetuning example](https://colab.research.google.com/drive/1c7zxdLHaLJ9R9YTZ74y4tUERvS-kySyA?usp=sharing)
To update Pytorch to 2.1:
```
conda install cudatoolkit xformers bitsandbytes pytorch pytorch-cuda=12.1 \
-c pytorch -c nvidia -c xformers -c conda-forge -y
```
or
```
pip install --upgrade --force-reinstall --no-cache-dir torch triton \
--index-url https://download.pytorch.org/whl/cu121
```
Change `cu121` to `cu118` for CUDA version 11.8 or 12.1. Go to https://pytorch.org/ to learn more.
### Installation instructions
In Google Colab:
Then install Unsloth.
For Google Colab and Kaggle instances:
1. Try our Colab example:
2. Try our Kaggle example:
# Future Milestones
# Troubleshooting
1. Sometimes `bitsandbytes` or `xformers` does not link properly. Try running:
```
!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:
1. Install Xformers *OR* Flash Attention. Choose 1. Old GPUs use Xformers. New use Flash Attention.
2. For Xformers, find your Pytorch CUDA version via `torch.version.cuda` or `nvidia-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).
3. 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 ninja` then `pip install flash-attn --no-build-isolation`.
* Xformers has native support for Flash Attention, so technically installing Xformers is enough.
4. Then install Unsloth:
`pip install git+https://github.com/danielhanchen/unsloth.git`
2. Windows is not supported as of yet - we rely on Xformers and Triton support, so until both packages support Windows officially, Unsloth will then support Windows.