Metadata-Version: 2.4
Name: RISE-pytorch
Version: 0.0.1
Summary: Implementation of RISE, Self-Improving Robot Policy with Compositional World Model
Project-URL: Homepage, https://pypi.org/project/RISE/
Project-URL: Repository, https://github.com/lucidrains/RISE
Author-email: Phil Wang <lucidrains@gmail.com>
License: MIT License
        
        Copyright (c) 2026 lucidrains
        
        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,neural manipulation,robotics,world model
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Requires-Dist: einops>=0.8.1
Requires-Dist: einx>=0.3.0
Requires-Dist: pi-zero-pytorch>=0.5.11
Requires-Dist: torch-einops-utils>=0.0.29
Requires-Dist: torch>=2.5
Requires-Dist: value-network>=0.0.38
Requires-Dist: x-transformers
Provides-Extra: examples
Provides-Extra: test
Requires-Dist: pytest; extra == 'test'
Description-Content-Type: text/markdown

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

## RISE (wip)

Implementation of RISE, [Self-Improving Robot Policy with Compositional World Model](https://arxiv.org/abs/2602.11075)

## Usage

Here is a complete, minimal example of how to orchestrate self-improvement using `RISE`. 

This involves:
1. Fine-tuning an action-conditioned `Cosmos` Dynamics Model.
2. Initializing a `PiZero` policy and `SigLIP` Value Network.
3. Engaging the `RISE` loop: Imagination Rollout followed by Policy Finetuning.

```python
import torch

from RISE import (
    RISE,
    CosmosPredictWrapper,
    DynamicsTrainer,
    MockOfflineRoboticFrameDataset
)

from value_network import SigLIPValueNetwork

from pi_zero_pytorch.pi_zero import PiZero, SigLIP as PiZeroSigLIP

# 1. Provide an offline seed dataset (video + proprioception)
dataset = MockOfflineRoboticFrameDataset(num_samples = 10, image_size = 224)

# 2. Initialize and Fine-Tune the Action-Conditioned Dynamics Model
dynamics_model = CosmosPredictWrapper(
    model_name = 'nvidia/Cosmos-1.0-Diffusion-7B-Video2World',
    action_dim = 10,
    action_chunk_len = 8
)

trainer = DynamicsTrainer(
    model = dynamics_model,
    dataset = dataset,
    batch_size = 1,
    lr = 1e-4
)

# Learn system dynamics from the offline dataset
trainer.train(num_steps = 1000)

# 3. Initialize Policy (PiZero) and Value Network Evaluator
policy = PiZero(
    dim = 256,
    num_tokens = 1000,
    dim_action_input = 10,
    dim_joint_state = 14,
    depth = 4,
    pi05 = True,
    vit = PiZeroSigLIP(
        image_size = 224,
        patch_size = 16,
        dim = 256,
        depth = 4,
        heads = 4,
        mlp_dim = 512
    ),
    vit_dim = 256
)

value_model = SigLIPValueNetwork(
    siglip_image_size = 224,
    siglip_patch_size = 16,
    siglip_dim = 256,
    siglip_depth = 4,
    siglip_heads = 4,
    siglip_mlp_dim = 512
)

# 4. Instantiate the RISE Orchestrator
rise = RISE(
    policy = policy,
    dynamics_model = dynamics_model,
    value_model = value_model,
    trajectory_length = 8,
    num_prompt_tokens = 12,
    imagination_steps = 5
)

# 5. Imagination Rollout Stage
# The policy generates actions, the dynamics model predicts the future,
# the value network evaluates the advantage, and experience is stored.
replay_buffer = rise.imagination_rollout(
    seed_dataset = dataset,
    num_episodes = 2,
    batch_size = 1,
    buffer_folder = './rise_experience_buffer'
)

# 6. Self-Improvement Finetuning Stage
# The policy learns to imitate high-advantage imagined trajectories.
rise.finetune_with_advantage_conditioning(
    replay_buffer = replay_buffer,
    num_steps = 1000,
    batch_size = 2,
    lr = 1e-4
)

# 7. Save the Self-Improved Policy
torch.save(rise.policy.state_dict(), './improved_pi05_policy.pt')
```

## Citations

```bibtex
@misc{yang2026riseselfimprovingrobotpolicy,
    title   = {RISE: Self-Improving Robot Policy with Compositional World Model}, 
    author  = {Jiazhi Yang and Kunyang Lin and Jinwei Li and Wencong Zhang and Tianwei Lin and Longyan Wu and Zhizhong Su and Hao Zhao and Ya-Qin Zhang and Li Chen and Ping Luo and Xiangyu Yue and Hongyang Li},
    year    = {2026},
    eprint  = {2602.11075},
    archivePrefix = {arXiv},
    primaryClass = {cs.RO},
    url     = {https://arxiv.org/abs/2602.11075}, 
}
```
