genie2-pytorch


Namegenie2-pytorch JSON
Version 0.0.21 PyPI version JSON
download
home_pageNone
SummaryGenie2
upload_time2025-01-07 16:36: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 attention mechanism deep learning transformers world models
VCS
bugtrack_url
requirements vizdoom
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <img src="./genie2.png" width="400px"></img>

## Genie2 - Pytorch (wip)

Implementation of a framework for <a href="https://deepmind.google/discover/blog/genie-2-a-large-scale-foundation-world-model/">Genie2</a> in Pytorch

## Install

```bash
$ pip install genie2-pytorch
```

## Usage

```python
import torch
from genie2_pytorch import Genie2

genie = Genie2(
    dim = 512,
    depth = 12,
    dim_latent = 768,
    num_actions = 256,
    latent_channel_first = True,
    is_video_enc_dec = True
)

video = torch.randn(2, 768, 3, 2, 2)
actions = torch.randint(0, 256, (2, 3))

loss, breakdown = genie(video, actions = actions)
loss.backward()

generated_video = genie.generate(video[:, :, 0], num_frames = 16)

assert generated_video.shape == (2, 768, 16 + 1, 2, 2)
```

Interactive

```python
import torch
from genie2_pytorch import Genie2

genie = Genie2(
    dim = 512,
    depth = 12,
    dim_latent = 768,
    num_actions = 256,
    latent_channel_first = True,
    is_video_enc_dec = True
)

video = torch.randn(1, 768, 3, 2, 2)
actions = torch.randint(0, 256, (1, 3))

loss, breakdown = genie(video, actions = actions)
loss.backward()

generated_video, actions = genie.generate(
    video[:, :, 0],
    num_frames = 16,
    interactive = True,
    init_action = 0
)

# you will be prompted to enter the next action id(s) at every next time frame of the video

assert generated_video.shape == (1, 768, 16 + 1, 2, 2)
```

## Citations

```bibtex
@inproceedings{Valevski2024DiffusionMA,
    title   = {Diffusion Models Are Real-Time Game Engines},
    author  = {Dani Valevski and Yaniv Leviathan and Moab Arar and Shlomi Fruchter},
    year    = {2024},
    url     = {https://api.semanticscholar.org/CorpusID:271962839}
}
```

```bibtex
@article{Ding2024DiffusionWM,
    title     = {Diffusion World Model},
    author    = {Zihan Ding and Amy Zhang and Yuandong Tian and Qinqing Zheng},
    journal   = {ArXiv},
    year      = {2024},
    volume    = {abs/2402.03570},
    url       = {https://api.semanticscholar.org/CorpusID:267499902}
}
```

```bibtex
@inproceedings{Sadat2024EliminatingOA,
    title   = {Eliminating Oversaturation and Artifacts of High Guidance Scales in Diffusion Models},
    author  = {Seyedmorteza Sadat and Otmar Hilliges and Romann M. Weber},
    year    = {2024},
    url     = {https://api.semanticscholar.org/CorpusID:273098845}
}
```

```bibtex
@misc{ParkerHolder2024,
    author  = {Jack Parker-Holder, Philip Ball, Jake Bruce, Vibhavari Dasagi, Kristian Holsheimer, Christos Kaplanis, Alexandre Moufarek, Guy Scully, Jeremy Shar, Jimmy Shi, Stephen Spencer, Jessica Yung, Michael Dennis, Sultan Kenjeyev, Shangbang Long, Vlad Mnih, Harris Chan, Maxime Gazeau, Bonnie Li, Fabio Pardo, Luyu Wang, Lei Zhang, Frederic Besse, Tim Harley, Anna Mitenkova, Jane Wang, Jeff Clune, Demis Hassabis, Raia Hadsell, Adrian Bolton, Satinder Singh, Tim Rocktäschel},
    url     = {https://deepmind.google/discover/blog/genie-2-a-large-scale-foundation-world-model/}
}
```

