[rllib] Allow access to batches prior to postprocessing (#4871)

This commit is contained in:
Eric Liang
2019-05-29 18:17:14 -07:00
committed by GitHub
parent a218a14c92
commit 2dd0beb5bd
5 changed files with 24 additions and 4 deletions
+4
View File
@@ -101,6 +101,10 @@ Tuned examples: `PongNoFrameskip-v4 <https://github.com/ray-project/ray/blob/mas
**APPO-specific configs** (see also `common configs <rllib-training.html#common-parameters>`__):
.. warning::
Keras custom models are not compatible with multi-GPU (this includes PPO in single-GPU mode). This is because the multi-GPU implementation in RLlib relies on variable scopes to implement cross-GPU support.
.. literalinclude:: ../../python/ray/rllib/agents/ppo/appo.py
:language: python
:start-after: __sphinx_doc_begin__
+4
View File
@@ -35,6 +35,10 @@ Custom Models (TensorFlow)
Custom TF models should subclass the common RLlib `model class <https://github.com/ray-project/ray/blob/master/python/ray/rllib/models/model.py>`__ and override the ``_build_layers_v2`` method. This method takes in a dict of tensor inputs (the observation ``obs``, ``prev_action``, and ``prev_reward``, ``is_training``), and returns a feature layer and float vector of the specified output size. You can also override the ``value_function`` method to implement a custom value branch. Additional supervised / self-supervised losses can be added via the ``custom_loss`` method. The model can then be registered and used in place of a built-in model:
.. warning::
Keras custom models are not compatible with multi-GPU (this includes PPO in single-GPU mode). This is because the multi-GPU implementation in RLlib relies on variable scopes to implement cross-GPU support.
.. code-block:: python
import ray