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.8.tar.gz
(265.0 kB
view details)
Built Distribution
File details
Details for the file peer_pytorch-0.0.8.tar.gz
.
File metadata
- Download URL: peer_pytorch-0.0.8.tar.gz
- Upload date:
- Size: 265.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5630c363645fbb85e08e79ba3e90a112e682c70fb1ac0eb3dc264c73e184bc71 |
|
MD5 | af2b521f18b8d0a14526c8ef1cd4c4be |
|
BLAKE2b-256 | 2c2724b7916bfab8d592555be13067b762798fefaa9c3cb7fd2d296a24fe0dd4 |
File details
Details for the file peer_pytorch-0.0.8-py3-none-any.whl
.
File metadata
- Download URL: peer_pytorch-0.0.8-py3-none-any.whl
- Upload date:
- Size: 4.8 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 | c35374599d707f2d1a28f875c2651c4511420cd95ca36c0dd8d33f0a638f07a0 |
|
MD5 | d4e0991b907375661137fd07c6888086 |
|
BLAKE2b-256 | 0b7105b715e7974f926f1a9f7d835c22490ff0a9bcee0950656d7479d33cef75 |