Metadata-Version: 2.4
Name: rewind-reward-pytorch
Version: 0.0.25
Summary: Rewind Reward
Project-URL: Homepage, https://pypi.org/project/rewind-reward-pytorch/
Project-URL: Repository, https://github.com/lucidrains/rewind-reward-pytorch
Author-email: Phil Wang <lucidrains@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Phil Wang
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: artificial intelligence,deep learning,robotics
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Requires-Dist: einops>=0.8.1
Requires-Dist: einx>=0.3.0
Requires-Dist: hl-gauss-pytorch>=0.1.24
Requires-Dist: sentence-transformers
Requires-Dist: torch>=2.4
Requires-Dist: transformers
Requires-Dist: vit-pytorch
Requires-Dist: x-mlps-pytorch>=0.0.25
Requires-Dist: x-transformers
Provides-Extra: examples
Provides-Extra: test
Requires-Dist: pytest; extra == 'test'
Description-Content-Type: text/markdown


<img src="./rewind.png" width="400px"></img>

<img src="./fig9.png" width="400px"></img>

## ReWiND Reward - Pytorch (wip)

Implementation of [ReWiND, "Language-Guided Rewards Teach Robot Policies without New Demonstrations"](https://rewind-reward.github.io/), from USC / Amazon Robotics

## Install

```bash
$ pip install rewind-reward-pytorch
```

## Usage

```python
import torch

from rewind_reward_pytorch import (
    RewardModel,
    RewindTrainWrapper
)

reward_model = RewardModel(
    reward_bins = 10,
    categorical_rewards = False,

)

wrapper = RewindTrainWrapper(
    reward_model,
    rewind_augmentation_prob = 0.25
)

commands = [
  'pick up the blue ball and put it in the red tray',
  'pick up the red cube and put it in the green bin',
]

video = torch.rand(2, 3, 16, 224, 224)

loss = wrapper(
    commands,
    video
)

loss.backward()

# after much training

pred_rewards = reward_model(
    commands,
    video
) # (2, 16) - per frame progress prediction

assert pred_rewards.shape == (2, 16)

```

## Citations

```bibtex
@article{Zhang2025ReWiNDLR,
    title   = {ReWiND: Language-Guided Rewards Teach Robot Policies without New Demonstrations},
    author  = {Jiahui Zhang and Yusen Luo and Abrar Anwar and Sumedh Anand Sontakke and Joseph J. Lim and Jesse Thomason and Erdem Biyik and Jesse Zhang},
    journal = {ArXiv},
    year    = {2025},
    volume  = {abs/2505.10911},
    url     = {https://api.semanticscholar.org/CorpusID:278714746}
}
```
