File size: 2,102 Bytes
cb31cb8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/bin/sh
# prepare_training.sh
# author: Julie Kallini

readonly MISTRAL_PATH=/nlp/scr/kallini/mistral

echo "
-------------------------------------------------------------------------------
Arguments
-------------------------------------------------------------------------------
"
echo "Perturbation type: $1"
echo "Train set: $2"
echo "Random seed: $3"
echo "Paren pretrained model: $4"
NO_POS_ENCODINGS=${5:-''}
echo "No pos encodings: $NO_POS_ENCODINGS"
echo "Mistral path: $MISTRAL_PATH"

if [ -z "$NO_POS_ENCODINGS" ]
then
    NPS=""
    NPSunderscore=""
else
    NPS="-no-positional-encodings"
    NPSunderscore="_no_positional_encodings"
fi

# Generate yaml files for mistral training
echo "
-------------------------------------------------------------------------------
Generating yaml files for mistral training
-------------------------------------------------------------------------------
"
GENERATE_YAML_COMMAND="python3 generate_yaml.py $1 $2 $3 $4 $NO_POS_ENCODINGS"
echo $GENERATE_YAML_COMMAND
eval $GENERATE_YAML_COMMAND

# Copy yaml files to mistral directory
echo "
-------------------------------------------------------------------------------
Copying config yaml files to mistral directory
-------------------------------------------------------------------------------
"
COPY_DATASET_COMMAND="cp conf/babylm_$1_$2_$4$NPSunderscore/seed$3/dataset_$1_$2_seed$3.yaml $MISTRAL_PATH/conf/datasets/dataset_$1_$2_seed$3.yaml"
echo $COPY_DATASET_COMMAND
eval $COPY_DATASET_COMMAND
echo ""

COPY_TRAIN_COMMAND="cp conf/babylm_$1_$2_$4$NPSunderscore/seed$3/train_$1_$2_$4$NPSunderscore"_"seed$3.yaml $MISTRAL_PATH/conf/train_$1_$2_$4$NPSunderscore"_"seed$3.yaml"
echo $COPY_TRAIN_COMMAND
eval $COPY_TRAIN_COMMAND
echo ""

COPY_MODEL_COMMAND="cp conf/babylm_$1_$2_$4$NPSunderscore/gpt2$NPS-small-$1-$4.yaml $MISTRAL_PATH/conf/models/gpt2$NPS-small-$1-$4.yaml"
echo $COPY_MODEL_COMMAND
eval $COPY_MODEL_COMMAND

echo "
-------------------------------------------------------------------------------
Done!
-------------------------------------------------------------------------------
"