Download setup_server.sh from natmin322/code_srt_sgwi_v1: direct link, hf CLI and curl.
- Browser
- Download file 5.56 kB
-
https://huggingface.co/datasets/natmin322/code_srt_sgwi_v1/resolve/main/setup_server.sh
- Command line
-
hf download hf://datasets/natmin322/code_srt_sgwi_v1/setup_server.sh
-
curl -L -o setup_server.sh https://huggingface.co/datasets/natmin322/code_srt_sgwi_v1/resolve/main/setup_server.sh
5.56 kB
| set -euo pipefail | |
| # Setup script for GPU servers (RTX 5090 / Blackwell sm_120) | |
| # Installs everything INTO THE CURRENTLY ACTIVE environment. | |
| # Usage: | |
| # source .venv/bin/activate # hoαΊ·c conda activate <env> | |
| # bash setup_server.sh | |
| echo "==========================================" | |
| echo "SpecRoute Setup for GPU Server (RTX 5090)" | |
| echo "==========================================" | |
| if command -v nvidia-smi >/dev/null 2>&1; then | |
| GPU_NAME=$(nvidia-smi --query-gpu=name --format=csv,noheader 2>/dev/null | head -1 || echo "Unknown") | |
| echo "[GPU] ${GPU_NAME}" | |
| fi | |
| PY_CMD="python" | |
| PIP_CMD="python -m pip" | |
| PY_VER=$(${PY_CMD} -c "import sys; print('.'.join(map(str, sys.version_info[:2])))") | |
| echo "[Python] ${PY_VER}" | |
| ${PIP_CMD} install --upgrade pip wheel | |
| # ββ 1. Uninstall conflicting torch (cu124 blocks cu128/cu130) ββββββββββββββ | |
| echo "" | |
| echo "[1/5] Uninstalling old CUDA packages..." | |
| ${PIP_CMD} uninstall -y \ | |
| torch torchvision torchaudio triton \ | |
| cupy cupy-cuda12x cuda-pathfinder \ | |
| flash-attn \ | |
| 2>/dev/null || true | |
| # ββ 2. Install PyTorch nightly (sm_120 / RTX 5090 Blackwell support) βββββββββ | |
| # RTX 5090 (CC 12.0) needs CUDA 12.8+ β only available in nightly builds. | |
| # Try cu128 first, fallback to cu130. | |
| echo "" | |
| echo "[2/5] Installing PyTorch nightly (sm_120 support)..." | |
| if ! ${PIP_CMD} install --no-cache-dir -q --pre torch torchvision torchaudio \ | |
| --index-url https://download.pytorch.org/whl/nightly/cu128; then | |
| echo "[Fallback] cu128 unavailable, trying cu130..." | |
| ${PIP_CMD} install --no-cache-dir -q --pre torch torchvision torchaudio \ | |
| --index-url https://download.pytorch.org/whl/nightly/cu130 | |
| fi | |
| TORCH_VER=$(${PY_CMD} -c "import torch; print(torch.__version__)" 2>/dev/null || echo "NONE") | |
| echo "[Check] torch ${TORCH_VER}" | |
| # Check sm_120 support β no warning means compatible | |
| if ${PY_CMD} -c "import torch; torch.cuda.get_device_capability()" 2>&1 | grep -q "not compatible"; then | |
| echo "[ERROR] PyTorch still doesn't support sm_120. Check PyTorch nightly availability." | |
| echo " Try: https://pytorch.org/get-started/locally/" | |
| exit 1 | |
| fi | |
| # ββ 3. Core Python dependencies (exact pinned versions) βββββββββββββββββββββββ | |
| echo "" | |
| echo "[3/5] Installing pinned Python dependencies..." | |
| ${PIP_CMD} install --no-cache-dir -q \ | |
| "numpy==1.26.4" \ | |
| "protobuf==5.29.3" \ | |
| "pyarrow==17.0.0" \ | |
| "fsspec==2024.6.1" \ | |
| "tqdm==4.67.1" \ | |
| "pynvml==11.5.3" \ | |
| "pandas==2.2.2" \ | |
| "scipy==1.14.1" \ | |
| "scikit-learn==1.6.1" \ | |
| "sentencepiece==0.2.0" \ | |
| "loralib==0.1.2" \ | |
| "ipdb==0.13.13" \ | |
| "nltk==3.9.1" \ | |
| "accelerate==0.34.2" \ | |
| "absl-py==2.0.0" \ | |
| 2>&1 | grep -v "which is not installed\|which is incompatible\|dependency resolver" || true | |
| # ββ 4. transformers + tokenizers (EXACT β newer versions have breaking changes) β | |
| echo "" | |
| echo "[4/5] Installing transformers (exact pinned) + datasets..." | |
| ${PIP_CMD} install --no-cache-dir -q \ | |
| "transformers==4.40.2" \ | |
| "tokenizers==0.19.1" \ | |
| "datasets==2.21.0" \ | |
| 2>&1 | grep -v "which is not installed\|which is incompatible\|dependency resolver" || true | |
| # ββ 5. CuPy (optional β compute covariance matrix, not critical for training) β | |
| # cupy-cuda12x ships prebuilt; skip if build fails (not blocking). | |
| echo "" | |
| echo "[5/5] Installing CuPy (optional, skip if fails)..." | |
| ${PIP_CMD} install --no-cache-dir -q --no-deps cupy-cuda12x \ | |
| 2>&1 | grep -v "which is not installed\|which is incompatible\|dependency resolver\|error:" || true | |
| # ββ Symlinks ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| echo "" | |
| echo "[Symlink] Config aliases..." | |
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
| cd "${SCRIPT_DIR}" | |
| [ -d configs/gen_script_long_order3_t5_configs ] && \ | |
| [ ! -e configs/Long_Sequence ] && \ | |
| ln -s gen_script_long_order3_t5_configs configs/Long_Sequence | |
| [ -d configs/gen_script_superni_order1_t5_configs ] && \ | |
| [ ! -e configs/SuperNI ] && \ | |
| ln -s gen_script_superni_order1_t5_configs configs/SuperNI | |
| # ββ Verify ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| echo "" | |
| echo "[Verify]" | |
| ${PY_CMD} - <<'PY' | |
| import sys | |
| try: | |
| import torch | |
| import transformers | |
| import datasets | |
| print(f'β python {sys.version.split()[0]}') | |
| print(f'β torch {torch.__version__}') | |
| print(f'β numpy {__import__("numpy").__version__}') | |
| print(f'β transformers {transformers.__version__}') | |
| print(f'β datasets {datasets.__version__}') | |
| if torch.cuda.is_available(): | |
| cc = torch.cuda.get_device_capability() | |
| print(f'β CUDA available, CC {cc[0]}.{cc[1]}') | |
| print(f' GPU: {torch.cuda.get_device_name(0)}') | |
| try: | |
| import cupy | |
| print(f'β cupy {cupy.__version__}') | |
| except Exception: | |
| print('β cupy skipped (optional)') | |
| print('\n[OK] All good!') | |
| except Exception as e: | |
| print(f'[ERROR] {e}') | |
| sys.exit(1) | |
| PY | |
| echo "" | |
| echo "==========================================" | |
| echo "[Next] XoΓ‘ --load_best_model_at_end (transformers 4.40.2 validate strict):" | |
| echo " sed -i 's/--load_best_model_at_end //g' gen_script_long_order3_t5_srt_hard.sh" | |
| echo "==========================================" |