| Name | PEER-pytorch JSON |
| Version |
0.2.2
JSON |
| download |
| home_page | None |
| Summary | PEER - Pytorch |
| upload_time | 2025-11-01 16:18:12 |
| 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}
}
```
```bibtex
@inproceedings{anonymous2025continual,
title = {Continual Learning via Sparse Memory Finetuning},
author = {Anonymous},
booktitle = {Submitted to The Fourteenth International Conference on Learning Representations},
year = {2025},
url = {https://openreview.net/forum?id=LGo7U1m24L},
note = {under review}
}
```
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/57/51/02cb3eb051abe7ad12ad80ed196943d6969fb8bc6d74430588b9f6e2dc45/peer_pytorch-0.2.2.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\n```bibtex\n@inproceedings{anonymous2025continual,\n title = {Continual Learning via Sparse Memory Finetuning},\n author = {Anonymous},\n booktitle = {Submitted to The Fourteenth International Conference on Learning Representations},\n year = {2025},\n url = {https://openreview.net/forum?id=LGo7U1m24L},\n note = {under review}\n}\n```\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2024 Phil Wang\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.",
"summary": "PEER - Pytorch",
"version": "0.2.2",
"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": null,
"digests": {
"blake2b_256": "1dc7beb72a8f683baf3a3ffa1f0b76974854b4dac4a5fdf4f661190cdae71143",
"md5": "c2f83317759e4bb3454caa33c1829e12",
"sha256": "e9bc1a251bb428ab6ce4043f28ecaacd9a3de39b2b13b1133eacbc5c767e0d8d"
},
"downloads": -1,
"filename": "peer_pytorch-0.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c2f83317759e4bb3454caa33c1829e12",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 11223,
"upload_time": "2025-11-01T16:18:10",
"upload_time_iso_8601": "2025-11-01T16:18:10.302212Z",
"url": "https://files.pythonhosted.org/packages/1d/c7/beb72a8f683baf3a3ffa1f0b76974854b4dac4a5fdf4f661190cdae71143/peer_pytorch-0.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "575102cb3eb051abe7ad12ad80ed196943d6969fb8bc6d74430588b9f6e2dc45",
"md5": "061c0bacf8bdb0227b79e3119513ee33",
"sha256": "54e9794c3e8df635e8b4d6a1f5dd8c24c65c85e9ca5c8c3ea6a03ce1525c7963"
},
"downloads": -1,
"filename": "peer_pytorch-0.2.2.tar.gz",
"has_sig": false,
"md5_digest": "061c0bacf8bdb0227b79e3119513ee33",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 268343,
"upload_time": "2025-11-01T16:18:12",
"upload_time_iso_8601": "2025-11-01T16:18:12.253799Z",
"url": "https://files.pythonhosted.org/packages/57/51/02cb3eb051abe7ad12ad80ed196943d6969fb8bc6d74430588b9f6e2dc45/peer_pytorch-0.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-11-01 16:18:12",
"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"
}