-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
45 lines (36 loc) · 1.58 KB
/
Copy pathrun.py
File metadata and controls
45 lines (36 loc) · 1.58 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
44
45
import argparse
from utils.run_class import *
from config_files.config_file_DenseAutoencoder import *
import tensorflow as tf
# Display the start time of the code execution
print("Start Time Code Exec: ", time.asctime(time.localtime(time.time())))
# Set up argument parser
parser = argparse.ArgumentParser()
parser.add_argument('--Pretrain_Method', type=str)
parser.add_argument('--Finetune_Method', type=str)
parser.add_argument('--Model', type=str, required=True)
parser.add_argument('--Dataset', type=str, required=True)
parser.add_argument('--Benchmark', action='store_true')
args = parser.parse_args()
# Display GPU information
physical_devices = tf.config.list_physical_devices('GPU')
print("Num GPUs:", len(physical_devices))
print("devices:", tf.config.list_physical_devices(device_type=None))
# Initialize model configuration based on the provided model type
if args.Model == "DenseAutoencoder":
model_config = Config_DenseAutoencoder()
#elif args.Model == "VisionTransformer":
# model_config = Config_VisionTransformer()
else:
raise ValueError("please choose a valid Model Type. See Documentation!")
# Initialize the Run class based on provided arguments
run = Run(model_config=model_config,
data=args.Dataset,
benchmark=True,
pretrain_method=args.Pretrain_Method,
fine_tune_method=args.Finetune_Method)
# Execute pretraining and finetuning if specified
if args.Pretrain_Method != "None" and args.Pretrain_Method is not None:
run.execute_pretrain()
if args.Finetune_Method != "None" and args.Finetune_Method is not None:
run.execute_finetune()