PEER - Pytorch
Project description
PEER - Pytorch
Pytorch implementation of the PEER block from the Deepmind paper, Mixture of A Million Experts, by Xu Owen He.
Install
$ pip install PEER-pytorch
Usage
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
@inproceedings{He2024MixtureOA,
title = {Mixture of A Million Experts},
author = {Xu Owen He},
year = {2024},
url = {https://api.semanticscholar.org/CorpusID:271038610}
}
@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}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
peer_pytorch-0.1.11.tar.gz
(267.4 kB
view details)
Built Distribution
File details
Details for the file peer_pytorch-0.1.11.tar.gz
.
File metadata
- Download URL: peer_pytorch-0.1.11.tar.gz
- Upload date:
- Size: 267.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9337d3df4b774ed94f6c53917bd21ca9276c8e6ab667d8b2e14198c4a842dea |
|
MD5 | 4bde3ebcc2a977e417134320e75ade98 |
|
BLAKE2b-256 | 4a0806cc2010e4d93079bec230fb10c8773dff8d3025fb082241904ff5f31b13 |
File details
Details for the file peer_pytorch-0.1.11-py3-none-any.whl
.
File metadata
- Download URL: peer_pytorch-0.1.11-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1bca0b356bca5f6ecd86a7a149fa55465e9d92af59e4c983102f04774cb1834b |
|
MD5 | bfc7d597e73452040b3a64824c67d8a5 |
|
BLAKE2b-256 | 03c5d0cf5125a82ffb1ad71f11909902603071fd2665d3443ceaf254c2df9fd3 |