Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions benchmarks/storage/benchmark_sample_latency_over_rpc.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

"""
Sample latency benchmarking (using RPC)
======================================
Expand Down
8 changes: 6 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ for :doc:`cost functions <reference/objectives>`, :ref:`returns <reference/objec

TorchRL aims at a high modularity and good runtime performance.

Tutorials
=========

.. toctree::
:maxdepth: 2
:caption: Tutorials:

tutorials/torchrl_demo
tutorials/tensordict_tutorial
Expand All @@ -39,9 +41,11 @@ TorchRL aims at a high modularity and good runtime performance.
tutorials/coding_ddpg
tutorials/coding_dqn

References
==========

.. toctree::
:maxdepth: 3
:caption: References:

reference/index
reference/knowledge_base
Expand Down
4 changes: 2 additions & 2 deletions docs/source/reference/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ TensorDict modules
SafeProbabilisticSequential
SafeSequential
WorldModelWrapper
tensordict_module.common.is_tensordict_compatible
tensordict_module.common.ensure_tensordict_compatible
common.is_tensordict_compatible
common.ensure_tensordict_compatible

Hooks
-----
Expand Down
2 changes: 2 additions & 0 deletions docs/source/reference/trainers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,5 @@ Loggers
MLFlowLogger
TensorboardLogger
WandbLogger
get_logger
generate_exp_name
5 changes: 5 additions & 0 deletions test/opengl_rendering.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

"""Headless GPU-accelerated OpenGL context creation on Google Colaboratory.
Typical usage:
# Optional PyOpenGL configuratiopn can be done here.
Expand Down
6 changes: 6 additions & 0 deletions test/smoke_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.


def test_imports():
from torchrl.data import (
PrioritizedReplayBuffer,
Expand Down
5 changes: 5 additions & 0 deletions test/smoke_test_deps.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

import argparse
import tempfile

Expand Down
5 changes: 5 additions & 0 deletions test/test_actors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

import pytest
import torch
from torchrl.modules.tensordict_module.actors import (
Expand Down
5 changes: 5 additions & 0 deletions test/test_loggers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

import argparse
import os
import os.path
Expand Down
5 changes: 5 additions & 0 deletions test/test_rb_distributed.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

import os
import time

Expand Down
5 changes: 5 additions & 0 deletions torchrl/data/replay_buffers/rb_prototype.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

import collections
import threading
from concurrent.futures import ThreadPoolExecutor
Expand Down
5 changes: 5 additions & 0 deletions torchrl/data/replay_buffers/samplers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

from abc import ABC, abstractmethod
from typing import Any, Tuple, Union

Expand Down
5 changes: 5 additions & 0 deletions torchrl/data/replay_buffers/writers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

from abc import ABC, abstractmethod
from typing import Any, Sequence

Expand Down
5 changes: 5 additions & 0 deletions torchrl/envs/libs/brax.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

from typing import Dict, Optional, Union

import torch
Expand Down
5 changes: 5 additions & 0 deletions torchrl/envs/libs/habitat.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

from torchrl.envs.libs.gym import GymEnv

try:
Expand Down
5 changes: 5 additions & 0 deletions torchrl/envs/libs/jax_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

import dataclasses
from typing import Union

Expand Down
5 changes: 5 additions & 0 deletions torchrl/envs/libs/jumanji.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

from typing import Dict, Optional, Union

import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion torchrl/modules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
ValueOperator,
WorldModelWrapper,
)
from .planners import CEMPlanner, MPCPlannerBase # usort:skip
from .planners import CEMPlanner, MPCPlannerBase, MPPIPlanner # usort:skip
1 change: 1 addition & 0 deletions torchrl/objectives/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from .dreamer import DreamerActorLoss, DreamerModelLoss, DreamerValueLoss
from .ppo import ClipPPOLoss, KLPENPPOLoss, PPOLoss
from .redq import REDQLoss
from .reinforce import ReinforceLoss
from .sac import SACLoss
from .utils import (
distance_loss,
Expand Down
5 changes: 5 additions & 0 deletions torchrl/objectives/deprecated.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

import math
from numbers import Number
from typing import Tuple, Union
Expand Down
9 changes: 7 additions & 2 deletions torchrl/objectives/reinforce.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

from typing import Optional

import torch
from tensordict.tensordict import TensorDict, TensorDictBase

from torchrl.modules import SafeModule, SafeProbabilisticSequential
from torchrl.objectives import distance_loss
from torchrl.modules.tensordict_module import SafeModule, SafeProbabilisticSequential
from torchrl.objectives.common import LossModule
from torchrl.objectives.utils import distance_loss


class ReinforceLoss(LossModule):
Expand Down
2 changes: 0 additions & 2 deletions torchrl/trainers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,3 @@
Trainer,
UpdateWeights,
)

# from .loggers import *
1 change: 1 addition & 0 deletions torchrl/trainers/loggers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
from .csv import CSVLogger
from .mlflow import MLFlowLogger
from .tensorboard import TensorboardLogger
from .utils import generate_exp_name, get_logger
from .wandb import WandbLogger
6 changes: 6 additions & 0 deletions torchrl/trainers/loggers/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.


import os
import pathlib
import uuid
Expand Down
6 changes: 2 additions & 4 deletions tutorials/sphinx-tutorials/README.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
README Demos
================

Below are examples using my module:
README Tutos
============