Skip to content

Commit

Permalink
Update readme with a multiple agents section
Browse files Browse the repository at this point in the history
  • Loading branch information
m-wojnar committed Feb 26, 2024
1 parent 94d5797 commit eee76ca
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ Our library is built on top of JAX, a high-performance numerical computing libra
RL algorithms efficiently. It provides powerful transformations, including JIT compilation, automatic differentiation,
vectorization, and parallelization. Our library is fully compatible with DeepMind's JAX ecosystem, granting access to
state-of-the-art RL models and helper libraries. JIT compilation significantly accelerates execution and ensures
portability across different architectures (CPUs, GPUs, TPUs) without requiring code modifications.

portability across different architectures (CPUs, GPUs, TPUs) without requiring code modifications.
JAX offers another benefit through its robust pseudorandom number generator system, employed in our library to
guarantee result reproducibility. This critical aspect of scientific research is frequently underestimated but
remains highly significant.
Expand Down
35 changes: 35 additions & 0 deletions docs/source/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,41 @@ flag to ``False`` in the ``sample`` method:
action = rl.sample(*env_state, is_training=False)
Interaction with multiple agents
--------------------------------

Reinforced-lib allows you to use multiple agent instances in the same environment. This feature is useful when you want
to train multiple agents in parallel or use multiple agents to solve the same problem. To achieve this, you need to
initialize the instances of the agents by calling the ``init`` method of the ``RLib`` class a certain number of times:

.. code-block:: python
rl = RLib(..)
for _ in range(n_agents):
rl.init()
Reproducibility
~~~~~~~~~~~~~~~

JAX is focused on reproducibility, and it provides a robust pseudo-random number generator (PRNG) that allows you to
control the randomness of the computations. PRNG requires setting the random seed to ensure that the results of the
computation are reproducible. Reinforced-lib provides an API for setting the random seed for the JAX library.
You can set the seed by providing the ``seed`` parameter when creating the instance of the agent:

.. code-block:: python
rl = RLib(...)
rl.init(seed=123)
The seed is initially configured as 42 and the ``init`` method is triggered automatically after the first sampling call.
It eliminates the need to manually call the ``init`` method unless you want to provide custom seed, thus ensuring
reproducibility.

.. note::

Remember that the reproducibility of the computations is guaranteed only for the agents from Reinforced-lib.
You have to ensure that the environment you use is reproducible as well.

Loggers
-------
Expand Down
4 changes: 1 addition & 3 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ The figure below provides a visual representation of Reinforced-lib and the data
JAX Backend
-----------

Our library is built on top of JAX, a high-performance numerical computing library. JAX makes it easy to implement RL algorithms efficiently. It provides powerful transformations, including JIT compilation, automatic differentiation, vectorization, and parallelization. Our library is fully compatible with DeepMind's JAX ecosystem, granting access to state-of-the-art RL models and helper libraries. JIT compilation significantly accelerates execution and ensures portability across different architectures (CPUs, GPUs, TPUs) without requiring code modifications.

JAX offers another benefit through its robust pseudorandom number generator system, employed in our library to guarantee result reproducibility. This critical aspect of scientific research is frequently underestimated but remains highly significant.
Our library is built on top of JAX, a high-performance numerical computing library. JAX makes it easy to implement RL algorithms efficiently. It provides powerful transformations, including JIT compilation, automatic differentiation, vectorization, and parallelization. Our library is fully compatible with DeepMind's JAX ecosystem, granting access to state-of-the-art RL models and helper libraries. JIT compilation significantly accelerates execution and ensures portability across different architectures (CPUs, GPUs, TPUs) without requiring code modifications. JAX offers another benefit through its robust pseudorandom number generator system, employed in our library to guarantee result reproducibility. This critical aspect of scientific research is frequently underestimated but remains highly significant.

Edge Device Export
------------------
Expand Down

0 comments on commit eee76ca

Please sign in to comment.