การปรับรูปแบบการรับรู้ของ DeepMind (https://arxiv.org/abs/2103.03206) เป็น Pytorch รหัส JAX/HAIKU ดั้งเดิมสามารถดูได้ที่นี่: https://github.com/deepmind/deepmind-research/tree/master/perceiver
git clone https://github.com/JOBR0/PerceiverIO_Pytorch
cd PerceiverIO_Pytorchpython3 -m venv perceiverEnv
source perceiverEnv/bin/activateติดตั้ง pytorch ตามคำแนะนำอย่างเป็นทางการ: https://pytorch.org/get-started/locally/
ติดตั้งแพ็คเกจอื่น ๆ ที่จำเป็นจาก chendreet.txt:
pip3 install -r requirements.txtการใช้งานครอบคลุมงานตัวอย่างต่อไปนี้ซึ่งมีโมเดลที่มีการปรับแต่ง:
จุดตรวจไฮกุจากที่เก็บ DeepMind อย่างเป็นทางการได้รับการแปลงเป็นจุดตรวจ Pytorch และสามารถดาวน์โหลดได้จาก Google-Drive ควรวางจุดตรวจ Pytorch ในโฟลเดอร์ 'pytorch_checkpoints' เพื่อให้รหัสตัวอย่างสามารถค้นหาได้
ในการสร้าง preceeiverio ใหม่สำหรับงานที่กำหนดเองคลาส Perceiver ใน Perceiver_io/Perceiver.py ใช้
class PerceiverIO ( nn . Module ):
"""The Perceiver: a scalable, fully attentional architecture.
Args:
num_blocks (int): Number of times the block is applied with shared weights. Default: 8
num_self_attends_per_block (int): Number of self-attentions in the block. Default: 6,
num_latents: (int): Number of latent vectors. Default 512,
num_latent_channels (int): Number of channels for the latent vectors. Default: 1024,
final_project (bool): Whether to apply a linear layer to the outputs before the post-processors. Default: True,
final_project_out_channels (int): Number of output channels for the final projection layer. Default: None,
perceiver_encoder_kwargs (Dict): Additional arguments for the perceiver encoder class. Default: {},
perceiver_decoder_kwargs (Dict): Additional arguments for the perceiver decoder class. Default: {},
input_preprocessors (dict / nn.Module): Optional input preprocessors. 1 or none for each modality. Default: None,
output_postprocessors (dict / nn.Module): Optional output postprocessors. 1 or none for each modality. Default: None,
output_queries (dict / nn.Module): Modules that create the output queries. 1 for each modality. Default: None,
output_query_padding_channels (int): Number of learnable features channels that are added to the output queries. Default: 0,
input_padding_channels (int): Number of learnable features channels that are added to the preprocessed inputs. Default: 0,
input_channels (dict, int): = The number of input channels need to be specified if NO preprocessor is used. Otherwise,
the number will be inferred from the preprocessor. Default: None,
input_mask_probs (dict): Probability with which each input modality will be masked out. Default None,
"""ต่อไปนี้เป็นไดอะแกรมของ Perceiverio สำหรับแอปพลิเคชันหลายรูปแบบ:
ตัวประมวลผลล่วงหน้าอินพุตใช้ข้อมูลอินพุตดิบและประมวลผลล่วงหน้าเพื่อให้สามารถสอบถามได้โดยการแทรกแซงข้ามครั้งแรก นี่อาจเป็นเช่นการสร้างแพตช์จากภาพ โดยปกติแล้วการเข้ารหัสตำแหน่งจะถูกรวมเข้าด้วยกันโดยตัวประมวลผลล่วงหน้า แทนที่จะใช้ตัวประมวลผลล่วงหน้าอินพุตสามารถประมวลผลด้วยตนเองได้
input_preprocessors หลายตัวสามารถพบได้ใน perceiver_io/io_processors/preprocessors.py
เอาท์พุท postprocessors ใช้ผลลัพธ์สุดท้ายของการรับรู้และประมวลผลเพื่อให้ได้รูปแบบเอาต์พุตที่ต้องการ
Output_postprocessors หลายตัวสามารถพบได้ใน perceiver_io/io_processors/postprocessors.py
Queries ouput สร้างคุณสมบัติที่ใช้ในการสืบค้นการแสดงแฝงครั้งสุดท้ายของการรับรู้เพื่อสร้างผลลัพธ์ พวกเขาได้รับอินพุตที่ประมวลผลล่วงหน้าเป็นอาร์กิวเมนต์เพื่อให้พวกเขาสามารถใช้งานได้หากต้องการ พวกเขามักจะรวมการเข้ารหัสตำแหน่ง
output_queries หลายสามารถพบได้ใน perceiver_io/output_queries.py ### หลาย modalities เพื่อประมวลผลหลาย modalities ในครั้งเดียวพจนานุกรมที่มีการแมปจากโมเดลไปยังโมดูลสามารถใช้สำหรับตัวประมวลผลอินพุต _preprocessors, output_postprocessors เพื่อให้อินพุตที่แตกต่างกันเข้ากันได้ซึ่งกันและกันพวกเขาจะถูกเบาะเป็นขนาดช่องสัญญาณเดียวกันกับพารามิเตอร์ที่สามารถฝึกอบรมได้ นอกจากนี้ยังเป็นไปได้ที่จะใช้จำนวนการสืบค้นเอาต์พุตที่แตกต่างจากอินพุต
@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 }
}