|
#!/bin/bash |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
current_time=$(date +"%d-%m_%H-%M") |
|
OUTPUT_DIR="./training_outputs_job_${SLURM_ARRAY_JOB_ID}_${SLURM_ARRAY_TASK_ID}_${current_time}" |
|
export DEFAULT_CONFIG_FILE="./config/config1.yaml" |
|
|
|
while test $# -gt 0; do |
|
echo $1 |
|
case "$1" in |
|
--output_dir) |
|
shift |
|
OUTPUT_DIR=$1 |
|
shift |
|
;; |
|
esac |
|
done |
|
|
|
mkdir_is_exists() { |
|
if [ -d "$1" ]; then |
|
echo "Directory '$1' already exists." |
|
else |
|
mkdir -p "$1" |
|
echo "Directory '$1' created." |
|
fi |
|
} |
|
|
|
|
|
mkdir_is_exists $OUTPUT_DIR |
|
mkdir_is_exists $OUTPUT_DIR/experiment_code |
|
git log -n 1 > $OUTPUT_DIR/commit.txt |
|
pip freeze > $OUTPUT_DIR/pip_freeze.txt |
|
echo $0 $ARGS $current_time > $OUTPUT_DIR/cmd.txt |
|
cp -r ./run_clm.py $OUTPUT_DIR/experiment_code |
|
cp -r ./prepare_sharegpt.py $OUTPUT_DIR/experiment_code |
|
cp -r config $OUTPUT_DIR/experiment_code |
|
cp -r ./submit_job.sh $OUTPUT_DIR/experiment_code |
|
cp -r ./requirements.txt $OUTPUT_DIR/experiment_code |
|
|
|
|
|
declare -A scripts_and_inputs=( |
|
["1"]="./config/config1.yaml" |
|
|
|
|
|
|
|
|
|
) |
|
|
|
|
|
echo "Starting job array task: $SLURM_ARRAY_TASK_ID" |
|
PARAMS="--output_dir $OUTPUT_DIR --logging_dir $OUTPUT_DIR --config_file ${scripts_and_inputs[$SLURM_ARRAY_TASK_ID]}" |
|
|
|
srun --exclusive python run_clm.py $PARAMS 2>&1 | tee $OUTPUT_DIR/log.txt |
|
|
|
|
|
|
|
wait |
|
|
|
|
|
echo "All Python scripts have been executed." |