Skip to content

Commit 07b5037

Browse files
Praroop ChandaPraroop Chanda
Praroop Chanda
authored and
Praroop Chanda
committed
HyperOpt-ASHA for Contrastive Learning Models
0 parents  commit 07b5037

File tree

99 files changed

+8145
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+8145
-0
lines changed

.DS_Store

8 KB
Binary file not shown.

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.pth filter=lfs diff=lfs merge=lfs -text
2+
SogCLR_AdamW_checkpoint.pth filter=lfs diff=lfs merge=lfs -text

DL_Final_Report.pdf

425 KB
Binary file not shown.

Eval_Job_Runs/EvalJob_clip_adamW.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
3+
##NECESSARY JOB SPECIFICATIONS
4+
#SBATCH --time=1:00:00
5+
#SBATCH --mem=40G
6+
#SBATCH --ntasks=1
7+
#SBATCH --ntasks-per-node=1
8+
#SBATCH --cpus-per-task=8
9+
#SBATCH --gpus-per-task=1
10+
#SBATCH --partition=gpu
11+
#SBATCH --output=final_eval_clip_adamW.out
12+
13+
#First Executable Line
14+
conda init
15+
export HF_DATASETS_OFFLINE=1
16+
export HF_HUB_OFFLINE=1
17+
export TRANSFORMERS_OFFLINE=1
18+
source ~/.bashrc
19+
conda activate myenv
20+
cd ./iSogCLR
21+
echo "Running file"
22+
23+
#export PYTHONPATH="$PYTHONPATH:./bimodal_exps"
24+
#export HUGGINGFACE_HUB_CACHE='./checkpoints/huggingface'
25+
26+
data_path=../datasets
27+
ann_path=../clip_train
28+
train_image_root=cc3m_subset_100k/
29+
data=cc3m
30+
train_file=${data}_train_subset_90.json
31+
gamma=0.8
32+
epochs=30
33+
ita_type=clip
34+
35+
CUDA_VISIBLE_DEVICES=0 python ./iSogCLR/bimodal_exps/clip2.py \
36+
--data_path ${data_path} \
37+
--ann_path ${ann_path} \
38+
--train_file ${train_file} \
39+
--train_image_root ${train_image_root} \
40+
--output_dir ../datasets/Besteval/clip_adamW \
41+
--init_model \
42+
--use_amp \
43+
--ita_type ${ita_type} \
44+
--tau_init 0.01 \
45+
--sogclr_gamma ${gamma} \
46+
--eta_init 0.03 --sched cosine \
47+
--no-distributed \
48+
--lr 6.732199259338269e-05 \
49+
--temp 0.06547641559385874 \
50+
--epochs ${epochs} \
51+
--evaluate --checkpoint ../datasets/Bestoutput/clip_adamw/checkpoint_26.pth \
52+
--zs_dataset imagenet --zs_datafolder ../datasets/imagenet/val
53+
54+

Eval_Job_Runs/EvalJob_clip_nadam.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
##NECESSARY JOB SPECIFICATIONS
4+
#SBATCH --time=1:00:00
5+
#SBATCH --mem=40G
6+
#SBATCH --ntasks=1
7+
#SBATCH --ntasks-per-node=1
8+
#SBATCH --cpus-per-task=8
9+
#SBATCH --gpus-per-task=1
10+
#SBATCH --partition=gpu
11+
#SBATCH --output=final_eval_clip_nadam.out
12+
13+
#First Executable Line
14+
conda init
15+
export HF_DATASETS_OFFLINE=1
16+
export HF_HUB_OFFLINE=1
17+
export TRANSFORMERS_OFFLINE=1
18+
source ~/.bashrc
19+
conda activate myenv
20+
cd ./iSogCLR
21+
echo "Running file"
22+
23+
#export PYTHONPATH="$PYTHONPATH:./bimodal_exps"
24+
#export HUGGINGFACE_HUB_CACHE='./checkpoints/huggingface'
25+
26+
data_path=../datasets
27+
ann_path=../clip_train
28+
train_image_root=cc3m_subset_100k/
29+
data=cc3m
30+
train_file=${data}_train_subset_90.json
31+
gamma=0.8
32+
epochs=30
33+
ita_type=clip
34+
35+
CUDA_VISIBLE_DEVICES=0 python ./iSogCLR/bimodal_exps/clip2.py \
36+
--data_path ${data_path} \
37+
--ann_path ${ann_path} \
38+
--train_file ${train_file} \
39+
--train_image_root ${train_image_root} \
40+
--output_dir ../datasets/Besteval/clip_nadam \
41+
--init_model \
42+
--opt nadam \
43+
--use_amp \
44+
--ita_type ${ita_type} \
45+
--tau_init 0.01 \
46+
--sogclr_gamma ${gamma} \
47+
--eta_init 0.03 --sched cosine \
48+
--no-distributed \
49+
--lr 0.0001001267832975453 \
50+
--temp 0.0016226846798753232 \
51+
--epochs ${epochs} \
52+
--evaluate --checkpoint ../datasets/Bestoutput/clip_nadam/checkpoint_30.pth \
53+
--zs_dataset imagenet --zs_datafolder ../datasets/imagenet/val
54+
55+

