MCPcopy Index your code
hub / github.com/OpenGVLab/HumanBench / __init__

Method __init__

PATH/core/solvers/solver_multitask_dev.py:911–989  ·  view source on GitHub ↗
(self, C_train, C_test)

Source from the content-addressed store, hash-verified

909
910class PLMultiTaskDev(SolverMultiTaskDev):
911 def __init__(self, C_train, C_test):
912 train_config = edict(C_train.config['common'])
913 ginfo = C_train.ginfo
914 config = train_config
915
916 if C_test.config.get('common') is not None:
917 recursive_update(config, C_test.config.get('common'))
918 config = edict(config)
919 if 'out_dir' in config:
920 self.out_dir = config['out_dir'] + 'test_results/'
921 else:
922 self.out_dir = "./test_results/"
923
924 if 'expname' in config:
925 self.tb_path = '{}events/{}'.format(self.out_dir, config['expname'])
926 self.ckpt_path = '{}checkpoints/{}'.format(self.out_dir, config['expname'])
927 self.logs_path = '{}logs/{}'.format(self.out_dir, config['expname'])
928 else:
929 save_path = config.get('save_path', os.path.dirname(os.path.abspath(C_train.config_file)))
930 self.save_path = save_path
931 self.tb_path = '{}/test_results/events'.format(save_path)
932 self.ckpt_path = '{}/test_results/checkpoints'.format(save_path)
933 self.logs_path = '{}/test_results/logs'.format(save_path)
934 if C_train.rank == 0:
935 os.makedirs(self.tb_path, exist_ok=True)
936 os.makedirs(self.ckpt_path, exist_ok=True)
937 os.makedirs(self.logs_path, exist_ok=True)
938 # self.tb_logger = SummaryWriter(self.tb_path)
939 project_name = config.get('project_name', os.path.dirname(C.config_file).split('/')[-1])
940 self.tb_logger = SummaryWriter(log_dir=self.tb_path, name=C.config['expname'], project=project_name, overwrite_last_training=True)
941
942 else:
943 while not os.path.exists(self.logs_path):
944 time.sleep(1)
945
946 if ginfo.task_rank == 0:
947 assert C_train.rank == 0, "there shall be only one group"
948 self.logger = create_logger('global_logger', '{}/log_task_{}.txt'.format(self.logs_path, ginfo.task_id))
949
950 self.sync = config.get('sync', True)
951 self.C = C_train
952
953 self.config = config
954 self.ginfo = ginfo
955 # change tensor .cuda
956 change_tensor_cuda()
957
958 self.tmp = edict()
959
960 ## random seed setting
961 rng = np.random.RandomState(self.config.get('random_seed', 0))
962 self.randomseed_pool = rng.randint(999999, size=config.max_iter)
963
964 ### VVV deterministic measures VVV
965
966 if self.config.get('deterministic', False):
967 if self.config.get('cudnn_deterministic', True):
968 cudnn.deterministic = True

Callers 1

__init__Method · 0.45

Calls 5

create_loggerFunction · 0.90
change_tensor_cudaFunction · 0.90
getMethod · 0.80
WorkerInitClass · 0.70
infoMethod · 0.45

Tested by

no test coverage detected