#!/bin/bash

export CUDA_VISIBLE_DEVICES=3


# #=========================prepare truth vector==============================
LOG_FILE="logs/run_log_$(date +%Y%m%d_%H%M%S).log"

echo "Step 1: Extracting activations..." | tee -a "$LOG_FILE"
nohup python step1_get_activations.py \
    --model_name Qwen1.5-14B-Chat \
    --dataset_name tqa_gen_zh_all \
    --debug 0 \
    >> "$LOG_FILE" 2>&1
wait

echo "Step 2: Editing model weights ..." | tee -a $LOG_FILE
nohup  python step2_edit_weight.py \
    --model_name Qwen1.5-14B-Chat \
    --dataset_name tqa_gen_zh_all \
    --num_heads 32 \
    >> $LOG_FILE 2>&1
wait

# #=========================prepare style vector==============================
echo "Step 1: Extracting activations..." | tee -a "$LOG_FILE"
nohup python step1_get_activations.py \
    --model_name Qwen1.5-14B-Chat \
    --dataset_name DRC \
    --debug 0 \
    >> "$LOG_FILE" 2>&1
wait

echo "Step 2: Editing model weights ..." | tee -a $LOG_FILE
nohup  python step2_edit_weight.py \
    --model_name Qwen1.5-14B-Chat \
    --dataset_name DRC \
    --num_heads 32 \
    >> $LOG_FILE 2>&1
wait

# #=========================generate answers==============================
echo "Step 3.1: Generating answers with edited model..." | tee -a $LOG_FILE
nohup python -u step3_generate.py \
    --model_name Qwen1.5-14B-Chat\
    --main_steer_style DRC\
    --second_steer_style tqa_gen_zh_all\
    --dataset_name tqa_gen_zh\
    --num_heads 32 \
    --debug 0 \
    --main_strength 3.0 \
    --second_strength 2.5 \
    >> $LOG_FILE 2>&1
wait


echo "Step 3.xx: Generating answers with origin model..."
nohup python step3.x_generate_origin.py \
    --model_name Qwen1.5-14B-Chat \
    --main_steer_style None\
    --second_steer_style None\
    --dataset_name tqa_gen_zh\
    --num_heads 32 \
    --debug 0\
    >> $LOG_FILE 2>&1
wait

echo "Step 3.5 add_origin..." | tee -a $LOG_FILE
nohup python step3.5_add_origin.py \
    --model_name Qwen1.5-14B-Chat\
    --main_steer_style DRC\
    --second_steer_style tqa_gen_zh_all \
    --dataset_name tqa_gen_zh\
    --baseline_name None\
    --main_strength 3.0 \
    --second_strength 2.5 \
    >> $LOG_FILE 2>&1

# #=========================evaluation  style==============================
echo "step4.3: evaluation"| tee -a $LOG_FILE
nohup python   evaluation/evaluation.py \
    --model_name Qwen1.5-14B-Chat\
    --main_steer_style DRC\
    --second_steer_style tqa_gen_zh_all\
    --dataset_name tqa_gen_zh\
    --baseline_name None\
    --main_strength 3.0 \
    --second_strength 2.5 \
    >> $LOG_FILE 2>&1
# #=========================evaluation  truth==============================
echo "step5.3: evaluation tqa"| tee -a $LOG_FILE
nohup python   step5_tfqa_eval.py \
    --model_name Qwen1.5-14B-Chat\
    --main_steer_style DRC\
    --second_steer_style tqa_gen_zh_all\
    --dataset_name tqa_gen_zh\
    --baseline_name None\
    --main_strength 3.0 \
    --second_strength 2.5 \
    --debug 0\
    >> $LOG_FILE 2>&1


echo "All runs completed."