Eval_Job_Runs/EvalJob_cyclip_adamW.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
3+
##NECESSARY JOB SPECIFICATIONS
4+
#SBATCH --time=1:00:00
5+
#SBATCH --mem=40G
6+
#SBATCH --ntasks=1
7+
#SBATCH --ntasks-per-node=1
8+
#SBATCH --cpus-per-task=8
9+
#SBATCH --gpus-per-task=1
10+
#SBATCH --partition=gpu
11+
#SBATCH --output=final_eval_cyclip_adamW.out
12+
13+
#First Executable Line
14+
conda init
15+
export HF_DATASETS_OFFLINE=1
16+
export HF_HUB_OFFLINE=1
17+
export TRANSFORMERS_OFFLINE=1
18+
source ~/.bashrc
19+
conda activate myenv
20+
cd ./iSogCLR
21+
echo "Running file"
22+
23+
#export PYTHONPATH="$PYTHONPATH:./bimodal_exps"
24+
#export HUGGINGFACE_HUB_CACHE='./checkpoints/huggingface'
25+
26+
data_path=../datasets
27+
ann_path=../clip_train
28+
train_image_root=cc3m_subset_100k/
29+
data=cc3m
30+
train_file=${data}_train_subset_90.json
31+
gamma=0.5390333896985938
32+
epochs=30
33+
ita_type=cyclip
34+
35+
CUDA_VISIBLE_DEVICES=0 python ./iSogCLR/bimodal_exps/clip2.py \
36+
--data_path ${data_path} \
37+
--ann_path ${ann_path} \
38+
--train_file ${train_file} \
39+
--train_image_root ${train_image_root} \
40+
--output_dir ../datasets/Besteval/cyclip_adamW \
41+
--init_model \
42+
--use_amp \
43+
--ita_type ${ita_type} \
44+
--tau_init 0.01 \
45+
--sogclr_gamma ${gamma} \
46+
--eta_init 0.03 --sched cosine \
47+
--no-distributed \
48+
--lr 0.0002828819771699495 \
49+
--temp 0.01621707878411723 \
50+
--cylambda_1 0.5940949145191814 \
51+
--cylambda_2 0.4976852107138287 \
52+
--epochs ${epochs} \
53+
--evaluate --checkpoint ../datasets/Bestoutput/cyclip_adamw/checkpoint_30.pth \
54+
--zs_dataset imagenet --zs_datafolder ../datasets/imagenet/val

