Ejemplo n.º 1
0
def assemble_and_show_graphs(*graphs):
    for graph in graphs:
        graph()
    log_dir = options.get("agent/log_dir", "log")
    log.info(('Writing TF summary to %s. '
              'Please use tensorboad to watch.') % log_dir)
    tf.summary.FileWriter(log_dir, graph=tf.get_default_graph())
Ejemplo n.º 2
0
 def preprocess(cls):
     return options.get('algorithm')
Ejemplo n.º 3
0
from relaax.common.python.config.loaded_config import options

config = options.get('algorithm')

for key, value in [('use_convolutions', [])]:
    if not hasattr(config, key):
        setattr(config, key, value)
Ejemplo n.º 4
0
from builtins import object
from relaax.common.python.config.loaded_config import options
from argparse import Namespace


class PGConfig(object):
    @classmethod
    def preprocess(cls):
        return options.get('algorithm')


config = PGConfig.preprocess()

config.avg_in_num_batches = options.get('algorithm/avg_in_num_batches', 10)
config.input.history = options.get('algorithm/input/history', 1)

for key, value in [('use_convolutions', [])]:
    if not hasattr(config, key):
        setattr(config, key, value)

config.max_global_step = options.get('algorithm/max_global_step', 5e7)
config.use_linear_schedule = options.get('algorithm/use_linear_schedule', False)

config.initial_learning_rate = options.get('algorithm/initial_learning_rate', 1e-4)
config.learning_rate_end = options.get('algorithm/learning_rate_end', 0.0)

config.optimizer = options.get('algorithm/optimizer', 'Adam')   # Adam | RMSProp
# RMSProp default parameters
if not hasattr(config, 'RMSProp'):
    config.RMSProp = options.get('algorithm/RMSProp', Namespace())
config.RMSProp.decay = options.get('algorithm/RMSProp/decay', 0.99)
Ejemplo n.º 5
0
from relaax.common.python.config.loaded_config import options
from argparse import Namespace
import random


config = options.get('algorithm')
config.seed = options.get('algorithm/seed', random.randrange(1000000))

config.input.universe = options.get('algorithm/input/universe', True)
config.input.history = options.get('algorithm/input/history', 1)

for key, value in [('use_convolutions', [])]:
    if not hasattr(config, key):
        setattr(config, key, value)

config.avg_in_num_batches = options.get('algorithm/avg_in_num_batches', 10)
config.activation = options.get('algorithm/activation', 'tanh')

config.lam = options.get('algorithm/lambda', 1.00)
config.entropy = options.get('algorithm/entropy', None)
config.l2_coeff = options.get('algorithm/l2_coeff', None)
config.critic_scale = options.get('algorithm/critic_scale', 0.25)

config.combine_gradients = options.get('algorithm/combine_gradients', 'fifo')
config.num_gradients = options.get('algorithm/num_gradients', 4)
config.dc_lambda = options.get('algorithm/dc_lambda', 0.05)
config.dc_history = options.get('algorithm/dc_history', 20)
config.gradients_norm_clipping = options.get('algorithm/gradients_norm_clipping', False)

config.use_filter = options.get('algorithm/use_filter', False)
Ejemplo n.º 6
0
from relaax.common.python.config.loaded_config import options

config = options.get('algorithm')

config.log_lvl = options.get('relaax-metrics-server/log_level', 'INFO')  # INFO | DEBUG | VERBOSE
config.no_ps = options.get('algorithm/no_ps', False)
config.input.history = options.get('algorithm/input/history', 1)

for key, value in [('use_convolutions', [])]:
    if not hasattr(config, key):
        setattr(config, key, value)

config.buffer_size = options.get('algorithm/buffer_size', 4*10**5)
config.batch_size = options.get('algorithm/batch_size', 64)
config.loop_size = options.get('algorithm/loop_size', 1)
config.input.history = options.get('algorithm/input/history', 1)
config.hidden_sizes = options.get('algorithm/hidden_sizes', [400, 300])  # needs at least two layers

config.actor_learning_rate = options.get('algorithm/actor_learning_rate', 1e-4)
config.critic_learning_rate = options.get('algorithm/critic_learning_rate', 1e-3)
config.tau = options.get('algorithm/tau', 1e-3)
config.use_filter = options.get('algorithm/use_filter', False)

config.l2 = options.get('algorithm/l2', True)
config.l2_decay = options.get('algorithm/l2_decay', 1e-2)

config.output.scale = options.get('algorithm/output/scale', 1.)
config.ou_noise = options.get('algorithm/ou_noise', True)

