Download scripts/00_env_setup.sh from bhriguverma/ankahi: direct link, hf CLI and curl.
- Browser
- Download file 4.18 kB
-
https://huggingface.co/bhriguverma/ankahi/resolve/main/scripts/00_env_setup.sh
- Command line
-
hf download hf://bhriguverma/ankahi/scripts/00_env_setup.sh
-
curl -L -o 00_env_setup.sh https://huggingface.co/bhriguverma/ankahi/resolve/main/scripts/00_env_setup.sh
4.18 kB
| # scripts/00_env_setup.sh (CUDA 12.1 variant) | |
| # One-shot setup for Ankahi training environment on H100. | |
| # Uses cu121 wheels for better compatibility with newer torchao/unsloth. | |
| # Usage: bash scripts/00_env_setup.sh | |
| set -euo pipefail | |
| echo "============================================================" | |
| echo " ANKAHI β Environment Setup (CUDA 12.1)" | |
| echo "============================================================" | |
| # ββ 1. System checks βββββββββββββββββββββββββββββββββββββββββββββ | |
| echo "[1/8] Checking system..." | |
| python_version=$(python3 --version 2>&1) | |
| echo " Python: $python_version" | |
| nvidia-smi --query-gpu=name,memory.total,driver_version --format=csv,noheader || { | |
| echo "ERROR: nvidia-smi failed β is CUDA available?" | |
| exit 1 | |
| } | |
| nvcc_version=$(nvcc --version 2>&1 | grep "release" | awk '{print $5}' | tr -d ',') | |
| echo " CUDA: $nvcc_version" | |
| # ββ 2. Upgrade pip βββββββββββββββββββββββββββββββββββββββββββββββ | |
| echo "[2/8] Upgrading pip..." | |
| python3 -m pip install --upgrade pip setuptools wheel --quiet | |
| # ββ 3. PyTorch (CUDA 12.4 wheels) βββββββββββββββββββββββββββββββ | |
| echo "[3/8] Installing PyTorch 2.6.0 with CUDA 12.4..." | |
| pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 \ | |
| --index-url https://download.pytorch.org/whl/cu124 --quiet | |
| # Verify | |
| python3 -c "import torch; assert torch.cuda.is_available(), 'CUDA not available!'; print(f' torch {torch.__version__}, CUDA {torch.version.cuda}, device: {torch.cuda.get_device_name(0)}')" | |
| # ββ 4. Flash-Attention ββββββββββββββββββββββββββββββββββββββββββββ | |
| echo "[4/8] Installing flash-attn..." | |
| pip install flash-attn>=2.6.0 --no-build-isolation --quiet | |
| # ββ 5. Core HuggingFace stack βββββββββββββββββββββββββββββββββββββ | |
| echo "[5/8] Installing HuggingFace stack..." | |
| pip install \ | |
| "transformers==4.57.1" \ | |
| "torchao==0.9.0" \ | |
| "datasets>=3.4.1,<4.4.0" \ | |
| "peft>=0.12.0" \ | |
| "trl>=0.18.2,<=0.24.0" \ | |
| "accelerate>=0.30.0" \ | |
| "bitsandbytes>=0.43.0" \ | |
| wandb \ | |
| --quiet | |
| # ββ 6. Unsloth ββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| echo "[6/8] Installing Unsloth (Gemma 4 support)..." | |
| pip install "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git" | |
| python3 -c "from unsloth import FastVisionModel; print(' Unsloth FastVisionModel OK')" | |
| # ββ 7. Audio, TTS, and data deps βββββββββββββββββββββββββββββββββ | |
| echo "[7/8] Installing audio/TTS/data dependencies..." | |
| # numpy pinned to 1.26.4 for f5-tts compatibility | |
| pip install \ | |
| "numpy<=1.26.4" \ | |
| librosa soundfile ffmpeg-python audiomentations \ | |
| TTS \ | |
| sacrebleu \ | |
| "sentence-transformers>=3.0.0" \ | |
| pandas Pillow pyarrow requests tqdm pyyaml python-dotenv \ | |
| anthropic "google-generativeai>=0.7.0" \ | |
| pytest pytest-cov black ruff \ | |
| --quiet | |
| # AI4Bharat Indic-TTS (clone if not present) | |
| if [ ! -d "vendor/Indic-TTS" ]; then | |
| echo " Cloning AI4Bharat Indic-TTS..." | |
| mkdir -p vendor | |
| git clone --depth 1 https://github.com/AI4Bharat/Indic-TTS vendor/Indic-TTS --quiet | |
| pip install -e vendor/Indic-TTS --quiet || echo " (Indic-TTS install needs manual steps β see vendor/Indic-TTS/README)" | |
| fi | |
| # ββ 8. Install ankahi package itself (editable) βββββββββββββββββββ | |
| echo "[8/8] Installing ankahi in editable mode..." | |
| pip install -e . --quiet | |
| echo "" | |
| echo "============================================================" | |
| echo " Setup complete. Run sanity check next:" | |
| echo " python scripts/07_overfit_sanity_check.py" | |
| echo "============================================================" |