#!/bin/bash

export CUDA_VISIBLE_DEVICES=3



LOG_FILE="logs/run_log_new_en$(date +%Y%m%d_%H%M%S).log"

# #========================= style ==============================
echo "Step 1: Extracting activations..." | tee -a "$LOG_FILE"
nohup python step1_get_activations.py \
    --model_name Qwen1.5-14B-Chat \
    --dataset_name Shakespeare \
    --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_all \
    --num_heads 32 \
    >> $LOG_FILE 2>&1
wait

# #========================= truth ==============================
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_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_all \
    --num_heads 32 \
    >> $LOG_FILE 2>&1
wait

# #=============================generate answer================================================

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 Shakespeare\
    --second_steer_style tqa_gen_all\
    --dataset_name tqa_gen\
    --num_heads 32 \
    --debug 0 \
    --main_strength 1.5 \
    --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\
    --num_heads 32 \
    --debug 0\
    >> $LOG_FILE 2>&1
wait


echo "Step 3.5.3: add_origin..." | tee -a $LOG_FILE
nohup python step3.5_add_origin.py \
    --model_name Qwen1.5-14B-Chat\
    --main_steer_style Shakespeare\
    --second_steer_style tqa_gen_all \
    --dataset_name tqa_gen\
    --baseline_name None\
    --main_strength 1.5 \
    --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 Shakespeare\
    --second_steer_style tqa_gen_all\
    --dataset_name tqa_gen\
    --baseline_name None\
    --main_strength 1.5 \
    --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 Shakespeare\
    --second_steer_style tqa_gen_all\
    --dataset_name tqa_gen\
    --baseline_name None\
    --main_strength 1.5 \
    --second_strength 2.5 \
    --debug 0\
    >> $LOG_FILE 2>&1


echo "All runs completed."