Eval_Job_Runs/EvalJob_cyclip_nadam.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
##NECESSARY JOB SPECIFICATIONS
4+
#SBATCH --time=1:00:00
5+
#SBATCH --mem=40G
6+
#SBATCH --ntasks=1
7+
#SBATCH --ntasks-per-node=1
8+
#SBATCH --cpus-per-task=8
9+
#SBATCH --gpus-per-task=1
10+
#SBATCH --partition=gpu
11+
#SBATCH --output=final_eval_cyclip_nadam.out
12+
13+
#First Executable Line
14+
conda init
15+
export HF_DATASETS_OFFLINE=1
16+
export HF_HUB_OFFLINE=1
17+
export TRANSFORMERS_OFFLINE=1
18+
source ~/.bashrc
19+
conda activate myenv
20+
cd ./iSogCLR
21+
echo "Running file"
22+
23+
#export PYTHONPATH="$PYTHONPATH:./bimodal_exps"
24+
#export HUGGINGFACE_HUB_CACHE='./checkpoints/huggingface'
25+
26+
data_path=../datasets
27+
ann_path=../clip_train
28+
train_image_root=cc3m_subset_100k/
29+
data=cc3m
30+
train_file=${data}_train_subset_90.json
31+
gamma=0.5390333896985938
32+
epochs=30
33+
ita_type=cyclip
34+
35+
CUDA_VISIBLE_DEVICES=0 python ./iSogCLR/bimodal_exps/clip2.py \
36+
--data_path ${data_path} \
37+
--ann_path ${ann_path} \
38+
--train_file ${train_file} \
39+
--train_image_root ${train_image_root} \
40+
--output_dir ../datasets/Besteval/cyclip_nadam \
41+
--init_model \
42+
--use_amp \
43+
--opt nadam \
44+
--ita_type ${ita_type} \
45+
--tau_init 0.01 \
46+
--sogclr_gamma ${gamma} \
47+
--eta_init 0.03 --sched cosine \
48+
--no-distributed \
49+
--lr 0.00012587716005886245 \
50+
--temp 0.005232218198443648 \
51+
--cylambda_1 0.45384301584103603 \
52+
--cylambda_2 0.6589497618647435 \
53+
--epochs ${epochs} \
54+
--evaluate --checkpoint ../datasets/Bestoutput/cyclip_nadam/checkpoint_30.pth \
55+
--zs_dataset imagenet --zs_datafolder ../datasets/imagenet/val

Eval_Job_Runs/EvalJob_sogclr_adamW.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
##NECESSARY JOB SPECIFICATIONS
4+
#SBATCH --time=1:00:00
5+
#SBATCH --mem=40G
6+
#SBATCH --ntasks=1
7+
#SBATCH --ntasks-per-node=1
8+
#SBATCH --cpus-per-task=8
9+
#SBATCH --gpus-per-task=1
10+
#SBATCH --partition=gpu
11+
#SBATCH --output=final_eval_sogclr_adamW.out
12+
13+
#First Executable Line
14+
conda init
15+
export HF_DATASETS_OFFLINE=1
16+
export HF_HUB_OFFLINE=1
17+
export TRANSFORMERS_OFFLINE=1
18+
source ~/.bashrc
19+
conda activate myenv
20+
cd ./iSogCLR
21+
echo "Running file"
22+
23+
#export PYTHONPATH="$PYTHONPATH:./bimodal_exps"
24+
#export HUGGINGFACE_HUB_CACHE='./checkpoints/huggingface'
25+
26+
data_path=../datasets
27+
ann_path=../clip_train
28+
train_image_root=cc3m_subset_100k/
29+
data=cc3m
30+
train_file=${data}_train_subset_90.json
31+
gamma=0.5390333896985938
32+
epochs=30
33+
ita_type=sogclr
34+
35+
CUDA_VISIBLE_DEVICES=0 python ./iSogCLR/bimodal_exps/clip2.py \
36+
--data_path ${data_path} \
37+
--ann_path ${ann_path} \
38+
--train_file ${train_file} \
39+
--train_image_root ${train_image_root} \
40+
--output_dir ../datasets/Besteval/sogclr_adamW \
41+
--init_model \
42+
--use_amp \
43+
--ita_type ${ita_type} \
44+
--tau_init 0.01 \
45+
--sogclr_gamma ${gamma} \
46+
--eta_init 0.03 --sched cosine \
47+
--no-distributed \
48+
--lr 2.110170394664965e-05 \
49+
--temp 0.0559451134595352 \
50+
--epochs ${epochs} \
51+
--evaluate --checkpoint ../datasets/Bestoutput/sogclr_adamw/checkpoint_25.pth \
52+
--zs_dataset imagenet --zs_datafolder ../datasets/imagenet/val

