TPU Environment Setup
October 24, 2025 ยท View on GitHub
This directory contains scripts to set up a TPU VM environment with necessary configurations.
Prerequisites
- Google Cloud SDK installed and configured
- Have a GCS bucket to mount to the TPU VM
- Required environment variables set:
WANDB_API_KEYHF_TOKENGH_TOKENKAGGLE_KEYKAGGLE_USERNAME
Usage
-
Run the setup script:
./tpu_setup.sh --tpu-name <tpu-name> -z <zone> [-p <project>] [--bucket <bucket-name>]
Arguments
--tpu-name: Name of the TPU to set up (required)-z, --zone: GCP zone where the TPU is located (required)-p, --project: GCP project ID (default: cs6741-llm-training)--bucket: GCS bucket to mount (optional, can be specified multiple times)
What it does
- Copies necessary setup scripts to the TPU VM
- Installs UV package manager
- Configures environment variables in
~/.env - Updates
~/.bashrcto source the environment variables - Mounts specified GCS buckets to
/mnt/<bucket-name>(if provided)
Bucket Mounting
- Each bucket is mounted to
/mnt/<bucket-name>on all TPU workers - Buckets are optional - the script will run successfully without any
Example
export WANDB_API_KEY=your_wandb_key
export HF_TOKEN=your_hf_token
export GH_TOKEN=your_gh_token
export KAGGLE_KEY=your_kaggle_key
export KAGGLE_USERNAME=your_kaggle_username
./tpu_setup.sh --tpu-name my-tpu -z us-central1-a --bucket model-checkpoints