Example #1
0
def main():
    config_keys = ['env', 'agent', 'train']
    parser = argparse.ArgumentParser()
    for k in config_keys:
        parser.add_argument(f'--{k}', required=True)
    parser.add_argument('--cont')
    args = parser.parse_args()
    config = utils.json2dict(args, config_keys)

    config.train = DEFAULT_CONFIG | config.train
    config.train.trial_datetime = args.cont or config.train.trial_datetime or datetime.now(
    ).strftime('%Y-%m-%d %H-%M-%S')

    train(config)
Example #2
0
File: data.py Project: royf/hvil
def main():
    config_keys = ['env', 'agent', 'data']
    parser = argparse.ArgumentParser()
    for k in config_keys:
        parser.add_argument(f'--{k}', required=True)
    args = parser.parse_args()
    config = utils.json2dict(args, config_keys)

    env = envs.catalog(config.env)
    agent = agents.catalog(env, DictTree(teacher=True) | config.agent)
    agent.to(config.data.get('device', 'cuda'))
    env.training = True
    DataLoader(DEFAULT_CONFIG | config.data.train, env, agent)
    env.training = False
    DataLoader(DEFAULT_CONFIG | config.data.test, env, agent)
Example #3
0
 def get_argument_ex(self, str):
     from utils import json2dict
     str2dict = json2dict(self.request.body)
     return str2dict[str] if str in str2dict.keys() else False