Eval_Job_Runs/EvalJob_sogclr_nadam.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
##NECESSARY JOB SPECIFICATIONS
4+
#SBATCH --time=1:00:00
5+
#SBATCH --mem=40G
6+
#SBATCH --ntasks=1
7+
#SBATCH --ntasks-per-node=1
8+
#SBATCH --cpus-per-task=8
9+
#SBATCH --gpus-per-task=1
10+
#SBATCH --partition=gpu
11+
#SBATCH --output=final_eval_sogclr_nadam.out
12+
13+
#First Executable Line
14+
conda init
15+
export HF_DATASETS_OFFLINE=1
16+
export HF_HUB_OFFLINE=1
17+
export TRANSFORMERS_OFFLINE=1
18+
source ~/.bashrc
19+
conda activate myenv
20+
cd ./iSogCLR
21+
echo "Running file"
22+
23+
#export PYTHONPATH="$PYTHONPATH:./bimodal_exps"
24+
#export HUGGINGFACE_HUB_CACHE='./checkpoints/huggingface'
25+
26+
data_path=../datasets
27+
ann_path=../clip_train
28+
train_image_root=cc3m_subset_100k/
29+
data=cc3m
30+
train_file=${data}_train_subset_90.json
31+
gamma=0.623548869476773
32+
epochs=30
33+
ita_type=sogclr
34+
35+
CUDA_VISIBLE_DEVICES=0 python ./iSogCLR/bimodal_exps/clip2.py \
36+
--data_path ${data_path} \
37+
--ann_path ${ann_path} \
38+
--train_file ${train_file} \
39+
--train_image_root ${train_image_root} \
40+
--output_dir ../datasets/Besteval/sogclr_nadam \
41+
--init_model \
42+
--opt nadam \
43+
--use_amp \
44+
--ita_type ${ita_type} \
45+
--tau_init 0.01 \
46+
--sogclr_gamma ${gamma} \
47+
--eta_init 0.03 --sched cosine \
48+
--no-distributed \
49+
--lr 0.00041892083091233187 \
50+
--temp 0.05353708355932494 \
51+
--epochs ${epochs} \
52+
--evaluate --checkpoint ../datasets/Bestoutput/sogclr_nadam/checkpoint_30.pth \
53+
--zs_dataset imagenet --zs_datafolder ../datasets/imagenet/val

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
DL-Final Project -636
2+
3+
Team Details:
4+
* Ishaan Singh Rawal
5+
* Praroop Chanda
6+
For any assistance in running the code, please contact: -
7+
8+
9+
README:
10+
* To perform hyperparameter tuning using Ray Tune, execute the job files located in the Ray_Tune_Hyperparameter folder. The files are named in the following format:
11+
12+
MyJobRaytune_{Model_Name}_{Optimizer}.sh
13+
14+
* To Train and validate the code on best tuned hyperparameters, execute job files located in best_job_runs folder. The files are named in the following format:
15+
16+
MyJob{Model_Name}_bestlr_{Optimizer}.sh
17+
18+
* To evaluate/Test the code, execute job files located in Eval_Job_Runs folder. The files are named in the following format:
19+
20+
EvalJob_{Model_Name}_{Optimizer}.sh
21+
22+
HereÕs how to use them:
23+
1. Replace {Model_Name} with the desired model name.
24+
2. Replace {Optimizer} with the optimizer of your choice.
25+
26+
*** The Training code is available in the Clip1.py file present inside in the iSogCLR>bimodal_exps folder.
27+
*** The code used for hyper-parameter tuning is raytune_eval_search.py present inside iSogCLR>bimodal_exps folder.
28+
*** The clip_train folder contains the json files for training and validation sets.
29+
30+
Link to Pickle file - https://drive.google.com/file/d/1PRy0jNMSTYXJRBwl47RXU-5ijjZoRV1L/view?usp=sharing
31+
32+
33+
34+
35+
36+
37+

0 commit comments

Comments
 (0)