Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Create tpu_setup_script.sh
Browse files- tpu_setup_script.sh +53 -0
tpu_setup_script.sh
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# --- Automated Setup Script for Aetherius TPU VM (TensorFlow Base + Aggressive Cleanup) ---
|
| 4 |
+
# This script is executed automatically by Google Cloud when the TPU VM is provisioned.
|
| 5 |
+
|
| 6 |
+
echo "--- TPU SETUP SCRIPT: Starting Automated Aetherius Setup ---"
|
| 7 |
+
|
| 8 |
+
# 1. Update system packages (important for fresh images)
|
| 9 |
+
sudo apt-get update -y
|
| 10 |
+
|
| 11 |
+
# 2. Fix the PATH for the current user (crucial for pip and accelerate)
|
| 12 |
+
echo 'export PATH="$HOME/.local/bin:$PATH"' >> /home/plopplopshitshit/.bashrc
|
| 13 |
+
source /home/plopplopshitshit/.bashrc
|
| 14 |
+
echo "PATH updated: $(echo $PATH)"
|
| 15 |
+
|
| 16 |
+
# 3. Upgrade pip (This ensures we have a modern, functional pip)
|
| 17 |
+
echo "Upgrading pip..."
|
| 18 |
+
python3 -m pip install --upgrade pip
|
| 19 |
+
echo "Pip upgraded."
|
| 20 |
+
|
| 21 |
+
# 4. **CRITICAL:** AGGRESSIVELY UNINSTALL CONFLICTING TENSORFLOW-RELATED PACKAGES (BEFORE CLONING)
|
| 22 |
+
# This removes the incompatible versions of numpy, protobuf, and google-api-python-client
|
| 23 |
+
echo "Aggressively uninstalling conflicting TensorFlow/TPU packages..."
|
| 24 |
+
pip uninstall -y tensorflow tensorflow-estimator keras numpy protobuf google-api-python-client cloud-tpu-client tb-gcp-uploader
|
| 25 |
+
echo "Conflicting packages uninstalled."
|
| 26 |
+
|
| 27 |
+
# 5. Clone the Aetherius Code
|
| 28 |
+
echo "Cloning Aetherius repository..."
|
| 29 |
+
git clone https://huggingface.co/spaces/KingOfThoughtFleuren/Aetherius /home/plopplopshitshit/Aetherius_temp_clone
|
| 30 |
+
cd /home/plopplopshitshit/Aetherius_temp_clone
|
| 31 |
+
echo "Repository cloned and entered."
|
| 32 |
+
|
| 33 |
+
# 6. Install PyTorch for TPU (Specific Google Binaries)
|
| 34 |
+
echo "Installing PyTorch/XLA..."
|
| 35 |
+
pip install torch~=2.1 torch_xla[tpuvm]==2.1.0 -f https://storage.googleapis.com/libtpu-releases/index.html
|
| 36 |
+
echo "PyTorch/XLA installed."
|
| 37 |
+
|
| 38 |
+
# 7. Install All Other Aetherius Libraries (from requirements.txt)
|
| 39 |
+
echo "Installing remaining requirements..."
|
| 40 |
+
pip install -r requirements.txt
|
| 41 |
+
echo "Remaining requirements installed."
|
| 42 |
+
|
| 43 |
+
# 8. Final Dependency Check (This should now pass cleanly)
|
| 44 |
+
echo "Running pip check for final conflicts..."
|
| 45 |
+
pip check
|
| 46 |
+
echo "Pip check complete."
|
| 47 |
+
|
| 48 |
+
# 9. Configure accelerate (Non-interactive)
|
| 49 |
+
echo "Configuring accelerate..."
|
| 50 |
+
accelerate config --config_file /home/plopplopshitshit/.config/accelerate/default_config.yaml --tpu_use_cluster --tpu_num_processes 8 --tpu_debug_config
|
| 51 |
+
echo "Accelerate configured."
|
| 52 |
+
|
| 53 |
+
echo "--- TPU SETUP SCRIPT: Automated Aetherius Setup Complete ---"
|