Name | PEER-pytorch JSON |
Version |
0.2.1
JSON |
| download |
home_page | None |
Summary | PEER - Pytorch |
upload_time | 2024-08-23 13:20:28 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.8 |
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
deep learning
mixture of experts
product key
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
<img src="./peer.png" width="400px"></img>
<img src="./peer2.png" width="400px"></img>
## PEER - Pytorch
Pytorch implementation of the PEER block from the Deepmind paper, <a href="https://arxiv.org/abs/2407.04153">Mixture of A Million Experts</a>, by Xu Owen He.
## Install
```bash
$ pip install PEER-pytorch
```
## Usage
```python
import torch
from PEER_pytorch import PEER
peer = PEER(
dim = 512,
heads = 8, # tested up to 32 - (hk = heads * num_experts_per_head (16))
num_experts = 1_000_000, # he chose 1 million
num_experts_per_head = 16, # he settled on 16, but was 32 in PKM paper
dim_key = 128,
pre_rmsnorm = True
).cuda()
x = torch.randn(2, 1024, 512).cuda()
out = peer(x) + x
assert x.shape == out.shape
```
## Citations
```bibtex
@inproceedings{He2024MixtureOA,
title = {Mixture of A Million Experts},
author = {Xu Owen He},
year = {2024},
url = {https://api.semanticscholar.org/CorpusID:271038610}
}
```
```bibtex
@article{Csordas2023ApproximatingTF,
title = {Approximating Two-Layer Feedforward Networks for Efficient Transformers},
author = {R'obert Csord'as and Kazuki Irie and J{\"u}rgen Schmidhuber},
journal = {ArXiv},
year = {2023},
volume = {abs/2310.10837},
url = {https://api.semanticscholar.org/CorpusID:264172384}
}
```
Raw data
{
"_id": null,
"home_page": null,
"name": "PEER-pytorch",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "artificial intelligence, deep learning, mixture of experts, product key",
"author": null,
"author_email": "Phil Wang <lucidrains@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/e5/03/240d177d100b6d94b3de0f897d25dc307e4be2567949312662d8d675579d/peer_pytorch-0.2.1.tar.gz",
"platform": null,
"description": "<img src=\"./peer.png\" width=\"400px\"></img>\n\n<img src=\"./peer2.png\" width=\"400px\"></img>\n\n## PEER - Pytorch\n\nPytorch implementation of the PEER block from the Deepmind paper, <a href=\"https://arxiv.org/abs/2407.04153\">Mixture of A Million Experts</a>, by Xu Owen He.\n\n## Install\n\n```bash\n$ pip install PEER-pytorch\n```\n\n## Usage\n\n```python\nimport torch\nfrom PEER_pytorch import PEER\n\npeer = PEER(\n dim = 512,\n heads = 8, # tested up to 32 - (hk = heads * num_experts_per_head (16))\n num_experts = 1_000_000, # he chose 1 million\n num_experts_per_head = 16, # he settled on 16, but was 32 in PKM paper\n dim_key = 128,\n pre_rmsnorm = True\n).cuda()\n\nx = torch.randn(2, 1024, 512).cuda()\n\nout = peer(x) + x\n\nassert x.shape == out.shape\n```\n\n## Citations\n\n```bibtex\n@inproceedings{He2024MixtureOA,\n title = {Mixture of A Million Experts},\n author = {Xu Owen He},\n year = {2024},\n url = {https://api.semanticscholar.org/CorpusID:271038610}\n}\n```\n\n```bibtex\n@article{Csordas2023ApproximatingTF,\n title = {Approximating Two-Layer Feedforward Networks for Efficient Transformers},\n author = {R'obert Csord'as and Kazuki Irie and J{\\\"u}rgen Schmidhuber},\n journal = {ArXiv},\n year = {2023},\n volume = {abs/2310.10837},\n url = {https://api.semanticscholar.org/CorpusID:264172384}\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": "PEER - Pytorch",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://pypi.org/project/PEER-pytorch/",
"Repository": "https://github.com/lucidrains/PEER-pytorch"
},
"split_keywords": [
"artificial intelligence",
" deep learning",
" mixture of experts",
" product key"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6500548cdc160668723af782ef9ac60a38e4efc4a9f9fb10f258044bb98cf333",
"md5": "8e4de2d03a984de0bd962810e31e963f",
"sha256": "0979861a320cf6b09176bb023d21d6cfb984b96c3e9fd428ff7aee834046aec8"
},
"downloads": -1,
"filename": "peer_pytorch-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8e4de2d03a984de0bd962810e31e963f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 10890,
"upload_time": "2024-08-23T13:20:26",
"upload_time_iso_8601": "2024-08-23T13:20:26.874204Z",
"url": "https://files.pythonhosted.org/packages/65/00/548cdc160668723af782ef9ac60a38e4efc4a9f9fb10f258044bb98cf333/peer_pytorch-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e503240d177d100b6d94b3de0f897d25dc307e4be2567949312662d8d675579d",
"md5": "bf2a30bf7856c44feab14ec9b377e131",
"sha256": "1b96b4ff2f3fa8c0186d8139d62981b344759adcab020902bfd17dc2e943712e"
},
"downloads": -1,
"filename": "peer_pytorch-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "bf2a30bf7856c44feab14ec9b377e131",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 268015,
"upload_time": "2024-08-23T13:20:28",
"upload_time_iso_8601": "2024-08-23T13:20:28.562268Z",
"url": "https://files.pythonhosted.org/packages/e5/03/240d177d100b6d94b3de0f897d25dc307e4be2567949312662d8d675579d/peer_pytorch-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-23 13:20:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "lucidrains",
"github_project": "PEER-pytorch",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "peer-pytorch"
}