code: def __init__(self, num_labels, tokenizer, args):
      super(IFAREModel, self).__init__()
  
      self.args = args
      self.vision_config = CLIPConfig.from_pretrained(
          self.args.vit_name
      ).vision_config
      self.text_config = BertConfig.from_pretrained(self.args.bert_name)
  
      clip_model_dict = CLIPModel.from_pretrained(
          self.args.vit_name
      ).vision_model.state_dict()
      bert_model_dict = BertModel.from_pretrained(
          self.args.bert_name
      ).state_dict()
  
      print(self.vision_config)
      print(self.text_config)
  
      # for re
      self.vision_config.device = args.device
      self.model = IFAModel(self.vision_config, self.text_config)
  
      # load:
      vision_names, text_names = [], []
      model_dict = self.model.state_dict()
      for name in model_dict:
          if "vision" in name:
              clip_name = name.replace("vision_", "").replace(
                  "model.", ""
              )
              if clip_name in clip_model_dict:
                  vision_names.append(clip_name)
                  model_dict[name] = clip_model_dict[clip_name]
          elif "text" in name:
              text_name = name.replace("text_", "").replace(
                  "model.", ""
              )
              if text_name in bert_model_dict:
                  text_names.append(text_name)
                  model_dict[name] = bert_model_dict[text_name]
      assert len(vision_names) == len(clip_model_dict) and len(
          text_names
      ) == len(bert_model_dict), (
          len(vision_names),
          len(text_names),
          len(clip_model_dict),
          len(bert_model_dict),
      )
      self.model.load_state_dict(model_dict)
  
      self.model.resize_token_embeddings(len(tokenizer))
  
      self.dropout = nn.Dropout(0.5)
      self.classifier = nn.Linear(
          self.text_config.hidden_size * 2, num_labels
      )
      self.head_start = tokenizer.convert_tokens_to_ids("<s>")
      self.tail_start = tokenizer.convert_tokens_to_ids("<o>")
      self.tokenizer = tokenizer
  
file_path: DeepKE/src/deepke/relation_extraction/multimodal/models/IFA_model.py
imports: import torch
  from torch import nn
  import torch.nn.functional
  from .modeling_IFA import IFAModel
  from transformers import BertConfig, BertModel, CLIPConfig, CLIPModel
label_desc: Use image node_id 1 to create a new IFAREModel object from inherited base classes: nn with example: obj = IFAREModel(num_labels, tokenizer, args)