1
+ #! /bin/bash
2
+
3
+ # Usage examples:
4
+ # ./create_all_control_vectors.sh "0" "./aya-23-35B" "aya-23:35b-" 8192
5
+ # ./create_all_control_vectors.sh "1" "./Qwen1.5-14B-Chat" "qwen-1.5:14b-" 5120
6
+ # ./create_all_control_vectors.sh "0,1" "./c4ai-command-r-plus" "command-r-plus:104b-" 12288
7
+
8
+ # Check if we have the correct number of arguments
9
+ if [ " $# " -ne 4 ]; then
10
+ echo " Usage: $0 <cuda_devices> <model_id> <output_prefix> <num_prompt_samples>"
11
+ echo " Example: $0 \" 0,1\" \" /path/to/model\" \" model-prefix-\" 12345"
12
+ exit 1
13
+ fi
14
+
15
+ # Assuming the 'data' sub-folder is in the default location.
16
+ DATA=" data"
17
+ STEMS=" $DATA /prompt_stems.json"
18
+ PROMPTS=" $DATA /writing_prompts.txt"
19
+
20
+ # Assign arguments to variables
21
+ CUDA_DEVICES=" $1 "
22
+ MODEL_ID=" $2 "
23
+ OUTPUT_PREFIX=" $3 "
24
+ NUM_PROMPT_SAMPLES=" $4 "
25
+
26
+ # Define arrays for continuations and output suffixes
27
+ continuations=(
28
+ " $DATA /writing_style_continuations/character_focus.json"
29
+ " $DATA /writing_style_continuations/language.json"
30
+ " $DATA /writing_style_continuations/storytelling.json"
31
+ " $DATA /dark_tetrad_continuations/compassion_vs_sadism.json"
32
+ " $DATA /dark_tetrad_continuations/empathy_vs_sociopathy.json"
33
+ " $DATA /dark_tetrad_continuations/honesty_vs_machiavellianism.json"
34
+ " $DATA /dark_tetrad_continuations/humility_vs_narcissism.json"
35
+ " $DATA /other_continuations/optimism_vs_nihilism.json"
36
+ )
37
+
38
+ output_suffixes=(
39
+ " character_focus_"
40
+ " language_"
41
+ " storytelling_"
42
+ " compassion_vs_sadism_"
43
+ " empathy_vs_sociopathy_"
44
+ " honesty_vs_machiavellianism_"
45
+ " humility_vs_narcissism_"
46
+ " optimism_vs_nihilism_"
47
+ )
48
+
49
+ # Set CUDA_VISIBLE_DEVICES
50
+ export CUDA_VISIBLE_DEVICES=" $CUDA_DEVICES "
51
+
52
+ # Loop through continuations and create control vectors
53
+ for i in " ${! continuations[@]} " ; do
54
+ python3 ./create_control_vectors.py \
55
+ --model_id " $MODEL_ID " \
56
+ --output_path " ${OUTPUT_PREFIX}${output_suffixes[i]} " \
57
+ --prompt_stems_file " $STEMS " \
58
+ --writing_prompts_file " $PROMPTS " \
59
+ --continuations_file " ${continuations[i]} " \
60
+ --num_prompt_samples " $NUM_PROMPT_SAMPLES "
61
+ done
0 commit comments