← 开源
lucidrains

perceiver-pytorch

Implementation of Perceiver, General Perception with Iterative Attention, in Pytorch

Model DevelopmentArchitecturePython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
1.22k
Star
141
Fork
+0
本周
4
贡献者
创建于 2021-03-05 · 更新于 2026-10-12 · 今日第 11093 名
主要开发者

lucidrains/perceiver-pytorch 排名第 11,093,有 1,221 个星标。

同类别比较

lucidrains/perceiver-pytorch 排名第 11,093,此处有 8 个同类条目;getnamo/TensorFlow-Unreal 排名第 11,095。

同类别比较
名称排名指标
dee1024/pytorch-captcha-recognition11,084
语言:
Python
星标数:
1,223
分叉数:
326
简介:
基于CNN训练的一套 "端到端" 的验证码识别模型,使用深度学习+训练数据+大量计算力,纯数字识别率高达 99.99%,数字+字母识别率 96%
wagenaartje/neataptic11,086
语言:
JavaScript
星标数:
1,223
分叉数:
286
简介:
:rocket: Blazing fast neuro-evolution & backpropagation for the browser and Node.js
google-research/fixmatch11,087
语言:
Python
星标数:
1,222
分叉数:
191
简介:
A simple method to perform semi-supervised learning with limited data.
eduardoleao052/js-pytorch11,090
语言:
JavaScript
星标数:
1,221
分叉数:
55
简介:
A JavaScript library like PyTorch, with GPU acceleration.
getnamo/TensorFlow-Unreal11,095
语言:
C++
星标数:
1,220
分叉数:
207
简介:
TensorFlow plugin for the Unreal Engine.
xvjiarui/GCNet11,098
语言:
Python
星标数:
1,220
分叉数:
165
简介:
GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond
Jhy1993/HAN11,100
语言:
Python
星标数:
1,219
分叉数:
224
简介:
Heterogeneous Graph Neural Network
annoviko/pyclustering11,103
语言:
Python
星标数:
1,218
分叉数:
262
简介:
pyclustering is a Python, C++ data mining library.
关键参数与规格
关键参数与规格
参数值
语言Python
类别Model Development
子类别Architecture
星标数1,221
分叉数141
贡献者4
创建日期2021-03-05
更新日期2026-10-12
1 天星标数0
7 天星标数0
排名11,093
上次排名11,043
排名变化-50
7 天星标排名12,883
上次 7 天星标排名12,898
7 天星标排名变化15
总星标排名9,571
上次总星标排名9,561
总星标排名变化-10
国家USA
README 摘录

Perceiver - Pytorch Implementation of Perceiver , General Perception with Iterative Attention, in Pytorch Yannic Kilcher explanation! Install Usage For the backbone of Perceiver IO , the follow up paper that allows for flexible number of output sequence length, just import instead As an example, using PerceiverIO as a language model Experimental I have also included a version of Perceiver that includes bottom-up (in addition to top-down) attention, using the same scheme as presented in the original Set Transformers paper as

the Induced Set Attention Block . You simply have to change the above import to Citations

常见问题

记录了多少星标和分叉?

lucidrains/perceiver-pytorch 有 1,221 个星标和 141 个分叉。

仓库排名是多少?

lucidrains/perceiver-pytorch 排名第 11,093。

记录的语言和类别是什么?

lucidrains/perceiver-pytorch 有 1,221 个星标,语言为 Python,类别为 Model Development。

哪个仓库排名最接近?

lucidrains/perceiver-pytorch 与 getnamo/TensorFlow-Unreal 比较,后者排名第 11,095,有 1,220 个星标。

README

Perceiver - Pytorch

Implementation of Perceiver, General Perception with Iterative Attention, in Pytorch

Yannic Kilcher explanation!

Install

$ pip install perceiver-pytorch

Usage

import torch
from perceiver_pytorch import Perceiver

model = Perceiver(
    input_channels = 3,          # number of channels for each token of the input
    input_axis = 2,              # number of axis for input data (2 for images, 3 for video)
    num_freq_bands = 6,          # number of freq bands, with original value (2 * K + 1)
    max_freq = 10.,              # maximum frequency, hyperparameter depending on how fine the data is
    depth = 6,                   # depth of net. The shape of the final attention mechanism will be:
                                 #   depth * (cross attention -> self_per_cross_attn * self attention)
    num_latents = 256,           # number of latents, or induced set points, or centroids. different papers giving it different names
    latent_dim = 512,            # latent dimension
    cross_heads = 1,             # number of heads for cross attention. paper said 1
    latent_heads = 8,            # number of heads for latent self attention, 8
    cross_dim_head = 64,         # number of dimensions per cross attention head
    latent_dim_head = 64,        # number of dimensions per latent self attention head
    num_classes = 1000,          # output number of classes
    attn_dropout = 0.,
    ff_dropout = 0.,
    weight_tie_layers = False,   # whether to weight tie layers (optional, as indicated in the diagram)
    fourier_encode_data = True,  # whether to auto-fourier encode the data, using the input_axis given. defaults to True, but can be turned off if you are fourier encoding the data yourself
    self_per_cross_attn = 2      # number of self attention blocks per cross attention
)

img = torch.randn(1, 224, 224, 3) # 1 imagenet image, pixelized

model(img) # (1, 1000)

For the backbone of Perceiver IO, the follow up paper that allows for flexible number of output sequence length, just import PerceiverIO instead

