mirror of
https://github.com/vale981/ray
synced 2025-03-06 18:41:40 -05:00
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
from ray.rllib.agents.dqn.apex import apex_execution_plan
|
|
from ray.rllib.agents.ddpg.ddpg import DDPGTrainer, \
|
|
DEFAULT_CONFIG as DDPG_CONFIG
|
|
|
|
APEX_DDPG_DEFAULT_CONFIG = DDPGTrainer.merge_trainer_configs(
|
|
DDPG_CONFIG, # see also the options in ddpg.py, which are also supported
|
|
{
|
|
"optimizer": {
|
|
"max_weight_sync_delay": 400,
|
|
"num_replay_buffer_shards": 4,
|
|
"debug": False
|
|
},
|
|
"exploration_config": {
|
|
"type": "PerWorkerOrnsteinUhlenbeckNoise"
|
|
},
|
|
"n_step": 3,
|
|
"num_gpus": 0,
|
|
"num_workers": 32,
|
|
"buffer_size": 2000000,
|
|
"learning_starts": 50000,
|
|
"train_batch_size": 512,
|
|
"rollout_fragment_length": 50,
|
|
"target_network_update_freq": 500000,
|
|
"timesteps_per_iteration": 25000,
|
|
"worker_side_prioritization": True,
|
|
"min_iter_time_s": 30,
|
|
},
|
|
)
|
|
|
|
|
|
def validate_config(config):
|
|
if config.get("framework") == "tfe":
|
|
raise ValueError("APEX_DDPG does not support tf-eager yet!")
|
|
|
|
|
|
ApexDDPGTrainer = DDPGTrainer.with_updates(
|
|
name="APEX_DDPG",
|
|
default_config=APEX_DDPG_DEFAULT_CONFIG,
|
|
validate_config=validate_config,
|
|
execution_plan=apex_execution_plan)
|