```bibtex
@inproceedings{Nguyen2024TurningUT,
    title   = {Turning Up the Heat: Min-p Sampling for Creative and Coherent LLM Outputs},
    author  = {Minh Nguyen and Andrew Baker and Clement Neo and Allen Roush and Andreas Kirsch and Ravid Shwartz-Ziv},
    year    = {2024},
    url     = {https://api.semanticscholar.org/CorpusID:270870613}
}
```

```bibtex
@article{Lee2022AutoregressiveIG,
    title   = {Autoregressive Image Generation using Residual Quantization},
    author  = {Doyup Lee and Chiheon Kim and Saehoon Kim and Minsu Cho and Wook-Shin Han},
    journal = {2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    year    = {2022},
    pages   = {11513-11522},
    url     = {https://api.semanticscholar.org/CorpusID:247244535}
}
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "genie2-pytorch",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "artificial intelligence, attention mechanism, deep learning, transformers, world models",
    "author": null,
    "author_email": "Phil Wang <lucidrains@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/c1/46/087d6e769219704ef0b2178ed8d2ef4e6b8fd4155a4e9521afdd8ff8382c/genie2_pytorch-0.0.21.tar.gz",
    "platform": null,
    "description": "<img src=\"./genie2.png\" width=\"400px\"></img>\n\n## Genie2 - Pytorch (wip)\n\nImplementation of a framework for <a href=\"https://deepmind.google/discover/blog/genie-2-a-large-scale-foundation-world-model/\">Genie2</a> in Pytorch\n\n## Install\n\n```bash\n$ pip install genie2-pytorch\n```\n\n## Usage\n\n```python\nimport torch\nfrom genie2_pytorch import Genie2\n\ngenie = Genie2(\n    dim = 512,\n    depth = 12,\n    dim_latent = 768,\n    num_actions = 256,\n    latent_channel_first = True,\n    is_video_enc_dec = True\n)\n\nvideo = torch.randn(2, 768, 3, 2, 2)\nactions = torch.randint(0, 256, (2, 3))\n\nloss, breakdown = genie(video, actions = actions)\nloss.backward()\n\ngenerated_video = genie.generate(video[:, :, 0], num_frames = 16)\n\nassert generated_video.shape == (2, 768, 16 + 1, 2, 2)\n```\n\nInteractive\n\n```python\nimport torch\nfrom genie2_pytorch import Genie2\n\ngenie = Genie2(\n    dim = 512,\n    depth = 12,\n    dim_latent = 768,\n    num_actions = 256,\n    latent_channel_first = True,\n    is_video_enc_dec = True\n)\n\nvideo = torch.randn(1, 768, 3, 2, 2)\nactions = torch.randint(0, 256, (1, 3))\n\nloss, breakdown = genie(video, actions = actions)\nloss.backward()\n\ngenerated_video, actions = genie.generate(\n    video[:, :, 0],\n    num_frames = 16,\n    interactive = True,\n    init_action = 0\n)\n\n# you will be prompted to enter the next action id(s) at every next time frame of the video\n\nassert generated_video.shape == (1, 768, 16 + 1, 2, 2)\n```\n\n## Citations\n\n```bibtex\n@inproceedings{Valevski2024DiffusionMA,\n    title   = {Diffusion Models Are Real-Time Game Engines},\n    author  = {Dani Valevski and Yaniv Leviathan and Moab Arar and Shlomi Fruchter},\n    year    = {2024},\n    url     = {https://api.semanticscholar.org/CorpusID:271962839}\n}\n```\n\n```bibtex\n@article{Ding2024DiffusionWM,\n    title     = {Diffusion World Model},\n    author    = {Zihan Ding and Amy Zhang and Yuandong Tian and Qinqing Zheng},\n    journal   = {ArXiv},\n    year      = {2024},\n    volume    = {abs/2402.03570},\n    url       = {https://api.semanticscholar.org/CorpusID:267499902}\n}\n```\n\n```bibtex\n@inproceedings{Sadat2024EliminatingOA,\n    title   = {Eliminating Oversaturation and Artifacts of High Guidance Scales in Diffusion Models},\n    author  = {Seyedmorteza Sadat and Otmar Hilliges and Romann M. Weber},\n    year    = {2024},\n    url     = {https://api.semanticscholar.org/CorpusID:273098845}\n}\n```\n\n```bibtex\n@misc{ParkerHolder2024,\n    author  = {Jack Parker-Holder, Philip Ball, Jake Bruce, Vibhavari Dasagi, Kristian Holsheimer, Christos Kaplanis, Alexandre Moufarek, Guy Scully, Jeremy Shar, Jimmy Shi, Stephen Spencer, Jessica Yung, Michael Dennis, Sultan Kenjeyev, Shangbang Long, Vlad Mnih, Harris Chan, Maxime Gazeau, Bonnie Li, Fabio Pardo, Luyu Wang, Lei Zhang, Frederic Besse, Tim Harley, Anna Mitenkova, Jane Wang, Jeff Clune, Demis Hassabis, Raia Hadsell, Adrian Bolton, Satinder Singh, Tim Rockt\u00e4schel},\n    url     = {https://deepmind.google/discover/blog/genie-2-a-large-scale-foundation-world-model/}\n}\n```\n\n```bibtex\n@inproceedings{Nguyen2024TurningUT,\n    title   = {Turning Up the Heat: Min-p Sampling for Creative and Coherent LLM Outputs},\n    author  = {Minh Nguyen and Andrew Baker and Clement Neo and Allen Roush and Andreas Kirsch and Ravid Shwartz-Ziv},\n    year    = {2024},\n    url     = {https://api.semanticscholar.org/CorpusID:270870613}\n}\n```\n\n```bibtex\n@article{Lee2022AutoregressiveIG,\n    title   = {Autoregressive Image Generation using Residual Quantization},\n    author  = {Doyup Lee and Chiheon Kim and Saehoon Kim and Minsu Cho and Wook-Shin Han},\n    journal = {2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},\n    year    = {2022},\n    pages   = {11513-11522},\n    url     = {https://api.semanticscholar.org/CorpusID:247244535}\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": "Genie2",
    "version": "0.0.21",
    "project_urls": {
        "Homepage": "https://pypi.org/project/genie2-pytorch/",
        "Repository": "https://github.com/lucidrains/genie2-pytorch"
    },
    "split_keywords": [
        "artificial intelligence",
        " attention mechanism",
        " deep learning",
        " transformers",
        " world models"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ed4c4ee677cad894fcdd7f6e8b2a68040373e37b99ec19f5cde46d8982012951",
                "md5": "0a6b92e6c2ed7a7503d35e18e3026b65",
                "sha256": "d84c507681f9aed90874fc7485d22c49bc226d6a07e49f13bec8038dfd8adc39"
            },
            "downloads": -1,
            "filename": "genie2_pytorch-0.0.21-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0a6b92e6c2ed7a7503d35e18e3026b65",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 11225,
            "upload_time": "2025-01-07T16:36:33",
            "upload_time_iso_8601": "2025-01-07T16:36:33.008603Z",
            "url": "https://files.pythonhosted.org/packages/ed/4c/4ee677cad894fcdd7f6e8b2a68040373e37b99ec19f5cde46d8982012951/genie2_pytorch-0.0.21-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c146087d6e769219704ef0b2178ed8d2ef4e6b8fd4155a4e9521afdd8ff8382c",
                "md5": "e31f65b1f74dd202dc37d478e26d0950",
                "sha256": "47f1d6a0779ee9288a85f9b3c8968ef563df996db8a2d9e1eb887ca254b9e5e9"
            },
            "downloads": -1,
            "filename": "genie2_pytorch-0.0.21.tar.gz",
            "has_sig": false,
            "md5_digest": "e31f65b1f74dd202dc37d478e26d0950",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 1291730,
            "upload_time": "2025-01-07T16:36:35",
            "upload_time_iso_8601": "2025-01-07T16:36:35.300932Z",
            "url": "https://files.pythonhosted.org/packages/c1/46/087d6e769219704ef0b2178ed8d2ef4e6b8fd4155a4e9521afdd8ff8382c/genie2_pytorch-0.0.21.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-07 16:36:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lucidrains",
    "github_project": "genie2-pytorch",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "vizdoom",
            "specs": []
        }
    ],
    "lcname": "genie2-pytorch"
}
        
Elapsed time: 4.38864s