meerqat.models.vilt module#

Copied from transformers because not accessible otherwise.

class meerqat.models.vilt.ViltEmbeddings(config)[source]#

Bases: Module

Construct the text and patch embeddings.

Text embeddings are equivalent to BERT embeddings.

Patch embeddings are equivalent to ViT embeddings.

visual_embed(pixel_values, pixel_mask, max_image_length=200)[source]#
forward(input_ids, attention_mask, token_type_ids, pixel_values, pixel_mask, inputs_embeds, image_embeds, image_token_type_idx=1)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class meerqat.models.vilt.TextEmbeddings(config)[source]#

Bases: Module

Construct the embeddings from word, position and token_type embeddings.

forward(input_ids=None, token_type_ids=None, position_ids=None, inputs_embeds=None)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class meerqat.models.vilt.ViltPatchEmbeddings(config)[source]#

Bases: Module

Image to Patch Embedding.

forward(pixel_values)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class meerqat.models.vilt.ViltEncoder(config)[source]#

Bases: Module

forward(hidden_states, attention_mask=None, head_mask=None, output_attentions=False, output_hidden_states=False, return_dict=True)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

class meerqat.models.vilt.ViltPooler(config)[source]#

Bases: Module

forward(hidden_states)[source]#

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.