def __init__(self, config): super().__init__(config) trainable_position_encoding_kwargs_decoder = dict( num_channels=config.d_latents, index_dims=1) self.num_labels = config.num_labels self.perceiver = PerceiverModel( config, input_preprocessor=PerceiverTextPreprocessor(config), decoder=PerceiverTokenClassificationDecoder( config, num_channels=config.d_latents, trainable_position_encoding_kwargs= trainable_position_encoding_kwargs_decoder, ), ) # Initialize weights and apply final processing self.post_init()
def test_model_from_pretrained(self): for model_name in PERCEIVER_PRETRAINED_MODEL_ARCHIVE_LIST[:1]: model = PerceiverModel.from_pretrained(model_name) self.assertIsNotNone(model)