예제 #1
0
def load_config(script_name, config_name):
    """ Load config template by names. """
    def load_attr(module_name, attr_name):
        module = importlib.import_module(module_name)
        return getattr(module, attr_name)

    def get_CONFIG(script_name):
        try:
            CONFIG = load_attr('scripts.'+script_name+'_configs','CONFIG')
        except:
            CONFIG = load_attr('scripts.'+script_name, 'CONFIG')
        return CONFIG

    if config_name is None:  # use the default one
        return get_CONFIG(script_name)

    config_name = 'config_'+config_name
    try:  # try the user-provided version
        config = load_attr('scripts.'+script_name+'_configs', config_name)
    except (AttributeError, ImportError):
        try:  # try the default ones
            config = load_attr('scripts.'+script_name, config_name)
        except AttributeError:
            try:  # try to compose one
                config = copy.deepcopy(get_CONFIG(script_name))
                config_part = load_attr('scripts.configs', config_name)
                dict_update(config, config_part)
            except AttributeError:
                print('Fails to create configs from config_name.')
                raise ValueError
    return config
예제 #2
0
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

import copy
from scripts.mamba import CONFIG
from scripts import configs as dc
from rl.core.utils.misc_utils import dict_update

config_dip = copy.deepcopy(CONFIG)
config_dip = dict_update(config_dip, dc.config_dip_traj)
config_dip['experimenter']['ro_kwargs']['max_n_rollouts'] = 8
예제 #3
0
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

import copy
from scripts.pg import CONFIG
from scripts import configs as dc
from rl.core.utils.misc_utils import dict_update

config_hopper = copy.deepcopy(CONFIG)
config_hopper = dict_update(config_hopper, dc.config_hopper)
config_hopper['algorithm']['lr'] = 0.01
config_hopper['policy_units'] = (64, 64)