Name | sinkhorn-router-pytorch JSON |
Version |
0.0.11
JSON |
| download |
home_page | None |
Summary | Sinkhorn Router - Pytorch |
upload_time | 2024-08-27 18:28:22 |
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
deep learning
mixture of experts
routing
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
## Sinkhorn Router - Pytorch (wip)
Self contained pytorch implementation of a sinkhorn based router, for mixture of experts or otherwise. Will contain both a causal and non-causal variant. The causal variant will follow the example used in Megatron
## Install
```bash
$ pip install sinkhorn-router-pytorch
```
## Usage
```python
import torch
from torch import nn
from sinkhorn_router_pytorch import SinkhornRouter
experts = nn.Parameter(torch.randn(8, 8, 512, 256)) # (experts, heads, dim [in], dim [out])
router = SinkhornRouter(
dim = 512,
experts = experts,
competitive = True,
causal = False,
)
x = torch.randn(1, 8, 1017, 512)
out = router(x) # (1, 8, 1017, 256)
```
## Citations
```bibtex
@article{Shoeybi2019MegatronLMTM,
title = {Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism},
author = {Mohammad Shoeybi and Mostofa Patwary and Raul Puri and Patrick LeGresley and Jared Casper and Bryan Catanzaro},
journal = {ArXiv},
year = {2019},
volume = {abs/1909.08053},
url = {https://api.semanticscholar.org/CorpusID:202660670}
}
```
```bibtex
@article{Anthony2024BlackMambaMO,
title = {BlackMamba: Mixture of Experts for State-Space Models},
author = {Quentin Anthony and Yury Tokpanov and Paolo Glorioso and Beren Millidge},
journal = {ArXiv},
year = {2024},
volume = {abs/2402.01771},
url = {https://api.semanticscholar.org/CorpusID:267413070}
}
```
```bibtex
@article{Csordas2023SwitchHeadAT,
title = {SwitchHead: Accelerating Transformers with Mixture-of-Experts Attention},
author = {R'obert Csord'as and Piotr Piekos and Kazuki Irie and J{\"u}rgen Schmidhuber},
journal = {ArXiv},
year = {2023},
volume = {abs/2312.07987},
url = {https://api.semanticscholar.org/CorpusID:266191825}
}
```
Raw data
{
"_id": null,
"home_page": null,
"name": "sinkhorn-router-pytorch",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "artificial intelligence, deep learning, mixture of experts, routing",
"author": null,
"author_email": "Phil Wang <lucidrains@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/69/5c/e8c9ea65f780a8b5995814db6844c172f9ff0cb0ad73a6463c421c44275a/sinkhorn_router_pytorch-0.0.11.tar.gz",
"platform": null,
"description": "## Sinkhorn Router - Pytorch (wip)\n\nSelf contained pytorch implementation of a sinkhorn based router, for mixture of experts or otherwise. Will contain both a causal and non-causal variant. The causal variant will follow the example used in Megatron\n\n## Install\n\n```bash\n$ pip install sinkhorn-router-pytorch\n```\n\n## Usage\n\n```python\nimport torch\nfrom torch import nn\nfrom sinkhorn_router_pytorch import SinkhornRouter\n\nexperts = nn.Parameter(torch.randn(8, 8, 512, 256)) # (experts, heads, dim [in], dim [out])\n\nrouter = SinkhornRouter(\n dim = 512,\n experts = experts,\n competitive = True,\n causal = False,\n)\n\nx = torch.randn(1, 8, 1017, 512)\nout = router(x) # (1, 8, 1017, 256)\n```\n\n## Citations\n\n```bibtex\n@article{Shoeybi2019MegatronLMTM,\n title = {Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism},\n author = {Mohammad Shoeybi and Mostofa Patwary and Raul Puri and Patrick LeGresley and Jared Casper and Bryan Catanzaro},\n journal = {ArXiv},\n year = {2019},\n volume = {abs/1909.08053},\n url = {https://api.semanticscholar.org/CorpusID:202660670}\n}\n```\n\n```bibtex\n@article{Anthony2024BlackMambaMO,\n title = {BlackMamba: Mixture of Experts for State-Space Models},\n author = {Quentin Anthony and Yury Tokpanov and Paolo Glorioso and Beren Millidge},\n journal = {ArXiv},\n year = {2024},\n volume = {abs/2402.01771},\n url = {https://api.semanticscholar.org/CorpusID:267413070}\n}\n```\n\n```bibtex\n@article{Csordas2023SwitchHeadAT,\n title = {SwitchHead: Accelerating Transformers with Mixture-of-Experts Attention},\n author = {R'obert Csord'as and Piotr Piekos and Kazuki Irie and J{\\\"u}rgen Schmidhuber},\n journal = {ArXiv},\n year = {2023},\n volume = {abs/2312.07987},\n url = {https://api.semanticscholar.org/CorpusID:266191825}\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": "Sinkhorn Router - Pytorch",
"version": "0.0.11",
"project_urls": {
"Homepage": "https://pypi.org/project/sinkhorn-router-pytorch/",
"Repository": "https://github.com/lucidrains/sinkhorn-router-pytorch"
},
"split_keywords": [
"artificial intelligence",
" deep learning",
" mixture of experts",
" routing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f0f5d074c5da66a1d67a01c0215bf9a6f546b597cee55a7fb990bd12c002bb79",
"md5": "7ba96d013703a115a02ff22de0ef09a4",
"sha256": "9e5b02e87ffef10a94ba2c8bd6cac1bfa4153720a90844b8570b9839135dbb9b"
},
"downloads": -1,
"filename": "sinkhorn_router_pytorch-0.0.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7ba96d013703a115a02ff22de0ef09a4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 8465,
"upload_time": "2024-08-27T18:28:21",
"upload_time_iso_8601": "2024-08-27T18:28:21.223697Z",
"url": "https://files.pythonhosted.org/packages/f0/f5/d074c5da66a1d67a01c0215bf9a6f546b597cee55a7fb990bd12c002bb79/sinkhorn_router_pytorch-0.0.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "695ce8c9ea65f780a8b5995814db6844c172f9ff0cb0ad73a6463c421c44275a",
"md5": "e656e51c8d396e64379fc754888bbdc7",
"sha256": "cf412d992a4a20df64594574b0ba197e21a9a7563c359fc3a0cd966ac796eed8"
},
"downloads": -1,
"filename": "sinkhorn_router_pytorch-0.0.11.tar.gz",
"has_sig": false,
"md5_digest": "e656e51c8d396e64379fc754888bbdc7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 9114,
"upload_time": "2024-08-27T18:28:22",
"upload_time_iso_8601": "2024-08-27T18:28:22.721983Z",
"url": "https://files.pythonhosted.org/packages/69/5c/e8c9ea65f780a8b5995814db6844c172f9ff0cb0ad73a6463c421c44275a/sinkhorn_router_pytorch-0.0.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-27 18:28:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "lucidrains",
"github_project": "sinkhorn-router-pytorch",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "sinkhorn-router-pytorch"
}