Name | maskbit-pytorch JSON |
Version |
0.0.2
JSON |
| download |
home_page | None |
Summary | MaskBit |
upload_time | 2024-11-12 19:18:27 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
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. |
keywords |
artificial intelligence
attention mechanism
deep learning
image generation
scalar quantization
transformers
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<img src="./maskbit.png" width="400px"></img>
## MaskBit - Pytorch (wip)
Implementation of the proposed [MaskBit](https://arxiv.org/abs/2409.16211) from Bytedance AI
This paper can be viewed as a modernized version of the architecture from [Taming Transformers](https://arxiv.org/abs/2012.09841) from Esser et al.
They use the binary scalar quantization proposed in [MagVit2](https://arxiv.org/abs/2310.05737) in their autoencoder, and then non-autoregressive mask decoding, where the masking is setting the bit (`-1` or `+1`) to `0`, projected for the transformer without explicit embeddings for the trit
## Usage
```python
import torch
from maskbit_pytorch import BQVAE, MaskBit
images = torch.randn(1, 3, 64, 64)
# train vae
vae = BQVAE(
image_size = 64,
dim = 512
)
loss = vae(images, return_loss = True)
loss.backward()
# train maskbit
maskbit = MaskBit(
vae,
dim = 512,
bits_group_size = 512,
depth = 2
)
loss = maskbit(images)
loss.backward()
# after much training
sampled_image = maskbit.sample() # (1, 3, 64, 64)
```
## Citations
```bibtex
@inproceedings{Weber2024MaskBitEI,
title = {MaskBit: Embedding-free Image Generation via Bit Tokens},
author = {Mark Weber and Lijun Yu and Qihang Yu and Xueqing Deng and Xiaohui Shen and Daniel Cremers and Liang-Chieh Chen},
year = {2024},
url = {https://api.semanticscholar.org/CorpusID:272832013}
}
```
Raw data
{
"_id": null,
"home_page": null,
"name": "maskbit-pytorch",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "artificial intelligence, attention mechanism, deep learning, image generation, scalar quantization, transformers",
"author": null,
"author_email": "Phil Wang <lucidrains@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/22/70/e71008d095a51c62623618e262bdc2ab170aad2b78d3c046a3f1f7891ac7/maskbit_pytorch-0.0.2.tar.gz",
"platform": null,
"description": "<img src=\"./maskbit.png\" width=\"400px\"></img>\n\n## MaskBit - Pytorch (wip)\n\nImplementation of the proposed [MaskBit](https://arxiv.org/abs/2409.16211) from Bytedance AI\n\nThis paper can be viewed as a modernized version of the architecture from [Taming Transformers](https://arxiv.org/abs/2012.09841) from Esser et al.\n\nThey use the binary scalar quantization proposed in [MagVit2](https://arxiv.org/abs/2310.05737) in their autoencoder, and then non-autoregressive mask decoding, where the masking is setting the bit (`-1` or `+1`) to `0`, projected for the transformer without explicit embeddings for the trit\n\n## Usage\n\n```python\nimport torch\nfrom maskbit_pytorch import BQVAE, MaskBit\n\nimages = torch.randn(1, 3, 64, 64)\n\n# train vae\n\nvae = BQVAE(\n image_size = 64,\n dim = 512\n)\n\nloss = vae(images, return_loss = True)\nloss.backward()\n\n# train maskbit\n\nmaskbit = MaskBit(\n vae,\n dim = 512,\n bits_group_size = 512,\n depth = 2\n)\n\nloss = maskbit(images)\nloss.backward()\n\n# after much training\n\nsampled_image = maskbit.sample() # (1, 3, 64, 64)\n```\n\n## Citations\n\n```bibtex\n@inproceedings{Weber2024MaskBitEI,\n title = {MaskBit: Embedding-free Image Generation via Bit Tokens},\n author = {Mark Weber and Lijun Yu and Qihang Yu and Xueqing Deng and Xiaohui Shen and Daniel Cremers and Liang-Chieh Chen},\n year = {2024},\n url = {https://api.semanticscholar.org/CorpusID:272832013}\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": "MaskBit",
"version": "0.0.2",
"project_urls": {
"Homepage": "https://pypi.org/project/maskbit-pytorch/",
"Repository": "https://github.com/lucidrains/maskbit-pytorch"
},
"split_keywords": [
"artificial intelligence",
" attention mechanism",
" deep learning",
" image generation",
" scalar quantization",
" transformers"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9f4c9c2ed1c2440c76c902c71c83d52c4717010acee26f14ea5a9a05ff254710",
"md5": "17e5987d582fa8086c1c48d5eec4824a",
"sha256": "9d5a48b99faaad5cf5d4d5096de782188c2adba2d156ea7175bb333261b3fc3d"
},
"downloads": -1,
"filename": "maskbit_pytorch-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "17e5987d582fa8086c1c48d5eec4824a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 12528,
"upload_time": "2024-11-12T19:18:25",
"upload_time_iso_8601": "2024-11-12T19:18:25.874195Z",
"url": "https://files.pythonhosted.org/packages/9f/4c/9c2ed1c2440c76c902c71c83d52c4717010acee26f14ea5a9a05ff254710/maskbit_pytorch-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2270e71008d095a51c62623618e262bdc2ab170aad2b78d3c046a3f1f7891ac7",
"md5": "84c9678ff54dce944e5d10fe16f2e979",
"sha256": "8e4ff775594d0bf11822352ab423f9ad543eb0d5137ff59f91a7d654b5dd55bf"
},
"downloads": -1,
"filename": "maskbit_pytorch-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "84c9678ff54dce944e5d10fe16f2e979",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 285887,
"upload_time": "2024-11-12T19:18:27",
"upload_time_iso_8601": "2024-11-12T19:18:27.774130Z",
"url": "https://files.pythonhosted.org/packages/22/70/e71008d095a51c62623618e262bdc2ab170aad2b78d3c046a3f1f7891ac7/maskbit_pytorch-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-12 19:18:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "lucidrains",
"github_project": "maskbit-pytorch",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "maskbit-pytorch"
}