pi-zero-pytorch


Namepi-zero-pytorch JSON
Version 0.0.2 PyPI version JSON
download
home_pageNone
Summaryπ0 in Pytorch
upload_time2024-11-05 15:25:35
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2024 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.
keywords artificial intelligence deep learning flow policy robotic foundation model transformers
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <img src="./fig3.png" width="400px"></img>

## pi-zero-pytorch (wip)

Implementation of <a href="https://www.physicalintelligence.company/blog/pi0">π₀</a> the robotic foundation model architecture proposed by Physical Intelligence

Summary of this work would be that it is a simplified <a href="https://github.com/lucidrains/transfusion-pytorch">Transfusion</a> (Zhou et al.) with influence from <a href="https://arxiv.org/abs/2403.03206">Stable Diffusion 3</a> (Esser et al.), mainly the adoption of flow matching instead of diffusion for policy generation, as well as the separation of parameters (<a href="https://github.com/lucidrains/mmdit/blob/main/mmdit/mmdit_pytorch.py#L43">Joint Attention</a> from mmDIT).

## Install

```bash
$ pip install pi-zero-pytorch
```

## Usage

```python
import torch
from pi_zero_pytorch import π0

model = π0(
    dim = 512,
    dim_action_input = 6,
    dim_joint_state = 12,
    num_tokens = 20_000
)

vision = torch.randn(1, 1024, 512)
commands = torch.randint(0, 20_000, (1, 1024))
joint_state = torch.randn(1, 12)
actions = torch.randn(1, 32, 6)

loss, _ = model(vision, commands, joint_state, actions)
loss.backward()

# after much training

sampled_actions = model(vision, commands, joint_state, trajectory_length = 32) # (1, 32, 6)
```

## Citation

```bibtex
@misc{Black2024,
    author  = {Kevin Black, Noah Brown, Danny Driess, Adnan Esmail, Michael Equi, Chelsea Finn, Niccolo Fusai, Lachy Groom, Karol Hausman, Brian Ichter, Szymon Jakubczak, Tim Jones, Liyiming Ke, Sergey Levine, Adrian Li-Bell, Mohith Mothukuri, Suraj Nair, Karl Pertsch, Lucy Xiaoyang Shi, James Tanner, Quan Vuong, Anna Walling, Haohuan Wang, Ury Zhilinsky},
    url     = {https://www.physicalintelligence.company/download/pi0.pdf}
}
```

```bibtex
@inproceedings{Zhou2024ValueRL,
    title   = {Value Residual Learning For Alleviating Attention Concentration In Transformers},
    author  = {Zhanchao Zhou and Tianyi Wu and Zhiyun Jiang and Zhenzhong Lan},
    year    = {2024},
    url     = {https://api.semanticscholar.org/CorpusID:273532030}
}
```

