#!/bin/bash


if [ $# -ne 4 ]; then
    echo "$0 <exp_dir/: dir> <exp_name: str> <data_path: dir> <tsks_dir: dir>"
    echo "  require 4 args. given $#"
    exit ;
fi

PRE=/mnt/matylda4/kesiraju/code/XLM

mkdir -p $1
exp_dir=`realpath $1`

exp_name=$2

data_path=`realpath $3`

mkdir -p $4
tsks_dir=$4

. activate_python.sh

python=`which python`

epoch_size=10000
max_epoch=1000
bsize=64

dump_path=${exp_dir}/dumps/
log_file=${exp_dir}/${exp_name}.log

emb_dim=512
n_layers=6
n_heads=4
dropout=0.3
attn_dropout=0.0
optimizer="adam,lr=0.0002"


echo "(( $python ${PRE}/train.py \
--exp_name ${exp_name} \
--data_path ${data_path} \
--dump_path ${dump_path} \
--lgs en-pt \
--clm_steps \"\" \
--mlm_steps \"en,pt\" \
--encoder_only true \
--emb_dim ${emb_dim} \
--n_layers ${n_layers} \
--n_heads ${n_heads} \
--dropout ${dropout} \
--attention_dropout ${attn_dropout} \
--epoch_size ${epoch_size} \
--max_epoch ${max_epoch} \
--batch_size ${bsize} \
--optimizer ${optimizer} \
--safe_gpu ) 2 >&1 ) >> ${log_file} " > ${tsks_dir}/mlm_en-pt.sh
