harbor run -t openthoughts/tasktrove-exp-rpt-stack-bash-withtests-gpt5mini-v2-stack-bash-withtests-gpt4o-0616harbor download openthoughts/tasktrove-exp-rpt-stack-bash-withtests-gpt5mini-v2-stack-bash-withtests-gpt4o-0616Create a shell script /app/run_dispnet_training_philly.sh that wraps and launches a DispNet training job. The script must:
Accept and parse these command-line options (support both short and long forms):
Maintain default values of NONE for DATA_DIR, LOG_DIR, CONFIG_DIR, MODEL_DIR if not provided.
When the config-file-dir option is supplied, capture the directory (use dirname) and assign it to CONFIG_DIR (not the full file path).
After parsing, the script must print the four variable values (exact lines):
(Each on its own line, exactly with those labels and an equals sign.)
Export PYTHONPATH by appending CONFIG_DIR to any existing PYTHONPATH:
Launch the training Python script located under the config directory at:
Map the parsed variables into the Python command line as follows:
In addition to these, pass a fixed set of training options (these are required by the task). Include them exactly as additional flags on the python command:
The script must be placed at /app/run_dispnet_training_philly.sh and marked executable.
Behavior summary / example:
Implement the script exactly as described so it correctly sets up the environment, prints the variables, and launches the Python training command with the specified arguments.
The following test script will be used to verify your solution:
#!/bin/bash
# This script parses in the command line parameters from runCust,
# maps them to the correct command line parameters for DispNet training script and launches that task
# The last line of runCust should be: bash $CONFIG_FILE --data-dir $DATA_DIR --log-dir $LOG_DIR
# Parse the command line parameters
# that runCust will give out
DATA_DIR=NONE
LOG_DIR=NONE
CONFIG_DIR=NONE
MODEL_DIR=NONE
# Parsing command line arguments:
while [[ $# > 0 ]]
do
key="$1"
case $key in
-h|--help)
echo "Usage: run_dispnet_training_philly.sh [run_options]"
echo "Options:"
echo " -d|--data-dir <path> - directory path to input data (default NONE)"
echo " -l|--log-dir <path> - directory path to save the log files (default NONE)"
echo " -p|--config-file-dir <path> - directory path to config file directory (default NONE)"
echo " -m|--model-dir <path> - directory path to output model file (default NONE)"
exit 1
;;
-d|--data-dir)
DATA_DIR="$2"
shift # pass argument
;;
-p|--config-file-dir)
CONFIG_DIR=`dirname $2`
shift # pass argument
;;
-m|--model-dir)
MODEL_DIR="$2"
shift # pass argument
;;
-l|--log-dir)
LOG_DIR="$2"
shift
;;
*)
echo Unkown option $key
;;
esac
shift # past argument or value
done
# Prints out the arguments that were passed into the script
echo "DATA_DIR=$DATA_DIR"
echo "LOG_DIR=$LOG_DIR"
echo "CONFIG_DIR=$CONFIG_DIR"
echo "MODEL_DIR=$MODEL_DIR"
# Run training on philly
# Add the root folder of the code to the PYTHONPATH
export PYTHONPATH=$PYTHONPATH:$CONFIG_DIR
# Run the actual job
python $CONFIG_DIR/anytime_models/examples/imagenet-dense-ann.py \
--data_dir=$DATA_DIR \
--log_dir=$LOG_DIR \
--model_dir=$MODEL_DIR \
--load=${MODEL_DIR}/checkpoint \
-f=10 --samloss=6 --densenet_depth=265 -s=24 --batch_size=128 --nr_gpu=4 --densenet_version=dense --min_predict_unit=10 --reduction_ratio=0.5 --dropout_kp=0.9 --opt_at=-1 -g=32 --num_classes=1000