Raniahossam33/knowledge-drift-experiments
022
1#!/bin/bash2# =============================================================================3# run_experiments.sh — Temporal Drift Detection: All Stages4# Usage: bash run_experiments.sh [stage]5# stage 1 → Qwen2.5 only (skip extraction, fix overlap, all analyses)6# stage 2 → LLaMA-3.1 (fresh extraction + full analysis)7# stage 3 → All models sequentially + cross-model8# stage 4 → Cross-model only (assumes all models already done)9# =============================================================================10 11BASE_DIR="/share_2/users/ahmed_heakl/svd_kg/knowledge_drift"12SCRIPT="$BASE_DIR/disentanglement_v3.py"13OUT="$BASE_DIR/data/experiments/v3"14DATASET_QWEN="$BASE_DIR/data/tier1_qwen25.json"15DATASET_UNIFIED="$BASE_DIR/data/knowledge_drift_unified_tier1.json"16 17STAGE=${1:-1}18 19echo "============================================================"20echo " Stage: $STAGE"21echo " Output: $OUT"22echo "============================================================"23 24mkdir -p "$OUT"25 26# ── Stage 1: Qwen2.5 — skip extraction (cache exists), full analysis ─────────27if [ "$STAGE" = "1" ]; then28 echo "[Stage 1] Qwen2.5 — reusing cached hidden states"29 CUDA_VISIBLE_DEVICES=0 python "$SCRIPT" --model_key qwen25 --dataset "$DATASET_QWEN" --output_dir "$OUT" --skip_extraction --n_permutations 1000 --max_iter 200030fi31 32# ── Stage 2: LLaMA-3.1 — fresh extraction + full analysis ───────────────────33if [ "$STAGE" = "2" ]; then34 echo "[Stage 2] LLaMA-3.1 — fresh extraction"35 CUDA_VISIBLE_DEVICES=0 python "$SCRIPT" --model_key llama31 --dataset "$DATASET_UNIFIED" --output_dir "$OUT" --n_permutations 1000 --max_iter 200036fi37 38# ── Stage 3: All models sequentially (overnight) ─────────────────────────────39if [ "$STAGE" = "3" ]; then40 echo "[Stage 3] All models — sequential run overnight"41 CUDA_VISIBLE_DEVICES=0 python "$SCRIPT" --run_all_models --dataset "$DATASET_UNIFIED" --output_dir "$OUT" --cross_model --n_permutations 500 --max_iter 200042fi43 44# ── Stage 4: Cross-model only (all caches exist) ─────────────────────────────45if [ "$STAGE" = "4" ]; then46 echo "[Stage 4] Cross-model analysis only"47 CUDA_VISIBLE_DEVICES=0 python "$SCRIPT" --run_all_models --dataset "$DATASET_UNIFIED" --output_dir "$OUT" --skip_extraction --cross_model --n_permutations 0 --max_iter 50048fi49 50echo "Done."