import torch
from perceiver_pytorch import PerceiverIO

model = PerceiverIO(
    dim = 32,                    # dimension of sequence to be encoded
    queries_dim = 32,            # dimension of decoder queries
    logits_dim = 100,            # dimension of final logits
    depth = 6,                   # depth of net
    num_latents = 256,           # number of latents, or induced set points, or centroids. different papers giving it different names
    latent_dim = 512,            # latent dimension
    cross_heads = 1,             # number of heads for cross attention. paper said 1
    latent_heads = 8,            # number of heads for latent self attention, 8
    cross_dim_head = 64,         # number of dimensions per cross attention head
    latent_dim_head = 64,        # number of dimensions per latent self attention head
    weight_tie_layers = False,   # whether to weight tie layers (optional, as indicated in the diagram)
    seq_dropout_prob = 0.2       # fraction of the tokens from the input sequence to dropout (structured dropout, for saving compute and regularizing effects)
)

seq = torch.randn(1, 512, 32)
queries = torch.randn(128, 32)

logits = model(seq, queries = queries) # (1, 128, 100) - (batch, decoder seq, logits dim)

As an example, using PerceiverIO as a language model

import torch
from perceiver_pytorch import PerceiverLM

model = PerceiverLM(
    num_tokens = 20000,          # number of tokens
    dim = 32,                    # dimension of sequence to be encoded
    depth = 6,                   # depth of net
    max_seq_len = 2048,          # maximum sequence length
    num_latents = 256,           # number of latents, or induced set points, or centroids. different papers giving it different names
    latent_dim = 512,            # latent dimension
    cross_heads = 1,             # number of heads for cross attention. paper said 1
    latent_heads = 8,            # number of heads for latent self attention, 8
    cross_dim_head = 64,         # number of dimensions per cross attention head
    latent_dim_head = 64,        # number of dimensions per latent self attention head
    weight_tie_layers = False    # whether to weight tie layers (optional, as indicated in the diagram)
)

seq = torch.randint(0, 20000, (1, 512))
mask = torch.ones(1, 512).bool()

logits = model(seq, mask = mask) # (1, 512, 20000)

Experimental

I have also included a version of Perceiver that includes bottom-up (in addition to top-down) attention, using the same scheme as presented in the original Set Transformers paper as the Induced Set Attention Block.

You simply have to change the above import to

from perceiver_pytorch.experimental import Perceiver

Citations

@misc{jaegle2021perceiver,
    title   = {Perceiver: General Perception with Iterative Attention},
    author  = {Andrew Jaegle and Felix Gimeno and Andrew Brock and Andrew Zisserman and Oriol Vinyals and Joao Carreira},
    year    = {2021},
    eprint  = {2103.03206},
    archivePrefix = {arXiv},
    primaryClass = {cs.CV}
}
@misc{jaegle2021perceiver,
    title   = {Perceiver IO: A General Architecture for Structured Inputs & Outputs},
    author  = {Andrew Jaegle and Sebastian Borgeaud and Jean-Baptiste Alayrac and Carl Doersch and Catalin Ionescu and David Ding and Skanda Koppula and Andrew Brock and Evan Shelhamer and Olivier Hénaff and Matthew M. Botvinick and Andrew Zisserman and Oriol Vinyals and João Carreira},
    year    = {2021},
    eprint  = {2107.14795},
    archivePrefix = {arXiv},
    primaryClass = {cs.LG}
}
@inproceedings{wu2023invertedattention,
    title   = {Inverted-Attention Transformers can Learn Object Representations: Insights from Slot Attention},
    author  = {Yi-Fu Wu and Klaus Greff and Gamaleldin Fathy Elsayed and Michael Curtis Mozer and Thomas Kipf and Sjoerd van Steenkiste},
    booktitle = {UniReps:  the First Workshop on Unifying Representations in Neural Models},
    year    = {2023},
    url     = {https://openreview.net/forum?id=WgQZNoQ5AB}
}
@article{chen2026attention,
    title   = {Attention Residuals},
    author  = {Guangyu Chen and Yu Zhang and Jianlin Su and Weixin Xu and Siyuan Pan and Yaoyu Wang and Yucheng Wang and Guanduo Chen and Bohong Yin and Yutian Chen and Junjie Yan and Ming Wei and Y. Zhang and Fanqing Meng and Chao Hong and Xiaotong Xie and Shaowei Liu and Enzhe Lu and Yunpeng Tai and Yanru Chen and Xin Men and Haiqing Guo and Y. Charles and Haoyu Lu and Lin Sui and Jinguo Zhu and Zaida Zhou and Weiran He and Weixiao Huang and Xinran Xu and Yuzhi Wang and Guokun Lai and Yulun Du and Yuxin Wu and Zhilin Yang and Xinyu Zhou},
    journal = {arXiv preprint arXiv:2603.15031},
    year    = {2026}
}
@article{avsec2021effective,
    title   = {Effective gene expression prediction from sequence by integrating long-range interactions},
    author  = {{\v{Z}}iga Avsec and Vikram Agarwal and Daniel Visentin and Joseph R. Ledsam and Agnieszka Grabska-Barwi{\'n}ska and Kyle R. Taylor and Yannis Assael and John Jumper and Pushmeet Kohli and David R. Kelley},
    journal = {Nature Methods},
    volume  = {18},
    pages   = {1196--1203},
    year    = {2021}
}
排名相邻
同类项目