knowledge-drift-experiments / run_experiments.sh
Raniahossam33's picture
Upload folder using huggingface_hub
14b2318 verified
Raw
History Blame Contribute Delete
2.53 kB
#!/bin/bash
# =============================================================================
# run_experiments.sh β€” Temporal Drift Detection: All Stages
# Usage: bash run_experiments.sh [stage]
# stage 1 β†’ Qwen2.5 only (skip extraction, fix overlap, all analyses)
# stage 2 β†’ LLaMA-3.1 (fresh extraction + full analysis)
# stage 3 β†’ All models sequentially + cross-model
# stage 4 β†’ Cross-model only (assumes all models already done)
# =============================================================================
BASE_DIR="/share_2/users/ahmed_heakl/svd_kg/knowledge_drift"
SCRIPT="$BASE_DIR/disentanglement_v3.py"
OUT="$BASE_DIR/data/experiments/v3"
DATASET_QWEN="$BASE_DIR/data/tier1_qwen25.json"
DATASET_UNIFIED="$BASE_DIR/data/knowledge_drift_unified_tier1.json"
STAGE=${1:-1}
echo "============================================================"
echo " Stage: $STAGE"
echo " Output: $OUT"
echo "============================================================"
mkdir -p "$OUT"
# ── Stage 1: Qwen2.5 β€” skip extraction (cache exists), full analysis ─────────
if [ "$STAGE" = "1" ]; then
echo "[Stage 1] Qwen2.5 β€” reusing cached hidden states"
CUDA_VISIBLE_DEVICES=0 python "$SCRIPT" --model_key qwen25 --dataset "$DATASET_QWEN" --output_dir "$OUT" --skip_extraction --n_permutations 1000 --max_iter 2000
fi
# ── Stage 2: LLaMA-3.1 β€” fresh extraction + full analysis ───────────────────
if [ "$STAGE" = "2" ]; then
echo "[Stage 2] LLaMA-3.1 β€” fresh extraction"
CUDA_VISIBLE_DEVICES=0 python "$SCRIPT" --model_key llama31 --dataset "$DATASET_UNIFIED" --output_dir "$OUT" --n_permutations 1000 --max_iter 2000
fi
# ── Stage 3: All models sequentially (overnight) ─────────────────────────────
if [ "$STAGE" = "3" ]; then
echo "[Stage 3] All models β€” sequential run overnight"
CUDA_VISIBLE_DEVICES=0 python "$SCRIPT" --run_all_models --dataset "$DATASET_UNIFIED" --output_dir "$OUT" --cross_model --n_permutations 500 --max_iter 2000
fi
# ── Stage 4: Cross-model only (all caches exist) ─────────────────────────────
if [ "$STAGE" = "4" ]; then
echo "[Stage 4] Cross-model analysis only"
CUDA_VISIBLE_DEVICES=0 python "$SCRIPT" --run_all_models --dataset "$DATASET_UNIFIED" --output_dir "$OUT" --skip_extraction --cross_model --n_permutations 0 --max_iter 500
fi
echo "Done."