#!/usr/bin/env bash set -euo pipefail # --- KEEPING THE GOOD PARTS --- # 1. Ensure Persistent Cache is Writable # We keep this to ensure models download to the large storage volume (/data) export HF_HOME="${HF_HOME:-/data/.cache}" for dir in "$HF_HOME/hub" "$HF_HOME/transformers" "$HF_HOME/datasets" "$HF_HOME/sentence_transformers" "/data/out"; do mkdir -p "$dir" done # 2. Cleanup Threading Issues # We keep this to prevent PyTorch/Tokenizers from hanging unset OMP_NUM_THREADS export TOKENIZERS_PARALLELISM=false # 3. Quick GPU Check # We keep this for debugging echo '=== Torch / CUDA check ===' python - <<'PY' import torch print(f'torch version: {torch.__version__}') print(f'torch.cuda.is_available(): {torch.cuda.is_available()}') if torch.cuda.is_available(): print(f'Device: {torch.cuda.get_device_name(0)}') PY # --- REMOVING THE CONFLICTS --- # Removed: HTTP Server (Section 4) - conflicting with Gradio on port 7860 # Removed: Direct Miner Call (Section 5) - replaced by run_job.py # 4. Start the New Gradio UI echo '=== Starting Gradio UI ===' python run_job.py