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.1.2.tar.gz
(266.6 kB
view details)
Built Distribution
File details
Details for the file peer_pytorch-0.1.2.tar.gz
.
File metadata
- Download URL: peer_pytorch-0.1.2.tar.gz
- Upload date:
- Size: 266.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 | 3f72d01a4eec33fd51cfaf77c2d499102dc6892816357d90c85cf88aa2a0ac45 |
|
MD5 | 51b1a163b9cb430b42ae6ca8bd2906ab |
|
BLAKE2b-256 | 46beb75f8d304ef4e6c4478345c362a36c8a14afa73d4e35cda93f1a87075d91 |
File details
Details for the file peer_pytorch-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: peer_pytorch-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.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 | 368845789325ced08c0f737561df502a29c7ce97904730ca27a39aed746950e6 |
|
MD5 | 0cccc981bd48270efef4faecafc2c187 |
|
BLAKE2b-256 | 38c705ed30d73c397534fe7423d7f775756ff75333ad0f9163dcf2aa2446e188 |