-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrain_late_fusion.sh
204 lines (167 loc) · 5.15 KB
/
train_late_fusion.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#!/bin/bash
TRAIN=True
TEST=True
ABLATION=False
WINDOW=12
# dataset="meld"
dataset="iemocap"
model="LLaMA2-base"
experiment_suffix="audio_only_pretraining"
while [ $# -gt 0 ]; do
case "$1" in
--dataset)
dataset=$2
shift
;;
--experiment_suffix)
experiment_suffix=$2
shift
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
shift
done
experiment="late_fusion/final/$dataset/$model/$experiment_suffix"
LANGUAGE_MODEL="/home/fock/code/MultiModalInstructERC/models/language/$model"
LORA_ADAPTER="/home/fock/code/MultiModalInstructERC/models/language/adapter/$dataset/$model"
ACOUSTIC_MODEL="/home/fock/code/MultiModalInstructERC/models/acoustic/wav2vec2/wav2vec2-large-robust-12-ft-emotion-msp-dim"
OUTPUT_PATH="/home/fock/code/MultiModalInstructERC/experiments/multimodal/$experiment/"
DS_BASE="/home/fock/code/MultiModalInstructERC/datasets/$dataset"
if [ $dataset = "meld" ]; then
DS_TRAIN_PATH="$DS_BASE/train_sent_emo.csv"
DS_DEV_PATH="$DS_BASE/dev_sent_emo.csv"
DS_TEST_PATH="$DS_BASE/test_sent_emo.csv"
stage_1_lr=1e-4
stage_1_weight_decay=1e-2
elif [ $dataset = "iemocap" ]; then
DS_TRAIN_PATH="$DS_BASE/iemocap.csv"
DS_DEV_PATH="$DS_BASE/iemocap.csv"
DS_TEST_PATH="$DS_BASE/iemocap.csv"
stage_1_lr=2e-4
stage_1_weight_decay=1e-4
else
echo "Invalid dataset"
exit 1
fi
stage_1_path=$OUTPUT_PATH"stage_1/"
stage_2_path=$OUTPUT_PATH"stage_2/"
stage_3_path=$OUTPUT_PATH"stage_3/"
output_path=$stage_3_path
if [ "$TRAIN" = "True" ]; then
echo "Running stage 1"
accelerate launch ./run_scripts/main_late_fusion.py \
--batch_size 8 \
--gradient_accumulation_steps 4 \
--llm_id $LANGUAGE_MODEL \
--acoustic_id $ACOUSTIC_MODEL \
--adapter_id $LORA_ADAPTER \
--output_path $stage_1_path \
--train_dataset $DS_TRAIN_PATH \
--test_dataset $DS_TEST_PATH \
--dev_dataset $DS_DEV_PATH \
--task "normal" \
--epochs 15 \
--lr 2e-4 \
--min_lr_ratio 0.2 \
--warmup_ratio 0.1 \
--weight_decay 1e-4 \
--stage 1 \
--window_size $WINDOW \
if [ $? -ne 0 ]; then
echo "An error occurred. Terminating."
exit 1
fi
output_path=$stage_1_path
echo "Running stage 2"
accelerate launch ./run_scripts/main_late_fusion.py \
--batch_size 8 \
--gradient_accumulation_steps 4 \
--llm_id $LANGUAGE_MODEL \
--acoustic_id $ACOUSTIC_MODEL \
--adapter_id $LORA_ADAPTER \
--output_path $stage_2_path \
--checkpoint_path $stage_1_path \
--train_dataset $DS_TRAIN_PATH \
--test_dataset $DS_TEST_PATH \
--dev_dataset $DS_DEV_PATH \
--task "normal" \
--epochs 4 \
--lr 2e-5 \
--min_lr_ratio 0.2 \
--warmup_ratio 0.1 \
--weight_decay 1e-3 \
--stage 2 \
--window_size $WINDOW \
if [ $? -ne 0 ]; then
echo "An error occurred. Terminating."
exit 1
fi
output_path=$stage_2_path
echo "Running stage 3"
accelerate launch ./run_scripts/main_late_fusion.py \
--batch_size 8 \
--gradient_accumulation_steps 4 \
--llm_id $LANGUAGE_MODEL \
--acoustic_id $ACOUSTIC_MODEL \
--adapter_id $LORA_ADAPTER \
--output_path $stage_3_path \
--checkpoint_path $stage_2_path \
--train_dataset $DS_TRAIN_PATH \
--test_dataset $DS_TEST_PATH \
--dev_dataset $DS_DEV_PATH \
--task "normal" \
--epochs 15 \
--lr 5e-5 \
--min_lr_ratio 0.5 \
--warmup_ratio 0.1 \
--weight_decay 1e-3 \
--stage 3 \
--window_size $WINDOW \
if [ $? -ne 0 ]; then
echo "An error occurred. Terminating."
exit 1
fi
output_path=$stage_3_path
fi
if [ "$TEST" = "True" ]; then
echo "Running evaluation"
python run_scripts/main_late_fusion.py \
--evaluation \
--llm_id $LANGUAGE_MODEL \
--acoustic_id $ACOUSTIC_MODEL \
--adapter_id $LORA_ADAPTER \
--output_path $output_path \
--test_dataset $DS_TEST_PATH \
--dev_dataset $DS_DEV_PATH \
--window_size $WINDOW \
--batch_size 8
fi
if [ "$ABLATION" = "True" ]; then
output_path=$stage_3_path
echo "Running ablation"
python run_scripts/main_late_fusion.py \
--evaluation \
--llm_id $LANGUAGE_MODEL \
--acoustic_id $ACOUSTIC_MODEL \
--adapter_id $LORA_ADAPTER \
--output_path $stage_1_path \
--test_dataset $DS_TEST_PATH \
--dev_dataset $DS_DEV_PATH \
--window_size $WINDOW \
--batch_size 8 \
--ignore_text
python run_scripts/main_late_fusion.py \
--evaluation \
--llm_id $LANGUAGE_MODEL \
--acoustic_id $ACOUSTIC_MODEL \
--adapter_id $LORA_ADAPTER \
--output_path $stage_2_path \
--test_dataset $DS_TEST_PATH \
--dev_dataset $DS_DEV_PATH \
--window_size $WINDOW \
--batch_size 8 \
--ignore_audio
fi