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}
}
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.0.11.tar.gz
(265.6 kB
view details)
Built Distribution
File details
Details for the file peer_pytorch-0.0.11.tar.gz
.
File metadata
- Download URL: peer_pytorch-0.0.11.tar.gz
- Upload date:
- Size: 265.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | baa01a2735a2944ee9383f02693b0450e23a653d8879c947ffbfd1d5909fa131 |
|
MD5 | 69b64c076e8ba2bdc0f0d9e4e1b14277 |
|
BLAKE2b-256 | b3f42da2f225d999f147dd7d2b650848fd1ed525f980683818520987617be5e1 |
File details
Details for the file peer_pytorch-0.0.11-py3-none-any.whl
.
File metadata
- Download URL: peer_pytorch-0.0.11-py3-none-any.whl
- Upload date:
- Size: 6.0 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 | fb185a4fce069789e7f7a3f208349e43a1a1f36278a7cbaf86866ecb7ba4ff41 |
|
MD5 | 26978dd048075fe4a59d9eecda7fb2bd |
|
BLAKE2b-256 | 3472fcb68507fcdf1e3f6686eee637f768a0246b54b4e0882909af8b1e9eaa7a |