MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / get_config_fromfile

Method get_config_fromfile

config/config.py:84–117  ·  view source on GitHub ↗
(self, config_path)

Source from the content-addressed store, hash-verified

82 super().__init__(cfg_dict, cfg_text, filename)
83
84 def get_config_fromfile(self, config_path):
85 self.config_path = config_path
86
87 cfg, _ = MMConfig._file2dict(self.config_path)
88
89 self.merge_from_dict(cfg)
90 # #import ipdb;ipdb.set_trace()
91 # self.__dict__.update(dict(cfg))
92 # # update dir
93 dir_dict = {}
94 exp_name = 'exps62'
95 time_str = datetime.datetime.now().strftime('%Y%m%d_%H%M%S')
96 dir_dict['cur_dir'] = osp.dirname(os.path.abspath(__file__))
97 dir_dict['root_dir'] = osp.join(dir_dict['cur_dir'], '..')
98 dir_dict['output_dir'] = osp.join(dir_dict['root_dir'], exp_name)
99 dir_dict['result_dir'] = osp.join(dir_dict['output_dir'], 'result')
100 dir_dict['data_dir'] = osp.join(dir_dict['root_dir'], 'dataset')
101 dir_dict['human_model_path'] = osp.join('data/body_models')
102 self.merge_from_dict(dir_dict)
103 #
104 # ## add some paths to the system root dir
105 sys.path.insert(0, osp.join(self.root_dir, 'common'))
106 sys.path.insert(0, osp.join(self.root_dir, 'united-perception_utils'))
107 sys.path.insert(0, osp.join(self.cur_dir, 'humanbench_utils'))
108 sys.path.insert(0, osp.join(self.cur_dir, 'dinov2_utils'))
109 sys.path.insert(0, osp.join(self.cur_dir, 'lora_utils'))
110 sys.path.insert(0, osp.join(self.cur_dir, 'vit_adapter_utils'))
111 from util.dir import add_pypath
112 # add_pypath(osp.join(self.data_dir))
113 for dataset in os.listdir('datasets'):
114 if dataset not in ['humandata.py', '__pycache__', 'dataset.py']:
115 add_pypath(osp.join(self.root_dir, 'data', dataset))
116 add_pypath('datasets')
117 add_pypath(self.data_dir)
118
119 def prepare_dirs(self, exp_name):
120 time_str = datetime.datetime.now().strftime('%Y%m%d_%H%M%S')

Callers 1

config.pyFile · 0.80

Calls 3

merge_from_dictMethod · 0.95
add_pypathFunction · 0.90
_file2dictMethod · 0.80

Tested by

no test coverage detected