|
| 1 | +<!--Copyright 2022 The HuggingFace Team. All rights reserved. |
| 2 | + |
| 3 | +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
| 4 | +the License. You may obtain a copy of the License at |
| 5 | + |
| 6 | +http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | + |
| 8 | +Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
| 9 | +an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| 10 | +specific language governing permissions and limitations under the License. |
| 11 | +--> |
| 12 | + |
| 13 | +# Trajectory Transformer |
| 14 | + |
| 15 | +## Overview |
| 16 | + |
| 17 | +The Trajectory Transformer model was proposed in [Offline Reinforcement Learning as One Big Sequence Modeling Problem](https://arxiv.org/abs/2106.02039) by Michael Janner, Qiyang Li, Sergey Levine. |
| 18 | + |
| 19 | +The abstract from the paper is the following: |
| 20 | + |
| 21 | +*Reinforcement learning (RL) is typically concerned with estimating stationary policies or single-step models, |
| 22 | +leveraging the Markov property to factorize problems in time. However, we can also view RL as a generic sequence |
| 23 | +modeling problem, with the goal being to produce a sequence of actions that leads to a sequence of high rewards. |
| 24 | +Viewed in this way, it is tempting to consider whether high-capacity sequence prediction models that work well |
| 25 | +in other domains, such as natural-language processing, can also provide effective solutions to the RL problem. |
| 26 | +To this end, we explore how RL can be tackled with the tools of sequence modeling, using a Transformer architecture |
| 27 | +to model distributions over trajectories and repurposing beam search as a planning algorithm. Framing RL as sequence |
| 28 | +modeling problem simplifies a range of design decisions, allowing us to dispense with many of the components common |
| 29 | +in offline RL algorithms. We demonstrate the flexibility of this approach across long-horizon dynamics prediction, |
| 30 | +imitation learning, goal-conditioned RL, and offline RL. Further, we show that this approach can be combined with |
| 31 | +existing model-free algorithms to yield a state-of-the-art planner in sparse-reward, long-horizon tasks.* |
| 32 | + |
| 33 | +Tips: |
| 34 | + |
| 35 | +This Transformer is used for deep reinforcement learning. To use it, you need to create sequences from |
| 36 | +actions, states and rewards from all previous timesteps. This model will treat all these elements together |
| 37 | +as one big sequence (a trajectory). |
| 38 | + |
| 39 | +This model was contributed by [CarlCochet](https://huggingface.co/CarlCochet). The original code can be found [here](https://github.com/jannerm/trajectory-transformer). |
| 40 | + |
| 41 | +## TrajectoryTransformerConfig |
| 42 | + |
| 43 | +[[autodoc]] TrajectoryTransformerConfig |
| 44 | + |
| 45 | + |
| 46 | +## TrajectoryTransformerModel |
| 47 | + |
| 48 | +[[autodoc]] TrajectoryTransformerModel |
| 49 | + - forward |
0 commit comments