class_docstr: Defines a configuration class from which a DDPPO Algorithm can be built.
  
  Note(jungong) : despite best efforts, DDPPO does not use fault tolerant and
  elastic features of WorkerSet, because of the way Torch DDP is set up.
  
  Example:
      >>> from ray.rllib.algorithms.ddppo import DDPPOConfig
      >>> config = DDPPOConfig().training(lr=0.003, keep_local_weights_in_sync=True)
      >>> config = config.resources(num_gpus=1)
      >>> config = config.rollouts(num_rollout_workers=10)
      >>> print(config.to_dict())   # doctest: +SKIP
      >>> # Build a Algorithm object from the config and run 1 training iteration.
      >>> algo = config.build(env="CartPole-v1")  # doctest: +SKIP
      >>> algo.train()  # doctest: +SKIP
  
  Example:
      >>> from ray.rllib.algorithms.ddppo import DDPPOConfig
      >>> from ray import air
      >>> from ray import tune
      >>> config = DDPPOConfig()
      >>> # Print out some default values.
      >>> print(config.kl_coeff)   # doctest: +SKIP
      >>> # Update the config object.
      >>> config.training( # doctest: +SKIP
      ...     lr=tune.grid_search([0.001, 0.0001]), num_sgd_iter=15)
      >>> # Set the config object's env.
      >>> config.environment(env="CartPole-v1") # doctest: +SKIP
      >>> # Use to_dict() to get the old-style python config dict
      >>> # when running with tune.
      >>> tune.Tuner( # doctest: +SKIP
      ...     "DDPPO",
      ...     run_config=air.RunConfig(stop={"episode_reward_mean": 200}),
      ...     param_space=config.to_dict(),
      ... ).fit()
class_docstr_tok: ["Defines","a","configuration","class","from","which","a","DDPPO","Algorithm","can","be","built",".","Note","(","jungong",")",":","despite","best","efforts",",","DDPPO","does","not","use","fault","tolerant","and","elastic","features","of","WorkerSet",",","because","of","the","way","Torch","DDP","is","set","up",".","Example",":",">",">",">","from","ray.rllib.algorithms.ddppo","import","DDPPOConfig",">",">",">","config","=","DDPPOConfig","(",")",".training","(","lr=0.003",",","keep_local_weights_in_sync=True",")",">",">",">","config","=","config.resources","(","num_gpus=1",")",">",">",">","config","=","config.rollouts","(","num_rollout_workers=10",")",">",">",">","print","(","config.to_dict","(",")",")","#","doctest",":","+SKIP",">",">",">","#","Build","a","Algorithm","object","from","the","config","and","run","1","training","iteration",".",">",">",">","algo","=","config.build","(","env=","''","CartPole-v1","''",")","#","doctest",":","+SKIP",">",">",">","algo.train","(",")","#","doctest",":","+SKIP","Example",":",">",">",">","from","ray.rllib.algorithms.ddppo","import","DDPPOConfig",">",">",">","from","ray","import","air",">",">",">","from","ray","import","tune",">",">",">","config","=","DDPPOConfig","(",")",">",">",">","#","Print","out","some","default","values",".",">",">",">","print","(","config.kl_coeff",")","#","doctest",":","+SKIP",">",">",">","#","Update","the","config","object",".",">",">",">","config.training","(","#","doctest",":","+SKIP","...","lr=tune.grid_search","(","[","0.001",",","0.0001","]",")",",","num_sgd_iter=15",")",">",">",">","#","Set","the","config","object","'s","env",".",">",">",">","config.environment","(","env=","''","CartPole-v1","''",")","#","doctest",":","+SKIP",">",">",">","#","Use","to_dict","(",")","to","get","the","old-style","python","config","dict",">",">",">","#","when","running","with","tune",".",">",">",">","tune.Tuner","(","#","doctest",":","+SKIP","...","``","DDPPO","''",",","...","run_config=air.RunConfig","(","stop=","{","``","episode_reward_mean","''",":","200","}",")",",","...","param_space=config.to_dict","(",")",",","...",")",".fit","(",")"]
docstr: Sets the training related configuration.
  
  Args:
      keep_local_weights_in_sync: Download weights between each training step.
          This adds a bit of overhead but allows the user to access the weights
          from the trainer.
      torch_distributed_backend: The communication backend for PyTorch
          distributed.
  
  Returns:
      This updated AlgorithmConfig object.
docstr_tok: ["Sets","the","training","related","configuration",".","Args",":","keep_local_weights_in_sync",":","Download","weights","between","each","training","step",".","This","adds","a","bit","of","overhead","but","allows","the","user","to","access","the","weights","from","the","trainer",".","torch_distributed_backend",":","The","communication","backend","for","PyTorch","distributed",".","Returns",":","This","updated","AlgorithmConfig","object","."]
code: def training(
      self,
      *,
      keep_local_weights_in_sync: Optional[bool] = NotProvided,
      torch_distributed_backend: Optional[str] = NotProvided,
      **kwargs,
  ) -> "DDPPOConfig":
      """Sets the training related configuration.
  
      Args:
          keep_local_weights_in_sync: Download weights between each training step.
              This adds a bit of overhead but allows the user to access the weights
              from the trainer.
          torch_distributed_backend: The communication backend for PyTorch
              distributed.
  
      Returns:
          This updated AlgorithmConfig object.
      """
      # Pass kwargs onto super's `training()` method.
      super().training(**kwargs)
  
      if keep_local_weights_in_sync is not NotProvided:
          self.keep_local_weights_in_sync = keep_local_weights_in_sync
      if torch_distributed_backend is not NotProvided:
          self.torch_distributed_backend = torch_distributed_backend
  
      return self
  
imports: import logging
  import time
  from typing import Optional
  from ray.rllib.algorithms.algorithm_config import AlgorithmConfig, NotProvided
  from ray.rllib.algorithms.ppo import PPO, PPOConfig
  from ray.rllib.evaluation.postprocessing import Postprocessing
  from ray.rllib.evaluation.rollout_worker import RolloutWorker
  from ray.rllib.utils.annotations import override
  from ray.rllib.utils.metrics import LEARN_ON_BATCH_TIMER, NUM_AGENT_STEPS_SAMPLED, NUM_AGENT_STEPS_TRAINED, NUM_ENV_STEPS_SAMPLED, NUM_ENV_STEPS_TRAINED, SAMPLE_TIMER
  from ray.rllib.utils.metrics.learner_info import LearnerInfoBuilder
  from ray.rllib.utils.sgd import do_minibatch_sgd
  from ray.rllib.utils.typing import ResultDict
label_desc: Use image node_id 2 for calling the DDPPOConfig obj's underlying member method code with example usage: obj.training() and returns: self