diff options
| author | YurenHao0426 <blackhao0426@gmail.com> | 2026-01-27 09:57:37 -0600 |
|---|---|---|
| committer | YurenHao0426 <blackhao0426@gmail.com> | 2026-01-27 09:57:37 -0600 |
| commit | dc801c07cf38b0c495686463e6ca6f871a64440e (patch) | |
| tree | 599f03114775921dbc472403c701f4a3a8ea188a /collaborativeagents/scripts/test_rag_fix.sbatch | |
| parent | e43b3f8aa36c198b95c1e46bea2eaf3893b13dc3 (diff) | |
Add collaborativeagents module and update gitignore
- Add collaborativeagents subproject with adapters, agents, and evaluation modules
- Update .gitignore to exclude large binary files (.whl, .tar), wandb logs, and results
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'collaborativeagents/scripts/test_rag_fix.sbatch')
| -rw-r--r-- | collaborativeagents/scripts/test_rag_fix.sbatch | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/collaborativeagents/scripts/test_rag_fix.sbatch b/collaborativeagents/scripts/test_rag_fix.sbatch new file mode 100644 index 0000000..b07d286 --- /dev/null +++ b/collaborativeagents/scripts/test_rag_fix.sbatch @@ -0,0 +1,123 @@ +#!/bin/bash +#SBATCH --job-name=test_rag_fix +#SBATCH --account=bfqt-delta-gpu +#SBATCH --partition=gpuH200x8 +#SBATCH --nodes=1 +#SBATCH --ntasks=1 +#SBATCH --cpus-per-task=32 +#SBATCH --gres=gpu:4 +#SBATCH --mem=200G +#SBATCH --time=02:00:00 +#SBATCH --output=/projects/bfqt/users/yurenh2/ml-projects/personalization-user-model/test_rag_fix-%j.out +#SBATCH --error=/projects/bfqt/users/yurenh2/ml-projects/personalization-user-model/test_rag_fix-%j.err + +# Small-scale test: 5 profiles, 10 sessions each +# Tests RAG fixes: extract_session accumulation, nopersonal mode +# Compare: vanilla, rag, rag_vector + +cd /projects/bfqt/users/yurenh2/ml-projects/personalization-user-model/collaborativeagents +source /u/yurenh2/miniforge3/etc/profile.d/conda.sh +conda activate eval +export HF_HOME=/projects/bfqt/users/yurenh2/hf_cache/huggingface +export PYTHONPATH="/projects/bfqt/users/yurenh2/ml-projects/personalization-user-model/src:$PYTHONPATH" + +PROFILE_PATH="/projects/bfqt/users/yurenh2/ml-projects/personalization-user-model/collaborativeagents/data/complex_profiles_v2/profiles_200.jsonl" +AGENT_MODEL="/projects/bfqt/users/yurenh2/ml-projects/personalization-user-model/models/llama-3.1-8b-instruct" +USER_MODEL="meta-llama/Llama-3.1-70B-Instruct" + +echo "=== RAG Fix Verification Test ===" +echo "Testing fixes:" +echo " 1. extract_session (accumulate all turns)" +echo " 2. RAG mode=nopersonal (pure dense+rerank)" +echo " 3. Explicit normalize=True" +echo "" +echo "Settings: 5 profiles, 10 sessions each, max 15 turns" +echo "User simulator: $USER_MODEL (70B)" +echo "Agent: $AGENT_MODEL (8B)" +date +nvidia-smi --query-gpu=index,name,memory.total --format=csv + +# Start vLLM servers +# User simulator on GPUs 0,1 (70B, TP=2) +echo "" +echo "Starting vLLM servers..." +CUDA_VISIBLE_DEVICES=0,1 python -m vllm.entrypoints.openai.api_server \ + --model $USER_MODEL \ + --port 8004 --tensor-parallel-size 2 --gpu-memory-utilization 0.90 \ + --max-model-len 16384 --dtype bfloat16 --download-dir $HF_HOME \ + --disable-log-requests & +USER_PID=$! + +# Agent on GPUs 2,3 (8B, TP=2, lower memory for embedding/reranker) +CUDA_VISIBLE_DEVICES=2,3 python -m vllm.entrypoints.openai.api_server \ + --model $AGENT_MODEL \ + --port 8003 --tensor-parallel-size 2 --gpu-memory-utilization 0.45 \ + --max-model-len 16384 --dtype bfloat16 \ + --disable-log-requests & +AGENT_PID=$! + +# Wait for servers +echo "Waiting for vLLM servers (may take 5-10 min)..." +for i in {1..200}; do + if curl -s http://localhost:8004/health > /dev/null 2>&1; then + echo "User simulator (8004) ready after $((i*5)) seconds" + break + fi + sleep 5 +done +for i in {1..60}; do + if curl -s http://localhost:8003/health > /dev/null 2>&1; then + echo "Agent (8003) ready after $((i*5)) seconds" + break + fi + sleep 5 +done + +if ! curl -s http://localhost:8004/health > /dev/null 2>&1; then + echo "ERROR: User server not healthy" + kill $USER_PID $AGENT_PID 2>/dev/null + exit 1 +fi +if ! curl -s http://localhost:8003/health > /dev/null 2>&1; then + echo "ERROR: Agent server not healthy" + kill $USER_PID $AGENT_PID 2>/dev/null + exit 1 +fi +echo "Both vLLM servers ready" +sleep 5 + +# Test methods: vanilla (baseline), rag (fixed), rag_vector (fixed) +OUTPUT_DIR="../results/rag_fix_test_$(date +%Y%m%d_%H%M%S)" + +for METHOD in vanilla rag rag_vector; do + echo "" + echo "============================================" + echo "Testing method: $METHOD" + echo "============================================" + date + START=$(date +%s) + + python scripts/run_experiments.py --methods $METHOD \ + --datasets math-hard --n-profiles 5 --n-sessions 10 --max-turns 15 \ + --use-vllm --no-batch-processing --parallel-profiles 5 \ + --output-dir $OUTPUT_DIR --profile-path $PROFILE_PATH + + END=$(date +%s) + ELAPSED=$((END-START)) + + if [ $? -eq 0 ]; then + echo "Method $METHOD: SUCCESS (${ELAPSED}s)" + else + echo "Method $METHOD: FAILED after ${ELAPSED}s" + fi +done + +echo "" +echo "============================================" +echo "RAG Fix Test Complete" +echo "============================================" +echo "Results saved to: $OUTPUT_DIR" +date + +# Cleanup +pkill -f "vllm.entrypoints" 2>/dev/null || true |
