#!/bin/bash # Run this on RunPod after uploading embeddings.npz and doc_metadata.jsonl # Sets up the environment and runs BERTopic clustering echo "=== RunPod BERTopic Setup ===" echo "GPU info:" nvidia-smi --query-gpu=name,memory.total --format=csv,noheader # Install dependencies pip install --upgrade pip pip install bertopic hdbscan umap-learn plotly safetensors # Try to install cuML for GPU acceleration # This depends on the CUDA version on the pod echo "" echo "Attempting cuML install for GPU-accelerated UMAP/HDBSCAN..." pip install cuml-cu12 2>/dev/null || \ pip install cuml-cu11 2>/dev/null || \ echo "cuML not available — will use CPU UMAP/HDBSCAN (slower but works)" echo "" echo "=== Setup complete ===" echo "Run: python 02_bertopic_gpu.py" echo "Or with nohup: nohup python 02_bertopic_gpu.py > bertopic.log 2>&1 &"