forked from mast-group/OpenVocabCodeNLM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
41 lines (33 loc) · 2.19 KB
/
entrypoint.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
#!/bin/bash
# Entrypoint for OpenVocabCodeNLM Experiment
# This file invokes the original python code of the openvocabcodenlm with the environment variables set in the docker container.
# Additionally, it does a switch-case which flags for training, validation and testing have been set.
# Run mkdir Model_dir, in case it does not exist yet (if you start with training)
mkdir $MODEL_DIR
# Training the model
if [ "$DO_TRAIN" = true ]; then
if [ "$VERBOSE" = true ]; then
python code_nlm.py --data_path $DATA_HOME --train_dir $MODEL_DIR --train_filename $TRAIN_FILE --validation_filename $VALIDATION_FILE --gru True --hidden_size $STATE_DIMS --batch_size $BATCH_SIZE --word_level_perplexity True --cross_entropy True --steps_per_checkpoint $CHECKPOINT_EVERY --max_epoch $EPOCHS --verbose True
else
python code_nlm.py --data_path $DATA_HOME --train_dir $MODEL_DIR --train_filename $TRAIN_FILE --validation_filename $VALIDATION_FILE --gru True --hidden_size $STATE_DIMS --batch_size $BATCH_SIZE --word_level_perplexity True --cross_entropy True --steps_per_checkpoint $CHECKPOINT_EVERY --max_epoch $EPOCHS
fi
fi
# Testing the model (Calculating test set entropy)
if [ "$DO_TEST" = true ]; then
if [ "$VERBOSE" = true ]; then
python code_nlm.py --test True --data_path $DATA_HOME --train_dir $MODEL_DIR --test_filename $TEST_FILE --gru True --batch_size $BATCH_SIZE --word_level_perplexity True --cross_entropy True --verbose True
else
python code_nlm.py --test True --data_path $DATA_HOME --train_dir $MODEL_DIR --test_filename $TEST_FILE --gru True --batch_size $BATCH_SIZE --word_level_perplexity True --cross_entropy True
fi
fi
# Code completion
if [ "$DO_COMPLETION" = true ]; then
if [ "$VERBOSE" = true ]; then
python code_nlm.py --completion True --data_path $DATA_HOME --train_dir $MODEL_DIR --test_filename $TEST_FILE --gru True --batch_size $BATCH_SIZE --verbose True
else
python code_nlm.py --completion True --data_path $DATA_HOME --train_dir $MODEL_DIR --test_filename $TEST_FILE --gru True --batch_size $BATCH_SIZE
fi
fi
# Add this to keep the container open (e.g. for debugging or inspection)
#echo "Entrypoint finished - keeping container artifially open ..."
#tail -f /dev/null