-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scripts to execute in the GPU cluster advances #26
- Loading branch information
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# Define the ranges for each parameter | ||
learning_rates=(0.0001 0.001 0.01) | ||
batch_sizes=(16 32 64) | ||
num_epochs=(2 5 10) | ||
optimizers=(Adam RMSProp SGD) | ||
loss_functions=(CrossEntropyLoss MeanSquaredError) | ||
|
||
# Define the config file and output directory | ||
config_file="config.yaml" | ||
output_dir="experiments" | ||
|
||
# Create the output directory if it doesn't exist | ||
mkdir -p "$output_dir" | ||
|
||
# Loop through each combination of parameters | ||
for lr in "${learning_rates[@]}"; do | ||
for bs in "${batch_sizes[@]}"; do | ||
for ne in "${num_epochs[@]}"; do | ||
for opt in "${optimizers[@]}"; do | ||
for lf in "${loss_functions[@]}"; do | ||
# Create a new config file with the modified parameters | ||
new_config_file="$output_dir/config_lr_${lr}_bs_${bs}_ne_${ne}_opt_${opt}_lf_${lf}.yaml" | ||
cp "$config_file" "$new_config_file" | ||
|
||
# Modify the parameters in the new config file | ||
sed -i "s/learning_rate:.*/learning_rate: $lr/" "$new_config_file" | ||
sed -i "s/batch_size:.*/batch_size: $bs/" "$new_config_file" | ||
sed -i "s/num_epochs:.*/num_epochs: $ne/" "$new_config_file" | ||
sed -i "s/optimizer:.*/optimizer:\n type: \"$opt\"/" "$new_config_file" | ||
sed -i "s/loss_function:.*/loss_function:\n type: \"$lf\"/" "$new_config_file" | ||
|
||
# Run the training process with the new config file | ||
python train.py --config "$new_config_file" | ||
done | ||
done | ||
done | ||
done | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
#SBATCH --job-name LR_EfficientNetB0 # Nombre del proceso | ||
|
||
#SBATCH --partition dios # Cola para ejecutar | ||
|
||
#SBATCH --gres=gpu:1 # Numero de gpus a usar | ||
|
||
|
||
|
||
export PATH="/opt/anaconda/anaconda3/bin:$PATH" | ||
|
||
export PATH="/opt/anaconda/bin:$PATH" | ||
|
||
eval "$(conda shell.bash hook)" | ||
|
||
conda activate /mnt/homeGPU/polivares/tda-nn-separability | ||
|
||
export TFHUB_CACHE_DIR=. | ||
|
||
python find_learning_rates.py | ||
|
||
mail -s "Proceso finalizado" [email protected] <<< "El proceso ha finalizado" |