config.exploration.ou_mu = options.get('algorithm/exploration/ou_mu', .0)
config.exploration.ou_theta = options.get('algorithm/exploration/ou_theta', .15)
Ejemplo n.º 7
0
from relaax.common.python.config.loaded_config import options
from argparse import Namespace

config = options.get('algorithm')

config.avg_in_num_batches = options.get('algorithm/avg_in_num_batches', 200)
config.input.history = options.get('algorithm/input/history', 1)

for key, value in [('use_convolutions', [])]:
    if not hasattr(config, key):
        setattr(config, key, value)

config.max_global_step = options.get('algorithm/max_global_step', 1e8)
config.use_linear_schedule = options.get('algorithm/use_linear_schedule', False)

config.initial_learning_rate = options.get('algorithm/initial_learning_rate', 1e-4)
config.learning_rate_end = options.get('algorithm/learning_rate_end', 0.0)

config.optimizer = options.get('algorithm/optimizer', 'Adam')   # Adam | RMSProp
# RMSProp default parameters
if not hasattr(config, 'RMSProp'):
    config.RMSProp = options.get('algorithm/RMSProp', Namespace())
config.RMSProp.decay = options.get('algorithm/RMSProp/decay', 0.99)
config.RMSProp.epsilon = options.get('algorithm/RMSProp/epsilon', 0.1)

config.gradients_norm_clipping = options.get('algorithm/gradients_norm_clipping', False)

# check hidden sizes
if len(config.hidden_sizes) > 0:
    if config.hidden_sizes[-1] % 2 != 0:
        raise ValueError("Number of outputs in the last hidden layer must be divisible by 2")
Ejemplo n.º 8
0
from relaax.common.python.config.loaded_config import options

config = options.get('algorithm')

for key, value in [('use_convolutions', [])]:
    if not hasattr(config, key):
        setattr(config, key, value)

config.optimizer = options.get('algorithm/optimizer', 'Adam')
config.gradients_norm_clipping = options.get(
    'algorithm/gradients_norm_clipping', False)

# check hidden sizes
if len(config.hidden_sizes) > 0:
    if config.hidden_sizes[-1] % 2 != 0:
        raise ValueError(
            "Number of outputs in the last hidden layer must be divisible by 2"
        )
Ejemplo n.º 9
0
from relaax.common.python.config.loaded_config import options
from argparse import Namespace

config = options.get('algorithm')

for key, value in [('use_convolutions', [])]:
    if not hasattr(config, key):
        setattr(config, key, value)

config.output.scale = options.get('algorithm/output/scale', 1.0)
config.critic_scale = options.get('algorithm/critic_scale', 1.0)
config.gae_lambda = options.get('algorithm/gae_lambda', 1.00)

config.output.loss_type = options.get('algorithm/output/loss_type', 'Normal')
config.optimizer = options.get('algorithm/optimizer', 'Adam')

config.hogwild = options.get('algorithm/hogwild', False)
config.use_icm = options.get('algorithm/use_icm', False)
config.use_filter = options.get('algorithm/use_filter', False)

config.output.action_high = options.get('algorithm/output/action_high', [])
config.output.action_low = options.get('algorithm/output/action_low', [])

config.entropy_type = options.get('algorithm/normal_entropy',
                                  'Gauss')  # Gauss | Origin
config.policy_clip = options.get('algorithm/policy_clip', False)
config.critic_clip = options.get('algorithm/critic_clip', False)

config.gradients_norm_clipping = options.get(
    'algorithm/gradients_norm_clipping', False)
config.input.universe = options.get('algorithm/input/universe', True)
Ejemplo n.º 10
0
from relaax.common.python.config.loaded_config import options
from argparse import Namespace
import random

config = options.get('algorithm')

config.seed = options.get('algorithm/seed', random.randrange(1000000))
config.avg_in_num_batches = options.get('algorithm/avg_in_num_batches', 10)

for key, value in [('use_convolutions', [])]:
    if not hasattr(config, key):
        setattr(config, key, value)

config.input.history = options.get('algorithm/input/history', 1)
config.input.universe = options.get('algorithm/input/universe', True)

config.activation = options.get('algorithm/activation', 'relu')
config.lstm_type = options.get('algorithm/lstm_type',
                               'Basic')  # Basic | Dilated
config.lstm_num_cores = options.get('algorithm/lstm_num_cores', 8)

config.max_global_step = options.get('algorithm/max_global_step', 5e7)
config.use_linear_schedule = options.get('algorithm/use_linear_schedule',
                                         False)

config.initial_learning_rate = options.get('algorithm/initial_learning_rate',
                                           1e-4)
config.learning_rate_end = options.get('algorithm/learning_rate_end', 0.0)

config.optimizer = options.get('algorithm/optimizer', 'Adam')  # Adam | RMSProp
# RMSProp default parameters