| #!/bin/bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| set -e |
|
|
| echo "============================================================" |
| echo " TD (Time Dilation) β Setup Script" |
| echo "============================================================" |
| echo "" |
|
|
| |
| echo "[1/7] Checking Python..." |
| if ! command -v python3 &> /dev/null; then |
| echo "ERROR: Python 3 not found. Install Python 3.10+ first." |
| exit 1 |
| fi |
| PYTHON_VER=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") |
| echo " Python $PYTHON_VER found." |
|
|
| |
| echo "" |
| echo "[2/7] Checking GPU..." |
| if command -v nvidia-smi &> /dev/null; then |
| GPU_NAME=$(nvidia-smi --query-gpu=name --format=csv,noheader | head -1) |
| GPU_MEM=$(nvidia-smi --query-gpu=memory.total --format=csv,noheader | head -1) |
| echo " GPU: $GPU_NAME ($GPU_MEM)" |
| else |
| echo " WARNING: nvidia-smi not found. GPU might not be available." |
| echo " Continuing anyway (some features won't work without GPU)." |
| fi |
|
|
| |
| echo "" |
| echo "[3/7] Installing Python packages..." |
| echo " This takes 5-10 minutes on first run." |
| pip install --break-system-packages -q \ |
| torch \ |
| transformers \ |
| accelerate \ |
| bitsandbytes \ |
| peft \ |
| trl \ |
| datasets \ |
| safetensors \ |
| sentencepiece \ |
| protobuf \ |
| scipy \ |
| lark \ |
| duckduckgo-search \ |
| huggingface_hub \ |
| 2>&1 | tail -5 |
|
|
| |
| echo " Trying to install Unsloth (optional speed boost)..." |
| pip install --break-system-packages -q unsloth 2>/dev/null && echo " Unsloth installed." || echo " Unsloth not available (that's fine, PEFT fallback works)." |
|
|
| echo " Packages installed." |
|
|
| |
| echo "" |
| echo "[4/7] Downloading base model (Qwen3-VL-8B-Instruct)..." |
| echo " This is ~16GB. Go grab a coffee." |
| python3 -c " |
| from huggingface_hub import snapshot_download |
| print(' Downloading Qwen/Qwen3-VL-8B-Instruct...') |
| path = snapshot_download('Qwen/Qwen3-VL-8B-Instruct', local_dir='./models/Qwen3-VL-8B-Instruct') |
| print(f' Downloaded to: {path}') |
| " |
| echo " Base model ready." |
|
|
| |
| echo "" |
| echo "[5/7] Downloading Transport and Merge code..." |
| if [ ! -d "Cross-Architecture-Merging-for-Large-Language-Models" ]; then |
| git clone https://github.com/FedML-AI/Cross-Architecture-Merging-for-Large-Language-Models.git |
| echo " T&M code cloned." |
| else |
| echo " T&M code already exists, skipping." |
| fi |
|
|
| |
| echo "" |
| echo "[6/7] Setting up directories..." |
| mkdir -p td_lang_outputs/{checkpoints,snapshots,arena_logs,committed} |
| echo " Output directories created." |
|
|
| |
| echo "" |
| echo "[7/7] Verifying installation..." |
|
|
| |
| python3 -c " |
| from td_lang.grammar import parse_td_file |
| from td_lang.compiler import compile_program |
| import ast |
| |
| program = parse_td_file('td_start.td') |
| code = compile_program(program) |
| ast.parse(code) |
| print(' td_lang: OK (td_start.td compiles)') |
| " |
|
|
| |
| python3 -c " |
| import torch |
| if torch.cuda.is_available(): |
| gpu = torch.cuda.get_device_name(0) |
| mem = torch.cuda.get_device_properties(0).total_mem / 1024**3 |
| print(f' PyTorch GPU: {gpu} ({mem:.0f}GB)') |
| else: |
| print(' PyTorch GPU: NOT AVAILABLE (CPU only)') |
| " |
|
|
| |
| python3 -c " |
| import transformers, peft, trl, bitsandbytes, lark, datasets |
| print(f' transformers: {transformers.__version__}') |
| print(f' peft: {peft.__version__}') |
| print(f' trl: {trl.__version__}') |
| print(' All libraries: OK') |
| " |
|
|
| echo "" |
| echo "============================================================" |
| echo " SETUP COMPLETE!" |
| echo "============================================================" |
| echo "" |
| echo " To start TD, run:" |
| echo " python -m td_lang run td_start.td" |
| echo "" |
| echo " To just compile (preview what it'll do):" |
| echo " python -m td_lang compile td_start.td" |
| echo "" |
| echo " To check syntax only:" |
| echo " python -m td_lang check td_start.td" |
| echo "" |
| echo "============================================================" |
|
|