kad-ecoli / rna3db

maintain local copy of RNA structure database
0 stars 0 forks source link

Training script #13

Open marc-harary opened 3 years ago

marc-harary commented 3 years ago


# USAGE:
# % train.sh CONF,
# where CONF contains both .lst file and command line arguments
# for mxfold2'

IMG=/home/mah258/Pyle/mxfold2/mxfold2.simg
SEQS=/home/mah258/Pyle/data/pdb-cleaned/VL/VL-sequences
LABS=/home/mah258/Pyle/data/pdb-cleaned/VL/VL-labels
OUTPUT=output.csv
BEST=best.pt

dir=$(dirname $0)
out_conf=$(grep -A1 save-config $1 | tail -n 1)
epochs=$(grep -A1 epochs $1 | tail -n 1)
list=$(grep -A1 list $1 | tail -n 1)
param=$(grep -A1 param $1 | tail -n 1)
in_conf=$(sed -e 'N; /--list\n.*$/d' -e 'N; s/epochs\n.*$/epochs\n1/' $1)

echo "Running epoch 1..."
min_mcc=$(singularity exec $IMG mxfold2 train $list $in_conf; \
        python3 $dir/eval.py $IMG $SEQS $LABS $out_conf $OUTPUT; \
        python3 $dir/get_mcc.py $OUTPUT)

in_conf=

for epoch in $(seq 2 $(($epochs - 1))); do
    echo "Running epoch $epoch..."
    cur_mcc=$(singularity exec $IMG mxfold2 train $list $in_conf; \
        python3 $dir/eval.py $IMG $SEQS $LABS $out_conf $OUTPUT; \
        python3 $dir/get_mcc.py $OUTPUT)
    if [[ $cur_mcc < $min_mcc ]]; then
        min_mcc=$cur_mcc
        cp $param $BEST 
    fi  
done
marc-harary commented 3 years ago

# % train.sh CONF,
# where CONF contains both .lst file and command line arguments
# for mxfold2'

IMG=/home/mah258/Pyle/mxfold2/mxfold2.simg
SEQS=/home/mah258/Pyle/data/pdb-cleaned/VL/VL-sequences
LABS=/home/mah258/Pyle/data/pdb-cleaned/VL/VL-labels
OUTPUT=output.csv
BEST=best.pt

dir=$(dirname $0)
out_conf=$(grep -A1 save-config $1 | tail -n 1)
epochs=$(grep -A1 epochs $1 | tail -n 1)
list=$(grep -A1 list $1 | tail -n 1)
param=$(grep -A1 param $1 | tail -n 1)
in_conf=$(sed -e 'N; /--list\n.*$/d' -e 'N; s/epochs\n.*$/epochs\n1/' $1)

echo "Running epoch 1..."
min_mcc=$(singularity exec $IMG mxfold2 train $list $in_conf; \
        python3 $dir/eval.py $IMG $SEQS $LABS $out_conf $OUTPUT; \
        python3 $dir/get_mcc.py $OUTPUT)

for epoch in $(seq 2 $(($epochs - 1))); do
 in_conf="$in_conf --resume $log_dir/epoch-$(($epoch -1))"
    echo "Running epoch $epoch..."
    cur_mcc=$(singularity exec $IMG mxfold2 train $list $in_conf; \
        python3 $dir/eval.py $IMG $SEQS $LABS $out_conf $OUTPUT; \
        python3 $dir/get_mcc.py $OUTPUT)
    if [[ $cur_mcc < $min_mcc ]]; then
        min_mcc=$cur_mcc
        cp $param $BEST 
    fi  
done
marc-harary commented 3 years ago

TR.lst
--init-param
param.pt
--param
param.pt
--save-config
opt.conf
--epochs
100
--max-helix-length
30
--embed-size
64
--num-filters
64
--num-filters
64
--num-filters
64
--num-filters
64
--num-filters
64
--num-filters
64
--num-filters
64
--num-filters
64
--filter-size
5
--filter-size
3
--filter-size
5
--filter-size
3
--filter-size
5
--filter-size
3
--filter-size
5
--filter-size
3
--pool-size
1
--dilation
0
--num-lstm-layers
2
--num-lstm-units
32
--num-transformer-layers
0
--num-transformer-hidden-units
2048
--num-transformer-att
8
--num-hidden-units
32
--num-paired-filters
64
--num-paired-filters
64
--num-paired-filters
64
--num-paired-filters
64
--num-paired-filters
64
--num-paired-filters
64
--num-paired-filters
64
--num-paired-filters
64
--paired-filter-size
5
--paired-filter-size
3
--paired-filter-size
5
--paired-filter-size
3
--paired-filter-size
5
--paired-filter-size
3
--paired-filter-size
5
--paired-filter-size
3
--dropout-rate
0.5
--fc-dropout-rate
0.5
--num-att
8
--pair-join
cat
--model
MixC