summaryrefslogtreecommitdiff
path: root/src/tasks
diff options
context:
space:
mode:
authoraktersnurra <gustaf.rydholm@gmail.com>2020-10-22 22:45:58 +0200
committeraktersnurra <gustaf.rydholm@gmail.com>2020-10-22 22:45:58 +0200
commit4d7713746eb936832e84852e90292936b933e87d (patch)
tree2b2519d1d2ce53d4e1390590f52018d55dadbc7c /src/tasks
parent1b3b8073a19f939d18a0bb85247eb0d99284f7cc (diff)
Transfomer added, many other changes.
Diffstat (limited to 'src/tasks')
-rwxr-xr-xsrc/tasks/train.sh67
-rwxr-xr-xsrc/tasks/train_crnn_line_ctc_model.sh5
-rwxr-xr-xsrc/tasks/train_embedding_model.sh5
3 files changed, 67 insertions, 10 deletions
diff --git a/src/tasks/train.sh b/src/tasks/train.sh
new file mode 100755
index 0000000..1fbc8d7
--- /dev/null
+++ b/src/tasks/train.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+# Add checkpoint and resume experiment
+usage() {
+ cat << EOF
+ usage: ./tasks/train_crnn_line_ctc_model.sh
+ -f | --experiment_config Name of the experiment config.
+ -c | --checkpoint (Optional) The experiment name to continue from.
+ -p | --pretrained_weights (Optional) Path to pretrained weights.
+ -n | --notrain (Optional) Evaluates a trained model.
+ -t | --test (Optional) If set, evaluates the model on test set.
+ -v | --verbose (Optional) Sets the verbosity.
+ -h | --help Shows this message.
+EOF
+exit 1
+}
+
+experiment_config=""
+checkpoint=""
+pretrained_weights=""
+notrain=""
+test=""
+verbose=""
+train_command=""
+
+while getopts 'f:c:p:nthv' flag; do
+ case "${flag}" in
+ f) experiment_config="${OPTARG}" ;;
+ c) checkpoint="${OPTARG}" ;;
+ p) pretrained_weights="${OPTARG}" ;;
+ n) notrain="--notrain" ;;
+ t) test="--test" ;;
+ v) verbose="${verbose}v" ;;
+ h) usage ;;
+ *) error "Unexpected option ${flag}" ;;
+ esac
+done
+
+
+if [ -z ${experiment_config} ];
+then
+ echo "experiment_config not specified!"
+ usage
+ exit 1
+fi
+
+experiments_filename="training/experiments/${experiment_config}"
+train_command=$(./tasks/prepare_experiments.sh $experiments_filename)
+
+if [ ${checkpoint} ];
+then
+ train_command="${train_command} --checkpoint $checkpoint"
+fi
+
+if [ ${pretrained_weights} ];
+then
+ train_command="${train_command} --pretrained_weights $pretrained_weights"
+fi
+
+if [ ${verbose} ];
+then
+ train_command="${train_command} -$verbose"
+fi
+
+
+echo $train_command $notrain $test
+eval $train_command $notrain $test
diff --git a/src/tasks/train_crnn_line_ctc_model.sh b/src/tasks/train_crnn_line_ctc_model.sh
deleted file mode 100755
index 020c4a6..0000000
--- a/src/tasks/train_crnn_line_ctc_model.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-experiments_filename=${1:-training/experiments/line_ctc_experiment.yml}
-OUTPUT=$(./tasks/prepare_experiments.sh $experiments_filename)
-echo $OUTPUT
-eval $OUTPUT
diff --git a/src/tasks/train_embedding_model.sh b/src/tasks/train_embedding_model.sh
deleted file mode 100755
index da59116..0000000
--- a/src/tasks/train_embedding_model.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-experiments_filename=${1:-training/experiments/embedding_experiment.yml}
-OUTPUT=$(./tasks/prepare_experiments.sh $experiments_filename)
-echo $OUTPUT
-eval $OUTPUT