| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
A comprehensive, production-ready setup script that installs Unsloth and all necessary dependencies for fine-tuning LLMs, vision models, and audio models on NVIDIA Brev GPU instances.
Compatible with all 181+ converted Unsloth notebooks.
✅ Brev-Native: Automatically detects Brev user environment and configures accordingly
✅ Smart Package Manager: Detects and uses uv (faster) or falls back to pip
✅ Optimized Caching: Automatically uses /ephemeral for PyTorch caches when available
✅ Jupyter Kernel Fix: Ensures Jupyter kernel uses python3 (prevents import errors)
✅ GPU Verification: Validates NVIDIA GPU presence and CUDA availability
✅ Conda Variant: Uses the recommended unsloth[conda] variant for maximum compatibility
✅ Complete ML Stack: Installs PyTorch, Transformers, PEFT, TRL, and all training dependencies
✅ Jupyter Environment: Sets up Jupyter Lab with proper kernel and widget support
✅ Optional Dependencies: Support for vision and audio model fine-tuning
✅ Workspace Setup: Creates organized directory structure for models, outputs, and datasets
✅ Verification: Tests all installations and provides diagnostic information
✅ Examples Included: Clones official notebooks and creates test scripts
bash setup.shBy default, installs EVERYTHING for all 181+ notebooks:
This ensures all 181+ notebooks work out of the box with no surprises!
If you only need text models (Llama, Mistral, Gemma, etc.) and want to save time/space:
bash setup.sh --minimal
# or
bash setup.sh --text-onlySkips vision and audio dependencies (~1GB less, ~2 minutes faster).
Skip specific components:
# Text + Vision, skip audio
bash setup.sh --no-audio
# Text + Audio, skip vision
bash setup.sh --no-vision
# Skip example notebooks
bash setup.sh --skip-examplesbash setup.sh [OPTIONS]
Options:
--minimal Install only text model dependencies (smallest/fastest)
--text-only Same as --minimal
--no-vision Skip vision dependencies (keeps audio)
--no-audio Skip audio dependencies (keeps vision)
--skip-examples Skip cloning example notebooks repository
--help Show help message
Default: Installs ALL dependencies (text + vision + audio)| Package | Version | Purpose |
|---|---|---|
| torch | >=2.1.0 | PyTorch with CUDA support |
| transformers | >=4.40.0 | HuggingFace Transformers |
| datasets | >=2.18.0 | Dataset loading and processing |
| accelerate | >=0.28.0 | Distributed training |
| peft | >=0.10.0 | Parameter-efficient fine-tuning |
| trl | >=0.8.0 | Transformer reinforcement learning |
| bitsandbytes | >=0.43.0 | Quantization support |
| unsloth | latest | Fast fine-tuning (conda variant) |
Skip with: --minimal or --no-vision
Skip with: --minimal or --no-audio
After installation, the following workspace structure is created:
$HOME/workspace/
├── models/ # Pre-trained models and weights
├── outputs/ # Training outputs and logs
├── checkpoints/ # Model checkpoints during training
├── datasets/ # Training datasets
└── notebooks/ # Your Jupyter notebooks
/workspace/ # Also created if permissions allow
├── models/
├── outputs/
├── checkpoints/
└── datasets/
$HOME/unsloth-examples/
└── test_install.py # Test script to verify installation
$HOME/unsloth-notebooks/ # Official Unsloth notebooks (if not --skip-examples)
└── nb/
├── Llama3_(8B).ipynb
├── Gemma3_(4B).ipynb
└── ... (181+ notebooks)
python3 ~/unsloth-examples/test_install.pyThis loads a small Llama 3.2 1B model to verify everything works.
jupyter lab --ip=0.0.0.0 --port=8888Access via your Brev URL on port 8888.
cd ~/unsloth-notebooks/nb
# Open any notebook in Jupyter LabAll 181+ Unsloth notebooks are supported, including:
Text Models:
Vision Models:
Audio Models:
Minimum:
Recommended:
Tested and verified on:
This script includes several Brev-specific optimizations discovered during the conversion of 181+ notebooks:
Critical for Jupyter Lab integration:
This ensures notebooks don't need to reinstall packages that were already installed by setup.sh.
See VENV_FIX.md for detailed explanation.
Configured environment variables:
TORCHINDUCTOR_CACHE_DIR=/ephemeral/torch_cache # or ~/.cache/torch/inductor
TORCH_COMPILE_DIR=/ephemeral/torch_cache # or ~/.cache/torch/inductor
TRITON_CACHE_DIR=/ephemeral/triton_cache # or ~/.cache/triton
XDG_CACHE_HOME=$HOME/.cacheCommon issue: Jupyter kernel configured to use python instead of python3, causing:
FileNotFoundError: [Errno 2] No such file or directory: 'python'
Our fix:
If you get "No module named torch":
python3 -m pip install --upgrade torch torchvision torchaudioIf Unsloth fails to import, try reinstalling:
python3 -m pip uninstall -y unsloth
python3 -m pip install "unsloth[conda] @ git+https://github.com/unslothai/unsloth.git"Verify GPU:
nvidia-smi
python3 -c "import torch; print(torch.cuda.is_available())"If running as root, the script automatically detects and uses the Brev user. If you still have permission issues:
sudo chown -R $USER:$USER $HOME/workspace
sudo chown -R $USER:$USER $HOME/unsloth-*If you prefer to use a virtual environment:
python3 -m venv ~/unsloth-env
source ~/unsloth-env/bin/activate
bash setup.shTo install a specific PyTorch version before running the script:
pip install torch==2.5.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
bash setup.shThe script is designed to be idempotent - you can run it multiple times safely. To update only Unsloth:
python3 -m pip install --upgrade "unsloth[conda] @ git+https://github.com/unslothai/unsloth.git"python3 -m pip install --upgrade pip
python3 -m pip install --upgrade torch torchvision torchaudio
python3 -m pip install --upgrade transformers datasets accelerate peft trl
python3 -m pip install --upgrade "unsloth[conda] @ git+https://github.com/unslothai/unsloth.git"cd ~/unsloth-notebooks
git pullFor issues related to:
v2.1.0 (October 2025)
v2.0.0 (October 2025)
v1.0.0 (Previous)
This setup script is provided as-is for use with NVIDIA Brev and Unsloth.
| Back | FazBrowse Home | New Git URL |