Geant4 Cross Reference |
1 from argparse import ArgumentParser 2 3 from core.constants import MAX_GPU_MEMORY_ALLO 4 from utils.gpu_limiter import GPULimiter 5 from utils.optimizer import OptimizerType 6 7 # Hyperparemeters to be optimized. 8 discrete_parameters = {"nb_hidden_layers": (1, 9 continuous_parameters = {"learning_rate": (0.0 10 categorical_parameters = {"optimizer_type": [O 11 12 13 def parse_args(): 14 argument_parser = ArgumentParser() 15 argument_parser.add_argument("--study-name 16 argument_parser.add_argument("--storage", 17 argument_parser.add_argument("--max-gpu-me 18 argument_parser.add_argument("--gpu-ids", 19 args = argument_parser.parse_args() 20 return args 21 22 23 def main(): 24 # 0. Parse arguments. 25 args = parse_args() 26 study_name = args.study_name 27 storage = args.storage 28 max_gpu_memory_allocation = args.max_gpu_m 29 gpu_ids = args.gpu_ids 30 31 # 1. Set GPU memory limits. 32 GPULimiter(_gpu_ids=gpu_ids, _max_gpu_memo 33 34 # 2. Manufacture hyperparameter tuner. 35 36 # This import must be local because otherw 37 from utils.hyperparameter_tuner import Hyp 38 hyperparameter_tuner = HyperparameterTuner 39 40 41 # 3. Run main tuning function. 42 hyperparameter_tuner.tune() 43 # Watch out! This script neither deletes t 44 # parallelized optimization, then you shou 45 46 47 if __name__ == "__main__": 48 exit(main())