class_docstr: Support the CLIP model.
  Refer to https://huggingface.co/docs/transformers/model_doc/clip
class_docstr_tok: ["Support","the","CLIP","model",".","Refer","to","https",":","\/\/huggingface.co\/docs\/transformers\/model_doc\/clip"]
docstr: Load the pretrained CLIP from huggingface transformers.
  
  Parameters
  ----------
  prefix
      The model prefix.
  checkpoint_name
      Name of the checkpoint.
  num_classes
      The number of classes. 1 for a regression task.
  pretrained
      Whether using the pretrained weights. If pretrained=True, download the pretrained model.
  tokenizer_name
      Name of the huggingface tokenizer type.
docstr_tok: ["Load","the","pretrained","CLIP","from","huggingface","transformers",".","Parameters","--","--","--","--","--","prefix","The","model","prefix",".","checkpoint_name","Name","of","the","checkpoint",".","num_classes","The","number","of","classes",".","1","for","a","regression","task",".","pretrained","Whether","using","the","pretrained","weights",".","If","pretrained=True",",","download","the","pretrained","model",".","tokenizer_name","Name","of","the","huggingface","tokenizer","type","."]
code: def __init__(
      self,
      prefix: str,
      checkpoint_name: str,
      num_classes: Optional[int] = None,
      pretrained: Optional[bool] = True,
      tokenizer_name: Optional[str] = "clip",
  ):
      """
      Load the pretrained CLIP from huggingface transformers.
  
      Parameters
      ----------
      prefix
          The model prefix.
      checkpoint_name
          Name of the checkpoint.
      num_classes
          The number of classes. 1 for a regression task.
      pretrained
          Whether using the pretrained weights. If pretrained=True, download the pretrained model.
      tokenizer_name
          Name of the huggingface tokenizer type.
      """
      super().__init__()
      logger.debug(f"initializing {checkpoint_name}")
      self.checkpoint_name = checkpoint_name
      self.num_classes = num_classes
  
      self.config, self.model = get_hf_config_and_model(
          checkpoint_name=checkpoint_name, pretrained=pretrained
      )
      self.tokenizer_name = tokenizer_name
      self.tokenizer = get_pretrained_tokenizer(
          tokenizer_name=self.tokenizer_name,
          checkpoint_name=self.checkpoint_name,
      )
  
      self.out_features = self.model.config.projection_dim
  
      self.head = (
          nn.Linear(self.out_features, num_classes)
          if num_classes
          else nn.Identity()
      )
      self.head.apply(init_weights)
  
      self.prefix = prefix
  
      self.name_to_id = self.get_layer_ids()
      self.head_layer_names = [
          n for n, layer_id in self.name_to_id.items() if layer_id == 0
      ]
  
file_path: autogluon/multimodal/src/autogluon/multimodal/models/clip.py
imports: import logging
  from typing import Optional
  import torch
  from torch import nn
  from ..constants import AUTOMM, COLUMN, COLUMN_FEATURES, FEATURES, IMAGE, IMAGE_VALID_NUM, LABEL, LOGIT_SCALE, LOGITS, MASKS, TEXT_TOKEN_IDS, TEXT_VALID_LENGTH
  from .utils import assign_layer_ids, get_column_features, get_hf_config_and_model, get_pretrained_tokenizer, init_weights
label_desc: Use image node_id 1 to create a new CLIPForImageText object from inherited base classes: nn with example: obj = CLIPForImageText(prefix, checkpoint_name, num_classes, pretrained, tokenizer_name)