تكييف نموذج DeepMind's Perceiverio (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/
تثبيت الحزم المطلوبة الأخرى من المتطلبات. txt:
pip3 install -r requirements.txtيغطي التنفيذ مهام المثال التالي الذي تتوفر من أجله النماذج المسبقة:
تم تحويل نقاط التفتيش Haiku من مستودع DeepMind الرسمي إلى نقاط تفتيش Pytorch ويمكن تنزيلها من Google-Drive. يجب وضع نقاط تفتيش Pytorch في مجلد "pytorch_checkpoints" بحيث يمكن أن يجدها رمز المثال.
لإنشاء preceiverio جديد لمهمة مخصصة ، يتم استخدام فئة 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 للتطبيق متعدد الوسائط:
تأخذ المعالجات المسبقة للمدخلات بيانات الإدخال الخام والمعالجة المسبقة لها بحيث يمكن الاستعلام عنها بواسطة أول عملية انتباه. يمكن أن يكون هذا مثل إنشاء تصحيحات من صورة. عادة ما يتم دمج الترميزات الموضعية من قبل المعالج المسبق. بدلاً من استخدام المعالج المسبق ، يمكن أيضًا معالجة المدخلات يدويًا.
يمكن العثور على العديد من الإدخال _preprocessors في perceiver_io/io_processors/preprocessors.py
يأخذ أجهزة الإخراج postprocessors الإخراج النهائي من المدرب ومعالجةه للحصول على تنسيق الإخراج المطلوب.
يمكن العثور على العديد من الإخراج _postprocessors في perceiver_io/io_processors/postprocessors.py
تقوم استعلامات OUPUT بإنشاء الميزات التي يتم استخدامها للاستعلام عن التمثيل الكامن النهائي للدراسة لإنتاج الإخراج. يحصلون على المدخلات المعالجة مسبقًا كوسيطة حتى يتمكنوا من استخدامها إذا رغبت في ذلك. كما أنها تتضمن عادة الترميزات الموضعية.
يمكن العثور على العديد من الإخراج _queries في perceiver_io/output_queries.py ### طرائق متعددة لمعالجة طرائق متعددة في آن واحد ، يمكن استخدام قاموس مع رسم خرائط من طريقة إلى الوحدة النمطية لـ input_preprocessors و output_postprocessors و output_queries (انظر consiver_io/multimodal_perceiver.per.py). لجعل المدخلات المختلفة متوافقة مع بعضها البعض ، فهي مبطنة لنفس حجم القناة مع المعلمات القابلة للتدريب. من الممكن أيضًا استخدام عدد مختلف من استعلامات الإخراج من المدخلات الواردة.
@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 }
}