-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathslurm_script.sh
More file actions
44 lines (36 loc) · 1.4 KB
/
slurm_script.sh
File metadata and controls
44 lines (36 loc) · 1.4 KB
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
42
43
#!/bin/sh
#SBATCH --job-name=training-transformer
#SBATCH --gpus=a100-80:1
#SBATCH --output=results/training_job_output.txt
#SBATCH --error=results/training_job_error.txt
#SBATCH --time=3:00:00
#SBATCH --mail-type=BEGIN,END,FAIL
#SBATCH --mail-user=e0725272@u.nus.edu
# Default model is BERT if not specified
MODEL=${1:-bert}
echo "job is running on $(hostname), started at $(date)"
echo "Training model: $MODEL"
echo "\n--- Installing packages ---\n"
pip install torch pandas transformers scikit-learn
echo "\n--- Finished installing packages, starting model training ---\n"
start_time=$(date +%s)
if [ "$MODEL" = "roberta" ]; then
echo "Running RoBERTa model training..."
srun python training_scripts/roberta_classification.py
elif [ "$MODEL" = "albert" ]; then
echo "Running ALBERT model training..."
srun python training_scripts/albert_classification.py
elif [ "$MODEL" = "distilbert" ]; then
echo "Running DistilBERT model training..."
srun python training_scripts/distilbert_classification.py
elif [ "$MODEL" = "sbert" ]; then
echo "Running Sentence-BERT model training..."
srun python training_scripts/sbert_classification.py
else
echo "Running BERT model training..."
srun python training_scripts/bert_classification.py
fi
end_time=$(date +%s)
exec_time=$((end_time - start_time))
echo -e "\nJob completed at $(date)\n"
echo -e "total execution time: $exec_time seconds\n"