```bibtex
@inproceedings{Yao2024FasterDiTTF,
    title   = {FasterDiT: Towards Faster Diffusion Transformers Training without Architecture Modification},
    author  = {Jingfeng Yao and Wang Cheng and Wenyu Liu and Xinggang Wang},
    year    = {2024},
    url     = {https://api.semanticscholar.org/CorpusID:273346237}
}
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pi-zero-pytorch",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "artificial intelligence, deep learning, flow policy, robotic foundation model, transformers",
    "author": null,
    "author_email": "Phil Wang <lucidrains@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/5a/4d/0abcfb3cd358d8abb85a258c8feda4b943e25cf55e56506abc2529814455/pi_zero_pytorch-0.0.2.tar.gz",
    "platform": null,
    "description": "<img src=\"./fig3.png\" width=\"400px\"></img>\n\n## pi-zero-pytorch (wip)\n\nImplementation of <a href=\"https://www.physicalintelligence.company/blog/pi0\">\u03c0\u2080</a> the robotic foundation model architecture proposed by Physical Intelligence\n\nSummary of this work would be that it is a simplified <a href=\"https://github.com/lucidrains/transfusion-pytorch\">Transfusion</a> (Zhou et al.) with influence from <a href=\"https://arxiv.org/abs/2403.03206\">Stable Diffusion 3</a> (Esser et al.), mainly the adoption of flow matching instead of diffusion for policy generation, as well as the separation of parameters (<a href=\"https://github.com/lucidrains/mmdit/blob/main/mmdit/mmdit_pytorch.py#L43\">Joint Attention</a> from mmDIT).\n\n## Install\n\n```bash\n$ pip install pi-zero-pytorch\n```\n\n## Usage\n\n```python\nimport torch\nfrom pi_zero_pytorch import \u03c00\n\nmodel = \u03c00(\n    dim = 512,\n    dim_action_input = 6,\n    dim_joint_state = 12,\n    num_tokens = 20_000\n)\n\nvision = torch.randn(1, 1024, 512)\ncommands = torch.randint(0, 20_000, (1, 1024))\njoint_state = torch.randn(1, 12)\nactions = torch.randn(1, 32, 6)\n\nloss, _ = model(vision, commands, joint_state, actions)\nloss.backward()\n\n# after much training\n\nsampled_actions = model(vision, commands, joint_state, trajectory_length = 32) # (1, 32, 6)\n```\n\n## Citation\n\n```bibtex\n@misc{Black2024,\n    author  = {Kevin Black, Noah Brown, Danny Driess, Adnan Esmail, Michael Equi, Chelsea Finn, Niccolo Fusai, Lachy Groom, Karol Hausman, Brian Ichter, Szymon Jakubczak, Tim Jones, Liyiming Ke, Sergey Levine, Adrian Li-Bell, Mohith Mothukuri, Suraj Nair, Karl Pertsch, Lucy Xiaoyang Shi, James Tanner, Quan Vuong, Anna Walling, Haohuan Wang, Ury Zhilinsky},\n    url     = {https://www.physicalintelligence.company/download/pi0.pdf}\n}\n```\n\n```bibtex\n@inproceedings{Zhou2024ValueRL,\n    title   = {Value Residual Learning For Alleviating Attention Concentration In Transformers},\n    author  = {Zhanchao Zhou and Tianyi Wu and Zhiyun Jiang and Zhenzhong Lan},\n    year    = {2024},\n    url     = {https://api.semanticscholar.org/CorpusID:273532030}\n}\n```\n\n```bibtex\n@inproceedings{Yao2024FasterDiTTF,\n    title   = {FasterDiT: Towards Faster Diffusion Transformers Training without Architecture Modification},\n    author  = {Jingfeng Yao and Wang Cheng and Wenyu Liu and Xinggang Wang},\n    year    = {2024},\n    url     = {https://api.semanticscholar.org/CorpusID:273346237}\n}\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 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.",
    "summary": "\u03c00 in Pytorch",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://pypi.org/project/pi-zero-pytorch/",
        "Repository": "https://github.com/lucidrains/pi-zero-pytorch"
    },
    "split_keywords": [
        "artificial intelligence",
        " deep learning",
        " flow policy",
        " robotic foundation model",
        " transformers"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "df6571d58c351a7fa0f15927153069cfc83247fb34656c068220e5ed4cae8393",
                "md5": "f84e78948b547248afb3be258b31c6d8",
                "sha256": "2ab9da9d265192e21257ab240f8313d50cf50488beec2211930806f3a1934d4a"
            },
            "downloads": -1,
            "filename": "pi_zero_pytorch-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f84e78948b547248afb3be258b31c6d8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 8534,
            "upload_time": "2024-11-05T15:25:31",
            "upload_time_iso_8601": "2024-11-05T15:25:31.809079Z",
            "url": "https://files.pythonhosted.org/packages/df/65/71d58c351a7fa0f15927153069cfc83247fb34656c068220e5ed4cae8393/pi_zero_pytorch-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5a4d0abcfb3cd358d8abb85a258c8feda4b943e25cf55e56506abc2529814455",
                "md5": "20576baa49b3760dc93e6d498c9389b4",
                "sha256": "71708c54938f6effe57205d9c9f6cbaef0fc814a3ffdc9ce0cb1e2c96f569862"
            },
            "downloads": -1,
            "filename": "pi_zero_pytorch-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "20576baa49b3760dc93e6d498c9389b4",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 1184094,
            "upload_time": "2024-11-05T15:25:35",
            "upload_time_iso_8601": "2024-11-05T15:25:35.331370Z",
            "url": "https://files.pythonhosted.org/packages/5a/4d/0abcfb3cd358d8abb85a258c8feda4b943e25cf55e56506abc2529814455/pi_zero_pytorch-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-05 15:25:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lucidrains",
    "github_project": "pi-zero-pytorch",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pi-zero-pytorch"
}
        
Elapsed time: 0.42061s