浏览代码

Fix issue where SAC encoder type is always simple (#2548)

/develop-gpu-test
GitHub 5 年前
当前提交
3df585d9
共有 7 个文件被更改,包括 14 次插入11 次删除
  1. 2
      config/sac_trainer_config.yaml
  2. 10
      ml-agents/mlagents/trainers/sac/models.py
  3. 5
      ml-agents/mlagents/trainers/sac/policy.py
  4. 2
      ml-agents/mlagents/trainers/tests/test_bcmodule.py
  5. 2
      ml-agents/mlagents/trainers/tests/test_reward_signals.py
  6. 2
      ml-agents/mlagents/trainers/tests/test_sac.py
  7. 2
      ml-agents/mlagents/trainers/tests/test_simple_rl.py

2
config/sac_trainer_config.yaml


summary_freq: 1000
tau: 0.005
use_recurrent: false
vis_encode_type: default
vis_encode_type: simple
reward_signals:
extrinsic:
strength: 1.0

10
ml-agents/mlagents/trainers/sac/models.py


import numpy as np
import tensorflow as tf
from mlagents.trainers.models import LearningModel
from mlagents.trainers.models import LearningModel, EncoderType
import tensorflow.contrib.layers as c_layers
LOG_STD_MAX = 2

num_layers=2,
stream_names=None,
seed=0,
vis_encode_type="default",
vis_encode_type=EncoderType.SIMPLE,
):
LearningModel.__init__(
self, m_size, normalize, use_recurrent, brain, seed, stream_names

num_layers=2,
stream_names=None,
seed=0,
vis_encode_type="default",
vis_encode_type=EncoderType.SIMPLE,
):
super().__init__(
brain,

num_layers=2,
stream_names=None,
seed=0,
vis_encode_type="default",
vis_encode_type=EncoderType.SIMPLE,
):
super().__init__(
brain,

stream_names=None,
tau=0.005,
gammas=None,
vis_encode_type="default",
vis_encode_type=EncoderType.SIMPLE,
):
"""
Takes a Unity environment and model-specific hyper-parameters and returns the

5
ml-agents/mlagents/trainers/sac/policy.py


from mlagents.envs.timers import timed
from mlagents.trainers import BrainInfo, ActionInfo, BrainParameters
from mlagents.trainers.models import EncoderType
from mlagents.trainers.sac.models import SACModel
from mlagents.trainers.tf_policy import TFPolicy
from mlagents.trainers.components.reward_signals.reward_signal_factory import (

stream_names=list(reward_signal_configs.keys()),
tau=float(trainer_params["tau"]),
gammas=list(_val["gamma"] for _val in reward_signal_configs.values()),
vis_encode_type=trainer_params["vis_encode_type"],
vis_encode_type=EncoderType(
trainer_params.get("vis_encode_type", "simple")
),
)
self.model.create_sac_optimizers()

2
ml-agents/mlagents/trainers/tests/test_bcmodule.py


summary_freq: 1000
tau: 0.005
use_recurrent: false
vis_encode_type: default
vis_encode_type: simple
pretraining:
demo_path: ./demos/ExpertPyramid.demo
strength: 1.0

2
ml-agents/mlagents/trainers/tests/test_reward_signals.py


summary_freq: 1000
tau: 0.005
use_recurrent: false
vis_encode_type: default
vis_encode_type: simple
pretraining:
demo_path: ./demos/ExpertPyramid.demo
strength: 1.0

2
ml-agents/mlagents/trainers/tests/test_sac.py


use_recurrent: false
curiosity_enc_size: 128
demo_path: None
vis_encode_type: default
vis_encode_type: simple
reward_signals:
extrinsic:
strength: 1.0

2
ml-agents/mlagents/trainers/tests/test_simple_rl.py


use_recurrent: false
curiosity_enc_size: 128
demo_path: None
vis_encode_type: default
vis_encode_type: simple
reward_signals:
extrinsic:
strength: 1.0

正在加载...
取消
保存