#!/usr/bin/env sh
set -eu
export CUDA_VISIBLE_DEVICES=0
CONDA_BIN=${CONDA_BIN:-}
if [ -z "$CONDA_BIN" ]; then
  if command -v conda >/dev/null 2>&1; then
    CONDA_BIN=$(command -v conda)
  elif [ -x /opt/miniconda/bin/conda ]; then
    CONDA_BIN=/opt/miniconda/bin/conda
  fi
fi

if [ -n "$CONDA_BIN" ]; then
  eval "$("$CONDA_BIN" shell.bash hook)"
  conda activate focallora4
else
  echo "[TestInstructiveHead.sh] Warning: conda not found; running in current environment." >&2
fi

export CUDA_VISIBLE_DEVICES=0

SCRIPT=./EvaluateModel.py
MODEL=../../models/Llama-3.1-8B-Instruct
DATA=../1_raw_dataset/topicattack/data/crafted_instruction_data_squad_injection_qa.json
DATA2=../1_raw_dataset/topicattack/data/crafted_instruction_data_tri_conversation_attack_complete.json
SYSTEM=../1_raw_dataset/topicattack/prompts/generator_system_prompt.txt


set -x
python "$SCRIPT" \
--victim_model_path "$MODEL" \
--data_path "$DATA" \
--data_path_topicattack "$DATA2" \
--victim_system_path "$SYSTEM" \
--eval_mode "native_tool" \
--attacks none naive ignore escape_separation completion_real completion_realtmp completion_realcmb conv_attack \
--output_training_data ../3-1_model_training_preprocess/model_training/crafted_instruction_data_squad_injection_qa_train_tool.jsonl

python "$SCRIPT" \
--victim_model_path "$MODEL" \
--data_path "$DATA" \
--data_path_topicattack "$DATA2" \
--victim_system_path "$SYSTEM" \
--eval_mode "prompt_based_sep" \
--attacks none naive ignore escape_separation completion_real completion_realtmp completion_realcmb conv_attack \
--output_training_data ../3-1_model_training_preprocess/model_training/crafted_instruction_data_squad_injection_qa_train_prompt.jsonl





python "$SCRIPT" \
--victim_model_path "$MODEL" \
--data_path "$DATA" \
--data_path_topicattack "$DATA2" \
--victim_system_path "$SYSTEM" \
--eval_mode "native_tool" \
--attacks none naive ignore \
--output_training_data ../3-1_model_training_preprocess/model_training/crafted_instruction_data_squad_injection_qa_train_native_tool_simple_r.jsonl

python "$SCRIPT" \
--victim_model_path "$MODEL" \
--data_path "$DATA" \
--data_path_topicattack "$DATA2" \
--victim_system_path "$SYSTEM" \
--eval_mode "prompt_based_sep" \
--attacks naive ignore \
--output_training_data ../3-1_model_training_preprocess/model_training/crafted_instruction_data_squad_injection_qa_train_prompt_sep_simple_r.jsonl


python "$SCRIPT" \
--victim_model_path "$MODEL" \
--data_path "$DATA" \
--data_path_topicattack "$DATA2" \
--victim_system_path "$SYSTEM" \
--eval_mode "native_tool" \
--attacks naive ignore \
--side start \
--output_training_data ../3-1_model_training_preprocess/model_training/crafted_instruction_data_squad_injection_qa_train_native_tool_simple_l.jsonl


python "$SCRIPT" \
--victim_model_path "$MODEL" \
--data_path "$DATA" \
--data_path_topicattack "$DATA2" \
--victim_system_path "$SYSTEM" \
--eval_mode "prompt_based_sep" \
--attacks naive ignore \
--side start \
--output_training_data ../3-1_model_training_preprocess/model_training/crafted_instruction_data_squad_injection_qa_train_prompt_sep_simple_l.jsonl

cat \
../3-1_model_training_preprocess/model_training/crafted_instruction_data_squad_injection_qa_train_native_tool_simple_r.jsonl \
../3-1_model_training_preprocess/model_training/crafted_instruction_data_squad_injection_qa_train_native_tool_simple_l.jsonl \
> ../3-1_model_training_preprocess/model_training/crafted_instruction_data_squad_injection_qa_train_native_tool_simple.jsonl

cat \
../3-1_model_training_preprocess/model_training/crafted_instruction_data_squad_injection_qa_train_prompt_sep_simple_r.jsonl \
../3-1_model_training_preprocess/model_training/crafted_instruction_data_squad_injection_qa_train_prompt_sep_simple_l.jsonl \
> ../3-1_model_training_preprocess/model_training/crafted_instruction_data_squad_injection_qa_train_prompt_sep_simple.jsonl