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.7.tar.gz
(266.9 kB
view details)
Built Distribution
File details
Details for the file peer_pytorch-0.1.7.tar.gz
.
File metadata
- Download URL: peer_pytorch-0.1.7.tar.gz
- Upload date:
- Size: 266.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.19
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cf211076d90a187a1e367f3cab7387bf72cc1d26fac5625c33f3322e8855d69 |
|
MD5 | c42505c6decc1d7ec9f91191a2aa3fa1 |
|
BLAKE2b-256 | 84635b14c1a3f9aff27eb4c3cc7266bd2d1eb135eec798a73a3324ae4f0089f3 |
File details
Details for the file peer_pytorch-0.1.7-py3-none-any.whl
.
File metadata
- Download URL: peer_pytorch-0.1.7-py3-none-any.whl
- Upload date:
- Size: 8.5 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 | 4b5079238cc12f54c89b4c63cee234de0b5ea3f65e605c42580b54d082fd3b78 |
|
MD5 | f453451c82d8c9b7d2697a0ff13244e0 |
|
BLAKE2b-256 | aa797d1a4f1ead3636ca14dff3053f7c75dcfba9befb8740878dfb145658b5ef |