- Medium: It contributes to significant difficulty to complete my task, but I can work around it.
I was trying to migrate code from ray rllib 1.0.0 to >2.0.0.
I am trying to replace certain parts in the file, climate-cooperation-competition/train_with_rllib.py at 79cdcfa08976c58aa20a6cc0722bc30420615be9 · mila-iqia/climate-cooperation-competition · GitHub
I was wondering if you know which parts of the config should I add the following which is the run_config which was loaded on line 408 of train_with_rllib:
{'saving': {'metrics_log_freq': 100,
'model_params_save_freq': 1000,
'basedir': '/tmp',
'name': 'rice',
'tag': 'experiments'},
'trainer': {'num_envs': 20,
'rollout_fragment_length': 100,
'train_batch_size': 2000,
'num_episodes': 100,
'framework': 'torch',
'num_workers': 4,
'num_gpus': 0},
'env': {'num_discrete_action_levels': 10,
'negotiation_on': False,
'source_dir': None},
'policy': {'regions': {'vf_loss_coeff': 0.1,
'entropy_coeff_schedule': [[0, 0.5], [1000000, 0.1], [5000000, 0.05]],
'clip_grad_norm': True,
'max_grad_norm': 0.5,
'gamma': 0.92,
'lr': 0.0005,
'model': {'custom_model': 'torch_linear',
'custom_model_config': {'fc_dims': [256, 256]}}}}}
So far, the following code works, but it does not have all the config parameters in it which replaced the trainer definition in line 420 and 307 of train_with_rllib,
# try https://docs.ray.io/en/latest/ray-air/trainer.html
from ray.air.config import RunConfig, ScalingConfig
from ray.train.rl import RLTrainer
trainer = RLTrainer(
run_config=RunConfig(stop={"training_iteration": 5}),
scaling_config=ScalingConfig(num_workers=2, use_gpu=False),
algorithm="PPO",
config={
"env": EnvWrapper,
"framework": "tf",
"evaluation_num_workers": 4,
"evaluation_interval": 1
},
)