832 lines
38 KiB
Markdown
832 lines
38 KiB
Markdown
<div align="center">
|
|
|
|
<a href="https://unsloth.ai"><picture>
|
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20logo%20white%20text.png">
|
|
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20logo%20black%20text.png">
|
|
<img alt="unsloth logo" src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20logo%20black%20text.png" height="110" style="max-width: 100%;">
|
|
</picture></a>
|
|
|
|
<a href="https://colab.research.google.com/drive/1Ys44kVvmeZtnICzWz0xgpRnrIOjZAuxp?usp=sharing"><img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/start free finetune button.png" height="48"></a>
|
|
<a href="https://discord.gg/unsloth"><img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/Discord button.png" height="48"></a>
|
|
<a href="https://ko-fi.com/unsloth"><img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/buy me a coffee button.png" height="48"></a>
|
|
|
|
### Finetune Llama 3.1, Mistral, Phi-3 & Gemma 2-5x faster with 80% less memory!
|
|
|
|

|
|
|
|
</div>
|
|
|
|
## ✨ Finetune for Free
|
|
|
|
All notebooks are **beginner friendly**! Add your dataset, click "Run All", and you'll get a 2x faster finetuned model which can be exported to GGUF, Ollama, vLLM or uploaded to Hugging Face.
|
|
|
|
| Unsloth supports | Free Notebooks | Performance | Memory use |
|
|
|-----------|---------|--------|----------|
|
|
| **Llama 3.1 (8B)** | [▶️ Start for free](https://colab.research.google.com/drive/1Ys44kVvmeZtnICzWz0xgpRnrIOjZAuxp?usp=sharing) | 2x faster | 60% less |
|
|
| **Mistral Nemo (12B)** | [▶️ Start for free](https://colab.research.google.com/drive/17d3U-CAIwzmbDRqbZ9NnpHxCkmXB6LZ0?usp=sharing) | 2x faster | 60% less |
|
|
| **Gemma 2 (9B)** | [▶️ Start for free](https://colab.research.google.com/drive/1vIrqH5uYDQwsJ4-OO3DErvuv4pBgVwk4?usp=sharing) | 2x faster | 63% less |
|
|
| **Phi-3 (mini)** | [▶️ Start for free](https://colab.research.google.com/drive/1lN6hPQveB_mHSnTOYifygFcrO8C1bxq4?usp=sharing) | 2x faster | 50% less |
|
|
| **Ollama** | [▶️ Start for free](https://colab.research.google.com/drive/1WZDi7APtQ9VsvOrQSSC5DDtxq159j8iZ?usp=sharing) | 1.9x faster | 43% less |
|
|
| **Mistral v0.3 (7B)** | [▶️ Start for free](https://colab.research.google.com/drive/1_yNCks4BTD5zOnjozppphh5GzMFaMKq_?usp=sharing) | 2.2x faster | 73% less |
|
|
| **ORPO** | [▶️ Start for free](https://colab.research.google.com/drive/11t4njE3c4Lxl-07OD8lJSMKkfyJml3Tn?usp=sharing) | 1.9x faster | 43% less |
|
|
| **DPO Zephyr** | [▶️ Start for free](https://colab.research.google.com/drive/15vttTpzzVXv_tJwEk-hIcQ0S9FcEWvwP?usp=sharing) | 1.9x faster | 43% less |
|
|
| **TinyLlama** | [▶️ Start for free](https://colab.research.google.com/drive/1AZghoNBQaMDgWJpi4RbffGM1h6raLUj9?usp=sharing) | 3.9x faster | 74% less |
|
|
|
|
- **Kaggle Notebooks** for [Llama 3.1 (8B)](https://www.kaggle.com/danielhanchen/kaggle-llama-3-1-8b-unsloth-notebook), [Gemma 2 (9B)](https://www.kaggle.com/code/danielhanchen/kaggle-gemma-7b-unsloth-notebook/), [Mistral (7B)](https://www.kaggle.com/code/danielhanchen/kaggle-mistral-7b-unsloth-notebook)
|
|
- Run [Llama 3 conversational notebook](https://colab.research.google.com/drive/1XamvWYinY6FOSX9GLvnqSjjsNflxdhNc?usp=sharing) and [Mistral v0.3 ChatML](https://colab.research.google.com/drive/15F1xyn8497_dUbxZP4zWmPZ3PJx1Oymv?usp=sharing)
|
|
- This [text completion notebook](https://colab.research.google.com/drive/1ef-tab5bhkvWmBOObepl1WgJvfvSzn5Q?usp=sharing) is for continued pretraining / raw text
|
|
- This [continued pretraining notebook](https://colab.research.google.com/drive/1tEd1FrOXWMnCU9UIvdYhs61tkxdMuKZu?usp=sharing) is for learning another language
|
|
- Click [here](https://github.com/unslothai/unsloth/wiki) for detailed documentation for Unsloth.
|
|
|
|
## 🦥 Unsloth.ai News
|
|
- 📣 NEW! [Gemma-2-2b](https://colab.research.google.com/drive/1weTpKOjBZxZJ5PQ-Ql8i6ptAY2x-FWVA?usp=sharing) now supported! Gemma-2-9b and Gemma-2-27b are alrady supported! And uploaded [GGUF quants](https://huggingface.co/unsloth/gemma-2-it-GGUF) Try out [Chat interface](https://colab.research.google.com/drive/1i-8ESvtLRGNkkUQQr_-z_rcSAIo9c3lM?usp=sharing) for Gemma-2-2b Instruct!
|
|
- 📣 NEW! [Llama 3.1 8b, 70b](https://colab.research.google.com/drive/1Ys44kVvmeZtnICzWz0xgpRnrIOjZAuxp?usp=sharing) both Base and Instruct now supported
|
|
- 📣 NEW! [Mistral Nemo-12b](https://colab.research.google.com/drive/17d3U-CAIwzmbDRqbZ9NnpHxCkmXB6LZ0?usp=sharing) both Base and Instruct now supported
|
|
- 📣 NEW! [Gemma-2-9b](https://colab.research.google.com/drive/1vIrqH5uYDQwsJ4-OO3DErvuv4pBgVwk4?usp=sharing) and Gemma-2-27b now supported
|
|
- 📣 UPDATE! [Phi-3 mini](https://colab.research.google.com/drive/1hhdhBa1j_hsymiW9m-WzxQtgqTH_NHqi?usp=sharing) model updated. [Phi-3 Medium](https://colab.research.google.com/drive/1hhdhBa1j_hsymiW9m-WzxQtgqTH_NHqi?usp=sharing) 2x faster finetuning.
|
|
- 📣 NEW! Continued Pretraining [notebook](https://colab.research.google.com/drive/1tEd1FrOXWMnCU9UIvdYhs61tkxdMuKZu?usp=sharing) for other languages like Korean!
|
|
- 📣 NEW! Qwen2 now works
|
|
- 📣 [Mistral v0.3 Base](https://colab.research.google.com/drive/1_yNCks4BTD5zOnjozppphh5GzMFaMKq_?usp=sharing) and [Mistral v0.3 Instruct]
|
|
- 📣 [ORPO support](https://colab.research.google.com/drive/11t4njE3c4Lxl-07OD8lJSMKkfyJml3Tn?usp=sharing) is here + [2x faster inference](https://colab.research.google.com/drive/1aqlNQi7MMJbynFDyOQteD2t0yVfjb9Zh?usp=sharing) added for all our models
|
|
- 📣 We cut memory usage by a [further 30%](https://unsloth.ai/blog/long-context) and now support [4x longer context windows](https://unsloth.ai/blog/long-context)!
|
|
|
|
## 🔗 Links and Resources
|
|
| Type | Links |
|
|
| ------------------------------- | --------------------------------------- |
|
|
| 📚 **Documentation & Wiki** | [Read Our Wiki](https://github.com/unslothai/unsloth/wiki) |
|
|
| <img height="14" src="https://upload.wikimedia.org/wikipedia/commons/6/6f/Logo_of_Twitter.svg" /> **Twitter (aka X)** | [Follow us on X](https://twitter.com/unslothai)|
|
|
| 💾 **Installation** | [unsloth/README.md](https://github.com/unslothai/unsloth/tree/main#installation-instructions)|
|
|
| 🥇 **Benchmarking** | [Performance Tables](https://github.com/unslothai/unsloth/tree/main#-performance-benchmarking)
|
|
| 🌐 **Released Models** | [Unsloth Releases](https://huggingface.co/unsloth)|
|
|
| ✍️ **Blog** | [Read our Blogs](https://unsloth.ai/blog)|
|
|
|
|
## ⭐ Key Features
|
|
- All kernels written in [OpenAI's Triton](https://openai.com/research/triton) language. **Manual backprop engine**.
|
|
- **0% loss in accuracy** - no approximation methods - all exact.
|
|
- No change of hardware. Supports NVIDIA GPUs since 2018+. Minimum CUDA Capability 7.0 (V100, T4, Titan V, RTX 20, 30, 40x, A100, H100, L40 etc) [Check your GPU!](https://developer.nvidia.com/cuda-gpus) GTX 1070, 1080 works, but is slow.
|
|
- Works on **Linux** and **Windows** via WSL.
|
|
- Supports 4bit and 16bit QLoRA / LoRA finetuning via [bitsandbytes](https://github.com/TimDettmers/bitsandbytes).
|
|
- Open source trains 5x faster - see [Unsloth Pro](https://unsloth.ai/) for up to **30x faster training**!
|
|
- If you trained a model with 🦥Unsloth, you can use this cool sticker! <img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/made with unsloth.png" height="50" align="center" />
|
|
|
|
|
|
## 🥇 Performance Benchmarking
|
|
- For the full list of **reproducible** benchmarking tables, [go to our website](https://unsloth.ai/blog/mistral-benchmark#Benchmark%20tables)
|
|
|
|
| 1 A100 40GB | 🤗Hugging Face | Flash Attention | 🦥Unsloth Open Source | 🦥[Unsloth Pro](https://unsloth.ai/pricing) |
|
|
|--------------|--------------|-----------------|---------------------|-----------------|
|
|
| Alpaca | 1x | 1.04x | 1.98x | **15.64x** |
|
|
| LAION Chip2 | 1x | 0.92x | 1.61x | **20.73x** |
|
|
| OASST | 1x | 1.19x | 2.17x | **14.83x** |
|
|
| Slim Orca | 1x | 1.18x | 2.22x | **14.82x** |
|
|
|
|
- Benchmarking table below was conducted by [🤗Hugging Face](https://huggingface.co/blog/unsloth-trl).
|
|
|
|
| Free Colab T4 | Dataset | 🤗Hugging Face | Pytorch 2.1.1 | 🦥Unsloth | 🦥 VRAM reduction |
|
|
| --- | --- | --- | --- | --- | --- |
|
|
| Llama-2 7b | OASST | 1x | 1.19x | 1.95x | -43.3% |
|
|
| Mistral 7b | Alpaca | 1x | 1.07x | 1.56x | -13.7% |
|
|
| Tiny Llama 1.1b | Alpaca | 1x | 2.06x | 3.87x | -73.8% |
|
|
| DPO with Zephyr | Ultra Chat | 1x | 1.09x | 1.55x | -18.6% |
|
|
|
|

|
|
|
|
## 💾 Installation Instructions
|
|
### Conda Installation
|
|
Select either `pytorch-cuda=11.8` for CUDA 11.8 or `pytorch-cuda=12.1` for CUDA 12.1. If you have `mamba`, use `mamba` instead of `conda` for faster solving. See this [Github issue](https://github.com/unslothai/unsloth/issues/73) for help on debugging Conda installs.
|
|
```bash
|
|
conda create --name unsloth_env \
|
|
python=3.10 \
|
|
pytorch-cuda=<11.8/12.1> \
|
|
pytorch cudatoolkit xformers -c pytorch -c nvidia -c xformers \
|
|
-y
|
|
conda activate unsloth_env
|
|
|
|
pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
|
|
|
|
pip install --no-deps "trl<0.9.0" peft accelerate bitsandbytes
|
|
```
|
|
|
|
### Pip Installation
|
|
Do **NOT** use this if you have Anaconda. You must use the Conda install method, or else stuff will BREAK.
|
|
|
|
1. Find your CUDA version via
|
|
```python
|
|
import torch; torch.version.cuda
|
|
```
|
|
2. For Pytorch 2.1.0: You can update Pytorch via Pip (interchange `cu121` / `cu118`). Go to https://pytorch.org/ to learn more. Select either `cu118` for CUDA 11.8 or `cu121` for CUDA 12.1. If you have a RTX 3060 or higher (A100, H100 etc), use the `"ampere"` path. For Pytorch 2.1.1: go to step 3. For Pytorch 2.2.0: go to step 4.
|
|
```bash
|
|
pip install --upgrade --force-reinstall --no-cache-dir torch==2.1.0 triton \
|
|
--index-url https://download.pytorch.org/whl/cu121
|
|
```
|
|
```bash
|
|
pip install "unsloth[cu118] @ git+https://github.com/unslothai/unsloth.git"
|
|
pip install "unsloth[cu121] @ git+https://github.com/unslothai/unsloth.git"
|
|
pip install "unsloth[cu118-ampere] @ git+https://github.com/unslothai/unsloth.git"
|
|
pip install "unsloth[cu121-ampere] @ git+https://github.com/unslothai/unsloth.git"
|
|
```
|
|
3. For Pytorch 2.1.1: Use the `"ampere"` path for newer RTX 30xx GPUs or higher.
|
|
```bash
|
|
pip install --upgrade --force-reinstall --no-cache-dir torch==2.1.1 triton \
|
|
--index-url https://download.pytorch.org/whl/cu121
|
|
```
|
|
```bash
|
|
pip install "unsloth[cu118-torch211] @ git+https://github.com/unslothai/unsloth.git"
|
|
pip install "unsloth[cu121-torch211] @ git+https://github.com/unslothai/unsloth.git"
|
|
pip install "unsloth[cu118-ampere-torch211] @ git+https://github.com/unslothai/unsloth.git"
|
|
pip install "unsloth[cu121-ampere-torch211] @ git+https://github.com/unslothai/unsloth.git"
|
|
```
|
|
4. For Pytorch 2.2.0: Use the `"ampere"` path for newer RTX 30xx GPUs or higher.
|
|
```bash
|
|
pip install --upgrade --force-reinstall --no-cache-dir torch==2.2.0 triton \
|
|
--index-url https://download.pytorch.org/whl/cu121
|
|
```
|
|
```bash
|
|
pip install "unsloth[cu118-torch220] @ git+https://github.com/unslothai/unsloth.git"
|
|
pip install "unsloth[cu121-torch220] @ git+https://github.com/unslothai/unsloth.git"
|
|
pip install "unsloth[cu118-ampere-torch220] @ git+https://github.com/unslothai/unsloth.git"
|
|
pip install "unsloth[cu121-ampere-torch220] @ git+https://github.com/unslothai/unsloth.git"
|
|
```
|
|
5. If you get errors, try the below first, then go back to step 1:
|
|
```bash
|
|
pip install --upgrade pip
|
|
```
|
|
6. For Pytorch 2.2.1:
|
|
```bash
|
|
# RTX 3090, 4090 Ampere GPUs:
|
|
pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
|
|
pip install --no-deps packaging ninja einops flash-attn xformers trl peft accelerate bitsandbytes
|
|
|
|
# Pre Ampere RTX 2080, T4, GTX 1080 GPUs:
|
|
pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
|
|
pip install --no-deps xformers "trl<0.9.0" peft accelerate bitsandbytes
|
|
```
|
|
7. For Pytorch 2.3.0: Use the `"ampere"` path for newer RTX 30xx GPUs or higher.
|
|
```bash
|
|
pip install "unsloth[cu118-torch230] @ git+https://github.com/unslothai/unsloth.git"
|
|
pip install "unsloth[cu121-torch230] @ git+https://github.com/unslothai/unsloth.git"
|
|
pip install "unsloth[cu118-ampere-torch230] @ git+https://github.com/unslothai/unsloth.git"
|
|
pip install "unsloth[cu121-ampere-torch230] @ git+https://github.com/unslothai/unsloth.git"
|
|
```
|
|
8. To troubleshoot installs try the below (all must succeed). Xformers should mostly all be available.
|
|
```bash
|
|
nvcc
|
|
python -m xformers.info
|
|
python -m bitsandbytes
|
|
```
|
|
|
|
## 📜 Documentation
|
|
- Go to our [Wiki page](https://github.com/unslothai/unsloth/wiki) for saving to GGUF, checkpointing, evaluation and more!
|
|
- We support Huggingface's TRL, Trainer, Seq2SeqTrainer or even Pytorch code!
|
|
- We're in 🤗Hugging Face's official docs! Check out the [SFT docs](https://huggingface.co/docs/trl/main/en/sft_trainer#accelerate-fine-tuning-2x-using-unsloth) and [DPO docs](https://huggingface.co/docs/trl/main/en/dpo_trainer#accelerate-dpo-fine-tuning-using-unsloth)!
|
|
|
|
```python
|
|
from unsloth import FastLanguageModel
|
|
from unsloth import is_bfloat16_supported
|
|
import torch
|
|
from trl import SFTTrainer
|
|
from transformers import TrainingArguments
|
|
from datasets import load_dataset
|
|
max_seq_length = 2048 # Supports RoPE Scaling interally, so choose any!
|
|
# Get LAION dataset
|
|
url = "https://huggingface.co/datasets/laion/OIG/resolve/main/unified_chip2.jsonl"
|
|
dataset = load_dataset("json", data_files = {"train" : url}, split = "train")
|
|
|
|
# 4bit pre quantized models we support for 4x faster downloading + no OOMs.
|
|
fourbit_models = [
|
|
"unsloth/mistral-7b-v0.3-bnb-4bit", # New Mistral v3 2x faster!
|
|
"unsloth/mistral-7b-instruct-v0.3-bnb-4bit",
|
|
"unsloth/llama-3-8b-bnb-4bit", # Llama-3 15 trillion tokens model 2x faster!
|
|
"unsloth/llama-3-8b-Instruct-bnb-4bit",
|
|
"unsloth/llama-3-70b-bnb-4bit",
|
|
"unsloth/Phi-3-mini-4k-instruct", # Phi-3 2x faster!
|
|
"unsloth/Phi-3-medium-4k-instruct",
|
|
"unsloth/mistral-7b-bnb-4bit",
|
|
"unsloth/gemma-7b-bnb-4bit", # Gemma 2.2x faster!
|
|
] # More models at https://huggingface.co/unsloth
|
|
|
|
model, tokenizer = FastLanguageModel.from_pretrained(
|
|
model_name = "unsloth/llama-3-8b-bnb-4bit",
|
|
max_seq_length = max_seq_length,
|
|
dtype = None,
|
|
load_in_4bit = True,
|
|
)
|
|
|
|
# Do model patching and add fast LoRA weights
|
|
model = FastLanguageModel.get_peft_model(
|
|
model,
|
|
r = 16,
|
|
target_modules = ["q_proj", "k_proj", "v_proj", "o_proj",
|
|
"gate_proj", "up_proj", "down_proj",],
|
|
lora_alpha = 16,
|
|
lora_dropout = 0, # Supports any, but = 0 is optimized
|
|
bias = "none", # Supports any, but = "none" is optimized
|
|
# [NEW] "unsloth" uses 30% less VRAM, fits 2x larger batch sizes!
|
|
use_gradient_checkpointing = "unsloth", # True or "unsloth" for very long context
|
|
random_state = 3407,
|
|
max_seq_length = max_seq_length,
|
|
use_rslora = False, # We support rank stabilized LoRA
|
|
loftq_config = None, # And LoftQ
|
|
)
|
|
|
|
trainer = SFTTrainer(
|
|
model = model,
|
|
train_dataset = dataset,
|
|
dataset_text_field = "text",
|
|
max_seq_length = max_seq_length,
|
|
tokenizer = tokenizer,
|
|
args = TrainingArguments(
|
|
per_device_train_batch_size = 2,
|
|
gradient_accumulation_steps = 4,
|
|
warmup_steps = 10,
|
|
max_steps = 60,
|
|
fp16 = not is_bfloat16_supported(),
|
|
bf16 = is_bfloat16_supported(),
|
|
logging_steps = 1,
|
|
output_dir = "outputs",
|
|
optim = "adamw_8bit",
|
|
seed = 3407,
|
|
),
|
|
)
|
|
trainer.train()
|
|
|
|
# Go to https://github.com/unslothai/unsloth/wiki for advanced tips like
|
|
# (1) Saving to GGUF / merging to 16bit for vLLM
|
|
# (2) Continued training from a saved LoRA adapter
|
|
# (3) Adding an evaluation loop / OOMs
|
|
# (4) Customized chat templates
|
|
```
|
|
|
|
<a name="DPO"></a>
|
|
## DPO Support
|
|
DPO (Direct Preference Optimization), PPO, Reward Modelling all seem to work as per 3rd party independent testing from [Llama-Factory](https://github.com/hiyouga/LLaMA-Factory). We have a preliminary Google Colab notebook for reproducing Zephyr on Tesla T4 here: [notebook](https://colab.research.google.com/drive/15vttTpzzVXv_tJwEk-hIcQ0S9FcEWvwP?usp=sharing).
|
|
|
|
We're in 🤗Hugging Face's official docs! We're on the [SFT docs](https://huggingface.co/docs/trl/main/en/sft_trainer#accelerate-fine-tuning-2x-using-unsloth) and the [DPO docs](https://huggingface.co/docs/trl/main/en/dpo_trainer#accelerate-dpo-fine-tuning-using-unsloth)!
|
|
|
|
```python
|
|
from unsloth import FastLanguageModel, PatchDPOTrainer
|
|
from unsloth import is_bfloat16_supported
|
|
PatchDPOTrainer()
|
|
import torch
|
|
from transformers import TrainingArguments
|
|
from trl import DPOTrainer
|
|
|
|
model, tokenizer = FastLanguageModel.from_pretrained(
|
|
model_name = "unsloth/zephyr-sft-bnb-4bit",
|
|
max_seq_length = max_seq_length,
|
|
dtype = None,
|
|
load_in_4bit = True,
|
|
)
|
|
|
|
# Do model patching and add fast LoRA weights
|
|
model = FastLanguageModel.get_peft_model(
|
|
model,
|
|
r = 64,
|
|
target_modules = ["q_proj", "k_proj", "v_proj", "o_proj",
|
|
"gate_proj", "up_proj", "down_proj",],
|
|
lora_alpha = 64,
|
|
lora_dropout = 0, # Supports any, but = 0 is optimized
|
|
bias = "none", # Supports any, but = "none" is optimized
|
|
# [NEW] "unsloth" uses 30% less VRAM, fits 2x larger batch sizes!
|
|
use_gradient_checkpointing = "unsloth", # True or "unsloth" for very long context
|
|
random_state = 3407,
|
|
max_seq_length = max_seq_length,
|
|
)
|
|
|
|
dpo_trainer = DPOTrainer(
|
|
model = model,
|
|
ref_model = None,
|
|
args = TrainingArguments(
|
|
per_device_train_batch_size = 4,
|
|
gradient_accumulation_steps = 8,
|
|
warmup_ratio = 0.1,
|
|
num_train_epochs = 3,
|
|
fp16 = not is_bfloat16_supported(),
|
|
bf16 = is_bfloat16_supported(),
|
|
logging_steps = 1,
|
|
optim = "adamw_8bit",
|
|
seed = 42,
|
|
output_dir = "outputs",
|
|
),
|
|
beta = 0.1,
|
|
train_dataset = YOUR_DATASET_HERE,
|
|
# eval_dataset = YOUR_DATASET_HERE,
|
|
tokenizer = tokenizer,
|
|
max_length = 1024,
|
|
max_prompt_length = 512,
|
|
)
|
|
dpo_trainer.train()
|
|
```
|
|
|
|
## 🥇 Detailed Benchmarking Tables
|
|
- Click "Code" for fully reproducible examples
|
|
- "Unsloth Equal" is a preview of our PRO version, with code stripped out. All settings and the loss curve remains identical.
|
|
- For the full list of benchmarking tables, [go to our website](https://unsloth.ai/blog/mistral-benchmark#Benchmark%20tables)
|
|
|
|
| 1 A100 40GB | 🤗Hugging Face | Flash Attention 2 | 🦥Unsloth Open | Unsloth Equal | Unsloth Pro | Unsloth Max |
|
|
|--------------|-------------|-------------|-----------------|--------------|---------------|-------------|
|
|
| Alpaca | 1x | 1.04x | 1.98x | 2.48x | 5.32x | **15.64x** |
|
|
| code | [Code](https://colab.research.google.com/drive/1u4dBeM-0vGNVmmO6X7cScAut-Hyt4KDF?usp=sharing) | [Code](https://colab.research.google.com/drive/1fgTOxpMbVjloQBvZyz4lF4BacKSZOB2A?usp=sharing) | [Code](https://colab.research.google.com/drive/1YIPY_18xm-K0iJDgvNkRoJsgkPMPAO3G?usp=sharing) | [Code](https://colab.research.google.com/drive/1ANW8EFL3LVyTD7Gq4TkheC1Z7Rxw-rHp?usp=sharing) | | |
|
|
| seconds| 1040 | 1001 | 525 | 419 | 196 | 67 |
|
|
| memory MB| 18235 | 15365 | 9631 | 8525 | | |
|
|
| % saved| | 15.74 | 47.18 | 53.25 | | | |
|
|
|
|
### Llama-Factory 3rd party benchmarking
|
|
- [Link to performance table.](https://github.com/hiyouga/LLaMA-Factory/wiki/Performance-Comparison) TGS: tokens per GPU per second. Model: LLaMA2-7B. GPU: NVIDIA A100 * 1. Batch size: 4. Gradient accumulation: 2. LoRA rank: 8. Max length: 1024.
|
|
|
|
| Method | Bits | TGS | GRAM | Speed |
|
|
| --- | --- | --- | --- | --- |
|
|
| HF | 16 | 2392 | 18GB | 100% |
|
|
| HF+FA2 | 16 | 2954 | 17GB | 123% |
|
|
| Unsloth+FA2 | 16 | 4007 | 16GB | **168%** |
|
|
| HF | 4 | 2415 | 9GB | 101% |
|
|
| Unsloth+FA2 | 4 | 3726 | 7GB | **160%** |
|
|
|
|
### Performance comparisons between popular models
|
|
<details>
|
|
<summary>Click for specific model benchmarking tables (Mistral 7b, CodeLlama 34b etc.)</summary>
|
|
|
|
### Mistral 7b
|
|
| 1 A100 40GB | Hugging Face | Flash Attention 2 | Unsloth Open | Unsloth Equal | Unsloth Pro | Unsloth Max |
|
|
|--------------|-------------|-------------|-----------------|--------------|---------------|-------------|
|
|
| Mistral 7B Slim Orca | 1x | 1.15x | 2.15x | 2.53x | 4.61x | **13.69x** |
|
|
| code | [Code](https://colab.research.google.com/drive/1mePk3KzwTD81hr5mcNcs_AX3Kbg_Ha0x?usp=sharing) | [Code](https://colab.research.google.com/drive/1dgHxjvTmX6hb0bPcLp26RXSE6_n9DKj7?usp=sharing) | [Code](https://colab.research.google.com/drive/1SKrKGV-BZoU4kv5q3g0jtE_OhRgPtrrQ?usp=sharing) | [Code](https://colab.research.google.com/drive/18yOiyX0T81mTwZqOALFSCX_tSAqju6aD?usp=sharing) | |
|
|
| seconds | 1813 | 1571 | 842 | 718 | 393 | 132 |
|
|
| memory MB | 32853 | 19385 | 12465 | 10271 | | |
|
|
| % saved| | 40.99 | 62.06 | 68.74 | | |
|
|
|
|
### CodeLlama 34b
|
|
| 1 A100 40GB | Hugging Face | Flash Attention 2 | Unsloth Open | Unsloth Equal | Unsloth Pro | Unsloth Max |
|
|
|--------------|-------------|-------------|-----------------|--------------|---------------|-------------|
|
|
| Code Llama 34B | OOM ❌ | 0.99x | 1.87x | 2.61x | 4.27x | 12.82x |
|
|
| code | [▶️ Code](https://colab.research.google.com/drive/1ykfz3BqrtC_AUFegCzUQjjfUNlxp6Otc?usp=sharing) | [Code](https://colab.research.google.com/drive/12ZypxQh7OC6kBXvWZI-5d05I4m-B_hoR?usp=sharing) | [Code](https://colab.research.google.com/drive/1gdHyAx8XJsz2yNV-DHvbHjR1iCef5Qmh?usp=sharing) | [Code](https://colab.research.google.com/drive/1fm7wqx9MJ0kRrwKOfmLkK1Rmw-pySahB?usp=sharing) | |
|
|
| seconds | 1953 | 1982 | 1043 | 748 | 458 | 152 |
|
|
| memory MB | 40000 | 33217 | 27413 | 22161 | | |
|
|
| % saved| | 16.96| 31.47 | 44.60 | | | |
|
|
|
|
### 1 Tesla T4
|
|
|
|
| 1 T4 16GB | Hugging Face | Flash Attention | Unsloth Open | Unsloth Pro Equal | Unsloth Pro | Unsloth Max |
|
|
|--------------|-------------|-----------------|-----------------|---------------|---------------|-------------|
|
|
| Alpaca | 1x | 1.09x | 1.69x | 1.79x | 2.93x | **8.3x** |
|
|
| code | [▶️ Code](https://colab.research.google.com/drive/1XpLIV4s8Bj5uryB-X2gqM88oRGHEGdaB?usp=sharing) | [Code](https://colab.research.google.com/drive/1LyXu6CjuymQg6ddHX8g1dpUvrMa1nn4L?usp=sharing) | [Code](https://colab.research.google.com/drive/1gsv4LpY7C32otl1rgRo5wXTk4HIitXoM?usp=sharing) | [Code](https://colab.research.google.com/drive/1VtULwRQwhEnVdNryjm27zXfdSM1tNfFK?usp=sharing) | | |
|
|
| seconds | 1599 | 1468 | 942 | 894 | 545 | 193 |
|
|
| memory MB | 7199 | 7059 | 6459 | 5443 | | |
|
|
| % saved | | 1.94 | 10.28 | 24.39 | | |
|
|
|
|
### 2 Tesla T4s via DDP
|
|
|
|
| 2 T4 DDP | Hugging Face | Flash Attention | Unsloth Open | Unsloth Equal | Unsloth Pro | Unsloth Max |
|
|
|--------------|----------|-------------|-----------------|--------------|---------------|-------------|
|
|
| Alpaca | 1x | 0.99x | 4.95x | 4.44x | 7.28x | **20.61x** |
|
|
| code | [▶️ Code](https://www.kaggle.com/danielhanchen/hf-original-alpaca-t4-ddp) | [Code](https://www.kaggle.com/danielhanchen/hf-sdpa-alpaca-t4-ddp) | [Code](https://www.kaggle.com/danielhanchen/unsloth-alpaca-t4-ddp) | | |
|
|
| seconds | 9882 | 9946 | 1996 | 2227 | 1357 | 480 |
|
|
| memory MB| 9176 | 9128 | 6904 | 6782 | | |
|
|
| % saved | | 0.52 | 24.76 | 26.09 | | | |
|
|
</details>
|
|
|
|
### Performance comparisons on 1 Tesla T4 GPU:
|
|
<details>
|
|
<summary>Click for Time taken for 1 epoch</summary>
|
|
|
|
One Tesla T4 on Google Colab
|
|
`bsz = 2, ga = 4, max_grad_norm = 0.3, num_train_epochs = 1, seed = 3047, lr = 2e-4, wd = 0.01, optim = "adamw_8bit", schedule = "linear", schedule_steps = 10`
|
|
|
|
| System | GPU | Alpaca (52K) | LAION OIG (210K) | Open Assistant (10K) | SlimOrca (518K) |
|
|
| --- | --- | --- | --- | --- | --- |
|
|
| Huggingface | 1 T4 | 23h 15m | 56h 28m | 8h 38m | 391h 41m |
|
|
| Unsloth Open | 1 T4 | 13h 7m (1.8x) | 31h 47m (1.8x) | 4h 27m (1.9x) | 240h 4m (1.6x) |
|
|
| Unsloth Pro | 1 T4 | 3h 6m (7.5x) | 5h 17m (10.7x) | 1h 7m (7.7x) | 59h 53m (6.5x) |
|
|
| Unsloth Max | 1 T4 | 2h 39m (8.8x) | 4h 31m (12.5x) | 0h 58m (8.9x) | 51h 30m (7.6x) |
|
|
|
|
**Peak Memory Usage**
|
|
|
|
| System | GPU | Alpaca (52K) | LAION OIG (210K) | Open Assistant (10K) | SlimOrca (518K) |
|
|
| --- | --- | --- | --- | --- | --- |
|
|
| Huggingface | 1 T4 | 7.3GB | 5.9GB | 14.0GB | 13.3GB |
|
|
| Unsloth Open | 1 T4 | 6.8GB | 5.7GB | 7.8GB | 7.7GB |
|
|
| Unsloth Pro | 1 T4 | 6.4GB | 6.4GB | 6.4GB | 6.4GB |
|
|
| Unsloth Max | 1 T4 | 11.4GB | 12.4GB | 11.9GB | 14.4GB |
|
|
</details>
|
|
|
|
<details>
|
|
<summary>Click for Performance Comparisons on 2 Tesla T4 GPUs via DDP:</summary>
|
|
**Time taken for 1 epoch**
|
|
|
|
Two Tesla T4s on Kaggle
|
|
`bsz = 2, ga = 4, max_grad_norm = 0.3, num_train_epochs = 1, seed = 3047, lr = 2e-4, wd = 0.01, optim = "adamw_8bit", schedule = "linear", schedule_steps = 10`
|
|
|
|
| System | GPU | Alpaca (52K) | LAION OIG (210K) | Open Assistant (10K) | SlimOrca (518K) * |
|
|
| --- | --- | --- | --- | --- | --- |
|
|
| Huggingface | 2 T4 | 84h 47m | 163h 48m | 30h 51m | 1301h 24m * |
|
|
| Unsloth Pro | 2 T4 | 3h 20m (25.4x) | 5h 43m (28.7x) | 1h 12m (25.7x) | 71h 40m (18.1x) * |
|
|
| Unsloth Max | 2 T4 | 3h 4m (27.6x) | 5h 14m (31.3x) | 1h 6m (28.1x) | 54h 20m (23.9x) * |
|
|
|
|
**Peak Memory Usage on a Multi GPU System (2 GPUs)**
|
|
|
|
| System | GPU | Alpaca (52K) | LAION OIG (210K) | Open Assistant (10K) | SlimOrca (518K) * |
|
|
| --- | --- | --- | --- | --- | --- |
|
|
| Huggingface | 2 T4 | 8.4GB \| 6GB | 7.2GB \| 5.3GB | 14.3GB \| 6.6GB | 10.9GB \| 5.9GB * |
|
|
| Unsloth Pro | 2 T4 | 7.7GB \| 4.9GB | 7.5GB \| 4.9GB | 8.5GB \| 4.9GB | 6.2GB \| 4.7GB * |
|
|
| Unsloth Max | 2 T4 | 10.5GB \| 5GB | 10.6GB \| 5GB | 10.6GB \| 5GB | 10.5GB \| 5GB * |
|
|
|
|
* Slim Orca `bsz=1` for all benchmarks since `bsz=2` OOMs. We can handle `bsz=2`, but we benchmark it with `bsz=1` for consistency.
|
|
</details>
|
|
|
|

|
|
<br>
|
|
|
|
## NVIDIA Pascal Support
|
|
|
|
Support for NVIDIA Pascal family of cards, specifically the P40 and P100.
|
|
|
|
### Setup Guide
|
|
|
|
1. Create three files (`Dockerfile`, `unsloth_env_file.yml`, and `docker-compose.yml`) with the contents provided below.
|
|
2. Ensure Docker and Docker Compose are installed on your system.
|
|
3. Install the NVIDIA Container Toolkit for GPU support if not already done.
|
|
4. Place all three files in the same directory.
|
|
5. Open a terminal and navigate to the directory containing these files.
|
|
6. Run the following command to build and start the container:
|
|
|
|
```
|
|
docker-compose up --build
|
|
```
|
|
|
|
7. Once the container is running, access Jupyter Lab by opening a web browser and navigating to `http://localhost:8888`.
|
|
|
|
### Configuration Files
|
|
|
|
#### 1. Dockerfile
|
|
|
|
```dockerfile
|
|
# Stage 1: Base image with system dependencies
|
|
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04 as base
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
build-essential \
|
|
git \
|
|
vim \
|
|
curl \
|
|
wget \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Miniconda only if it's not already installed
|
|
RUN if [ ! -d "/opt/conda" ]; then \
|
|
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh && \
|
|
bash miniconda.sh -b -p /opt/conda && \
|
|
rm miniconda.sh; \
|
|
fi
|
|
|
|
# Set path to conda
|
|
ENV PATH /opt/conda/bin:$PATH
|
|
|
|
# Set path to conda
|
|
ENV PATH /opt/conda/bin:$PATH
|
|
|
|
# Stage 2: Python environment setup
|
|
FROM base as python-env
|
|
|
|
COPY unsloth_env_file.yml unsloth_env_file.yml
|
|
|
|
RUN conda env create -f unsloth_env_file.yml
|
|
|
|
SHELL ["conda", "run", "-n", "unsloth_env", "/bin/bash", "-c"]
|
|
|
|
# Stage 3: Final image
|
|
FROM python-env as final
|
|
|
|
# Install Unsloth (This step is separate because it's likely to change more frequently)
|
|
RUN pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git"
|
|
|
|
ENV PATH /usr/local/cuda/bin:$PATH
|
|
ENV LD_LIBRARY_PATH /usr/local/cuda/lib64:$LD_LIBRARY_PATH
|
|
|
|
# Set the working directory
|
|
WORKDIR /workspace
|
|
|
|
# Set the default command to run Jupyter Lab
|
|
CMD ["conda", "run", "--no-capture-output", "-n", "unsloth_env", "jupyter", "lab", "--ip=0.0.0.0", "--no-browser", "--allow-root", "--NotebookApp.token=''", "--NotebookApp.password=''"]
|
|
```
|
|
|
|
#### 2. unsloth_env_file.yml
|
|
|
|
```yaml
|
|
name: unsloth_env
|
|
channels:
|
|
- xformers
|
|
- pytorch
|
|
- nvidia
|
|
- conda-forge
|
|
- defaults
|
|
dependencies:
|
|
- _libgcc_mutex=0.1=conda_forge
|
|
- _openmp_mutex=4.5=2_gnu
|
|
- aiohttp=3.9.5=py310h5eee18b_0
|
|
- aiosignal=1.2.0=pyhd3eb1b0_0
|
|
- anyio=4.2.0=py310h06a4308_0
|
|
- argon2-cffi=21.3.0=pyhd3eb1b0_0
|
|
- argon2-cffi-bindings=21.2.0=py310h7f8727e_0
|
|
- arrow-cpp=16.1.0=hc1eb8f0_0
|
|
- async-lru=2.0.4=pyhd8ed1ab_0
|
|
- async-timeout=4.0.3=py310h06a4308_0
|
|
- attrs=23.1.0=py310h06a4308_0
|
|
- aws-c-auth=0.6.19=h5eee18b_0
|
|
- aws-c-cal=0.5.20=hdbd6064_0
|
|
- aws-c-common=0.8.5=h5eee18b_0
|
|
- aws-c-compression=0.2.16=h5eee18b_0
|
|
- aws-c-event-stream=0.2.15=h6a678d5_0
|
|
- aws-c-http=0.6.25=h5eee18b_0
|
|
- aws-c-io=0.13.10=h5eee18b_0
|
|
- aws-c-mqtt=0.7.13=h5eee18b_0
|
|
- aws-c-s3=0.1.51=hdbd6064_0
|
|
- aws-c-sdkutils=0.1.6=h5eee18b_0
|
|
- aws-checksums=0.1.13=h5eee18b_0
|
|
- aws-crt-cpp=0.18.16=h6a678d5_0
|
|
- aws-sdk-cpp=1.10.55=h721c034_0
|
|
- babel=2.14.0=pyhd8ed1ab_0
|
|
- beautifulsoup4=4.12.3=py310h06a4308_0
|
|
- blas=1.0=mkl
|
|
- bleach=4.1.0=pyhd3eb1b0_0
|
|
- boost-cpp=1.82.0=hdb19cb5_2
|
|
- bottleneck=1.3.7=py310ha9d4c09_0
|
|
- brotli-python=1.0.9=py310h6a678d5_8
|
|
- bzip2=1.0.8=h5eee18b_6
|
|
- c-ares=1.19.1=h5eee18b_0
|
|
- ca-certificates=2024.7.4=hbcca054_0
|
|
- certifi=2024.7.4=pyhd8ed1ab_0
|
|
- cffi=1.16.0=py310h5eee18b_1
|
|
- charset-normalizer=3.3.2=pyhd3eb1b0_0
|
|
- cuda-cudart=11.8.89=0
|
|
- cuda-cupti=11.8.87=0
|
|
- cuda-libraries=11.8.0=0
|
|
- cuda-nvrtc=11.8.89=0
|
|
- cuda-nvtx=11.8.86=0
|
|
- cuda-runtime=11.8.0=0
|
|
- cuda-version=11.8=hcce14f8_3
|
|
- cudatoolkit=11.8.0=h6a678d5_0
|
|
- datasets=2.19.1=py310h06a4308_0
|
|
- debugpy=1.6.7=py310h6a678d5_0
|
|
- decorator=5.1.1=pyhd3eb1b0_0
|
|
- defusedxml=0.7.1=pyhd3eb1b0_0
|
|
- dill=0.3.8=py310h06a4308_0
|
|
- entrypoints=0.4=py310h06a4308_0
|
|
- ffmpeg=4.3=hf484d3e_0
|
|
- filelock=3.13.1=py310h06a4308_0
|
|
- freetype=2.12.1=h4a9f257_0
|
|
- frozenlist=1.4.0=py310h5eee18b_0
|
|
- fsspec=2024.3.1=py310h06a4308_0
|
|
- gflags=2.2.2=h6a678d5_1
|
|
- glog=0.5.0=h6a678d5_1
|
|
- gmp=6.2.1=h295c915_3
|
|
- gmpy2=2.1.2=py310heeb90bb_0
|
|
- gnutls=3.6.15=he1e5248_0
|
|
- h11=0.14.0=pyhd8ed1ab_0
|
|
- h2=4.1.0=pyhd8ed1ab_0
|
|
- hpack=4.0.0=pyh9f0ad1d_0
|
|
- httpcore=1.0.5=pyhd8ed1ab_0
|
|
- httpx=0.27.0=pyhd8ed1ab_0
|
|
- hyperframe=6.0.1=pyhd8ed1ab_0
|
|
- icu=73.1=h6a678d5_0
|
|
- idna=3.7=py310h06a4308_0
|
|
- importlib-metadata=7.0.1=py310h06a4308_0
|
|
- importlib_metadata=7.0.1=hd8ed1ab_0
|
|
- importlib_resources=6.4.0=pyhd8ed1ab_0
|
|
- intel-openmp=2023.1.0=hdb19cb5_46306
|
|
- ipykernel=6.28.0=py310h06a4308_0
|
|
- ipython_genutils=0.2.0=pyhd3eb1b0_1
|
|
- jedi=0.19.1=py310h06a4308_0
|
|
- jinja2=3.1.4=py310h06a4308_0
|
|
- jpeg=9e=h5eee18b_2
|
|
- json5=0.9.25=pyhd8ed1ab_0
|
|
- jsonschema=4.19.2=py310h06a4308_0
|
|
- jsonschema-specifications=2023.7.1=py310h06a4308_0
|
|
- jupyter-lsp=2.2.5=pyhd8ed1ab_0
|
|
- jupyter_client=7.4.9=py310h06a4308_0
|
|
- jupyter_core=5.7.2=py310h06a4308_0
|
|
- jupyter_events=0.10.0=py310h06a4308_0
|
|
- jupyter_server=2.14.1=py310h06a4308_0
|
|
- jupyter_server_terminals=0.4.4=py310h06a4308_1
|
|
- jupyterlab=4.2.4=pyhd8ed1ab_0
|
|
- jupyterlab_pygments=0.3.0=pyhd8ed1ab_1
|
|
- jupyterlab_server=2.27.3=pyhd8ed1ab_0
|
|
- krb5=1.20.1=h143b758_1
|
|
- lame=3.100=h7b6447c_0
|
|
- lcms2=2.12=h3be6417_0
|
|
- ld_impl_linux-64=2.38=h1181459_1
|
|
- lerc=3.0=h295c915_0
|
|
- libabseil=20240116.2=cxx17_h6a678d5_0
|
|
- libboost=1.82.0=h109eef0_2
|
|
- libbrotlicommon=1.0.9=h5eee18b_8
|
|
- libbrotlidec=1.0.9=h5eee18b_8
|
|
- libbrotlienc=1.0.9=h5eee18b_8
|
|
- libcublas=11.11.3.6=0
|
|
- libcufft=10.9.0.58=0
|
|
- libcufile=1.9.1.3=0
|
|
- libcurand=10.3.5.147=0
|
|
- libcurl=8.7.1=h251f7ec_0
|
|
- libcusolver=11.4.1.48=0
|
|
- libcusparse=11.7.5.86=0
|
|
- libdeflate=1.17=h5eee18b_1
|
|
- libedit=3.1.20230828=h5eee18b_0
|
|
- libev=4.33=h7f8727e_1
|
|
- libevent=2.1.12=hdbd6064_1
|
|
- libffi=3.4.4=h6a678d5_1
|
|
- libgcc-ng=14.1.0=h77fa898_0
|
|
- libgomp=14.1.0=h77fa898_0
|
|
- libgrpc=1.62.2=h2d74bed_0
|
|
- libiconv=1.16=h5eee18b_3
|
|
- libidn2=2.3.4=h5eee18b_0
|
|
- libjpeg-turbo=2.0.0=h9bf148f_0
|
|
- libnghttp2=1.57.0=h2d74bed_0
|
|
- libnpp=11.8.0.86=0
|
|
- libnvjpeg=11.9.0.86=0
|
|
- libpng=1.6.39=h5eee18b_0
|
|
- libprotobuf=4.25.3=he621ea3_0
|
|
- libsodium=1.0.18=h7b6447c_0
|
|
- libssh2=1.11.0=h251f7ec_0
|
|
- libstdcxx-ng=11.2.0=h1234567_1
|
|
- libtasn1=4.19.0=h5eee18b_0
|
|
- libthrift=0.15.0=h1795dd8_2
|
|
- libtiff=4.5.1=h6a678d5_0
|
|
- libunistring=0.9.10=h27cfd23_0
|
|
- libuuid=1.41.5=h5eee18b_0
|
|
- libwebp-base=1.3.2=h5eee18b_0
|
|
- llvm-openmp=14.0.6=h9e868ea_0
|
|
- lz4-c=1.9.4=h6a678d5_1
|
|
- markupsafe=2.1.3=py310h5eee18b_0
|
|
- mistune=2.0.4=py310h06a4308_0
|
|
- mkl=2023.1.0=h213fc3f_46344
|
|
- mkl-service=2.4.0=py310h5eee18b_1
|
|
- mkl_fft=1.3.8=py310h5eee18b_0
|
|
- mkl_random=1.2.4=py310hdb19cb5_0
|
|
- mpc=1.1.0=h10f8cd9_1
|
|
- mpfr=4.0.2=hb69a4c5_1
|
|
- mpmath=1.3.0=py310h06a4308_0
|
|
- multidict=6.0.4=py310h5eee18b_0
|
|
- multiprocess=0.70.15=py310h06a4308_0
|
|
- nb_conda_kernels=2.3.1=py310h06a4308_0
|
|
- nbclassic=1.1.0=py310h06a4308_0
|
|
- nbclient=0.8.0=py310h06a4308_0
|
|
- nbconvert=7.10.0=py310h06a4308_0
|
|
- nbformat=5.9.2=py310h06a4308_0
|
|
- ncurses=6.4=h6a678d5_0
|
|
- nest-asyncio=1.6.0=py310h06a4308_0
|
|
- nettle=3.7.3=hbbd107a_1
|
|
- networkx=3.3=py310h06a4308_0
|
|
- notebook=6.5.7=py310h06a4308_0
|
|
- notebook-shim=0.2.3=py310h06a4308_0
|
|
- numexpr=2.8.7=py310h85018f9_0
|
|
- numpy=1.26.4=py310h5f9d8c6_0
|
|
- numpy-base=1.26.4=py310hb5e798b_0
|
|
- openh264=2.1.1=h4ff587b_0
|
|
- openjpeg=2.4.0=h9ca470c_2
|
|
- openssl=3.3.1=h4bc722e_2
|
|
- orc=2.0.1=h2d29ad5_0
|
|
- overrides=7.4.0=py310h06a4308_0
|
|
- packaging=24.1=py310h06a4308_0
|
|
- pandas=2.2.2=py310h6a678d5_0
|
|
- pandocfilters=1.5.0=pyhd3eb1b0_0
|
|
- pillow=10.4.0=py310h5eee18b_0
|
|
- pip=24.0=py310h06a4308_0
|
|
- platformdirs=3.10.0=py310h06a4308_0
|
|
- prometheus_client=0.14.1=py310h06a4308_0
|
|
- prompt_toolkit=3.0.43=hd3eb1b0_0
|
|
- psutil=5.9.0=py310h5eee18b_0
|
|
- ptyprocess=0.7.0=pyhd3eb1b0_2
|
|
- pure_eval=0.2.2=pyhd3eb1b0_0
|
|
- pyarrow=16.1.0=py310h1128e8f_0
|
|
- pycparser=2.21=pyhd3eb1b0_0
|
|
- pysocks=1.7.1=py310h06a4308_0
|
|
- python=3.10.14=h955ad1f_1
|
|
- python-dateutil=2.9.0post0=py310h06a4308_2
|
|
- python-fastjsonschema=2.16.2=py310h06a4308_0
|
|
- python-json-logger=2.0.7=py310h06a4308_0
|
|
- python-tzdata=2023.3=pyhd3eb1b0_0
|
|
- python-xxhash=2.0.2=py310h5eee18b_1
|
|
- pytorch=2.1.0=py3.10_cuda11.8_cudnn8.7.0_0
|
|
- pytorch-cuda=11.8=h7e8668a_5
|
|
- pytorch-mutex=1.0=cuda
|
|
- pytz=2024.1=py310h06a4308_0
|
|
- pyyaml=6.0.1=py310h5eee18b_0
|
|
- pyzmq=24.0.1=py310h5eee18b_0
|
|
- re2=2022.04.01=h295c915_0
|
|
- readline=8.2=h5eee18b_0
|
|
- referencing=0.30.2=py310h06a4308_0
|
|
- regex=2023.10.3=py310h5eee18b_0
|
|
- requests=2.32.3=py310h06a4308_0
|
|
- rfc3339-validator=0.1.4=py310h06a4308_0
|
|
- rfc3986-validator=0.1.1=py310h06a4308_0
|
|
- rpds-py=0.10.6=py310hb02cf49_0
|
|
- s2n=1.3.27=hdbd6064_0
|
|
- safetensors=0.4.2=py310ha89cbab_1
|
|
- send2trash=1.8.2=py310h06a4308_0
|
|
- setuptools=69.5.1=py310h06a4308_0
|
|
- six=1.16.0=pyhd3eb1b0_1
|
|
- snappy=1.1.10=h6a678d5_1
|
|
- sniffio=1.3.0=py310h06a4308_0
|
|
- soupsieve=2.5=py310h06a4308_0
|
|
- sqlite=3.45.3=h5eee18b_0
|
|
- stack_data=0.2.0=pyhd3eb1b0_0
|
|
- sympy=1.12=py310h06a4308_0
|
|
- tbb=2021.8.0=hdb19cb5_0
|
|
- terminado=0.17.1=py310h06a4308_0
|
|
- tinycss2=1.2.1=py310h06a4308_0
|
|
- tk=8.6.14=h39e8969_0
|
|
- tokenizers=0.19.1=py310hff361bb_0
|
|
- tomli=2.0.1=pyhd8ed1ab_0
|
|
- torchaudio=2.1.0=py310_cu118
|
|
- torchtriton=2.1.0=py310
|
|
- torchvision=0.16.0=py310_cu118
|
|
- tornado=6.4.1=py310h5eee18b_0
|
|
- tqdm=4.66.4=py310h2f386ee_0
|
|
- traitlets=5.14.3=py310h06a4308_0
|
|
- typing-extensions=4.11.0=py310h06a4308_0
|
|
- typing_extensions=4.11.0=py310h06a4308_0
|
|
- tzdata=2024a=h04d1e81_0
|
|
- urllib3=2.2.2=py310h06a4308_0
|
|
- utf8proc=2.6.1=h5eee18b_1
|
|
- webencodings=0.5.1=py310h06a4308_1
|
|
- websocket-client=1.8.0=py310h06a4308_0
|
|
- wheel=0.43.0=py310h06a4308_0
|
|
- xformers=0.0.22.post7=py310_cu11.8.0_pyt2.1.0
|
|
- xxhash=0.8.0=h7f8727e_3
|
|
- xz=5.4.6=h5eee18b_1
|
|
- yaml=0.2.5=h7b6447c_0
|
|
- yarl=1.9.3=py310h5eee18b_0
|
|
- zeromq=4.3.5=h6a678d5_0
|
|
- zipp=3.17.0=py310h06a4308_0
|
|
- zlib=1.2.13=h5eee18b_1
|
|
- zstd=1.5.5=hc292b87_2
|
|
- pip:
|
|
- accelerate==0.33.0
|
|
- asttokens==2.4.1
|
|
- bitsandbytes==0.43.2
|
|
- comm==0.2.2
|
|
- docstring-parser==0.16
|
|
- exceptiongroup==1.2.2
|
|
- executing==2.0.1
|
|
- gguf==0.9.1
|
|
- hf-transfer==0.1.8
|
|
- huggingface-hub==0.24.2
|
|
- iprogress==0.4
|
|
- ipython==8.26.0
|
|
- ipywidgets==8.1.3
|
|
- jupyterlab-widgets==3.0.11
|
|
- markdown-it-py==3.0.0
|
|
- matplotlib-inline==0.1.7
|
|
- mdurl==0.1.2
|
|
- parso==0.8.4
|
|
- peft==0.12.0
|
|
- pexpect==4.9.0
|
|
- prompt-toolkit==3.0.47
|
|
- protobuf==3.20.3
|
|
- pure-eval==0.2.3
|
|
- pygments==2.18.0
|
|
- rich==13.7.1
|
|
- sentencepiece==0.2.0
|
|
- shtab==1.7.1
|
|
- stack-data==0.6.3
|
|
- transformers==4.43.3
|
|
- trl==0.8.6
|
|
- tyro==0.8.5
|
|
- wcwidth==0.2.13
|
|
- widgetsnbextension==4.0.11
|
|
```
|
|
|
|
#### 3. docker-compose.yml
|
|
|
|
```yaml
|
|
version: '3.8'
|
|
|
|
services:
|
|
unsloth-env:
|
|
environment:
|
|
- NVIDIA_VISIBLE_DEVICES=all
|
|
deploy:
|
|
resources:
|
|
reservations:
|
|
devices:
|
|
- driver: nvidia
|
|
count: all
|
|
capabilities: [gpu]
|
|
volumes:
|
|
- ./cache:/root/.cache
|
|
- ./workspace:/workspace
|
|
working_dir: /workspace
|
|
ports:
|
|
- "8888:8888" # For Jupyter Lab
|
|
tty: true
|
|
stdin_open: true
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
```
|
|
|
|
|
|
### Thank You to
|
|
- [HuyNguyen-hust](https://github.com/HuyNguyen-hust) for making [RoPE Embeddings 28% faster](https://github.com/unslothai/unsloth/pull/238)
|
|
- [RandomInternetPreson](https://github.com/RandomInternetPreson) for confirming WSL support
|
|
- [152334H](https://github.com/152334H) for experimental DPO support
|
|
- [atgctg](https://github.com/atgctg) for syntax highlighting
|