class_docstr: Patch embedding used for ViLT.
  https://arxiv.org/pdf/2102.03334.pdf
  Implementation based off
  https://github.com/dandelin/ViLT/blob/master/vilt/modules/vilt_module.py
  Using huggingface ViT modules.
  Can be built with random init or the embeddings weights from an exisiting
  ViT model from huggingface. Model list: availible at
  https://huggingface.co/models?other=vit&sort=downloads
class_docstr_tok: ["Patch","embedding","used","for","ViLT",".","https",":","\/\/arxiv.org\/pdf\/2102.03334.pdf","Implementation","based","off","https",":","\/\/github.com\/dandelin\/ViLT\/blob\/master\/vilt\/modules\/vilt_module.py","Using","huggingface","ViT","modules",".","Can","be","built","with","random","init","or","the","embeddings","weights","from","an","exisiting","ViT","model","from","huggingface",".","Model","list",":","availible","at","https",":","\/\/huggingface.co\/models","?","other=vit","&","sort=downloads"]
code: def __init__(
      self,
      random_init: bool = True,
      pretrained_model_name: str = "google/vit-base-patch16-224",
      image_size: Optional[List] = None,
      hidden_dropout_prob: Optional[float] = None,
      hidden_size: Optional[int] = None,
      patch_size: Optional[int] = None,
      num_channels: Optional[int] = None,
      *args,
      **kwargs,
  ):
      super().__init__()
      config = OmegaConf.create(
          {
              "random_init": random_init,
              "pretrained_model_name": pretrained_model_name,
          }
      )
      if image_size is not None:
          config.image_size = image_size
      if hidden_dropout_prob is not None:
          config.hidden_dropout_prob = hidden_dropout_prob
      if hidden_size is not None:
          config.hidden_size = hidden_size
      if patch_size is not None:
          config.patch_size = patch_size
      if num_channels is not None:
          config.num_channels = num_channels
  
      encoder = ViTEncoder(config)
      self.embedding = encoder.embeddings
      hidden_size = encoder.hf_config.hidden_size
      self.token_type_embeddings = nn.Embedding(2, hidden_size)
  
imports: import collections.abc
  import logging
  from dataclasses import dataclass
  from typing import Any, Dict, List, Optional, Tuple
  import torch
  from mmf.common.registry import registry
  from mmf.models.base_model import BaseModel
  from mmf.models.transformers.heads.utils import build_heads_dict
  from mmf.modules.encoders import TransformerEncoder, ViTEncoder
  from mmf.modules.losses import MMFLoss
  from mmf.utils.build import build_encoder
  from mmf.utils.modeling import get_bert_configured_parameters
  from omegaconf import MISSING, OmegaConf
  from torch import nn, Tensor
label_desc: Use image node_id 1 to create a new ViLTImageEmbedding object from inherited base classes: nn with example: obj = ViLTImageEmbedding(random_init, pretrained_model_name, image_size, hidden_dropout_prob, hidden_size, patch_size, num_channels)