code: def __init__(self, config):
      super().__init__(config)
  
      print("Init VIT ... ", end="")
      # self.visual_encoder = create_eva_vit_g()
      self.visual_encoder = create_eva_vit_g(precision="fp32")
      self.ln_vision = LayerNorm(self.visual_encoder.num_features)
      print("Done")
  
      print("Init Perceive Sampler ... ", end="")
      with all_logging_disabled():
          self.Qformer, self.query_tokens = self.init_qformer(
              config.num_query_token, self.visual_encoder.num_features
          )
          self.Qformer.bert.embeddings.word_embeddings = None
          self.Qformer.bert.embeddings.position_embeddings = None
          for layer in self.Qformer.bert.encoder.layer:
              layer.output = None
              layer.intermediate = None
          self.Qformer.cls = None
      print("Done")
  
      print("Init InternLM ... ", end="")
      self.flag_image_start = nn.Parameter(torch.zeros([1, 1, 4096]))
      self.flag_image_end = nn.Parameter(torch.zeros([1, 1, 4096]))
      self.flag_image_start.requires_grad = False
      self.flag_image_end.requires_grad = False
  
      internlm_lora = config.internlm_lora
      self.internlm_lora = internlm_lora
      setattr(InternLMForCausalLM, "lora_cfg", internlm_lora)
  
      if int(torch.__version__[0]) == 1:
          # self.internlm_model = InternLMForCausalLM._from_config(config).to(
          #     torch.float16)
          self.internlm_model = InternLMForCausalLM._from_config(
              config
          ).to(torch.float32)
      else:
          assert int(torch.__version__[0]) == 2
          # speed up init llm
          with torch.device("meta"):
              self.internlm_model = InternLMForCausalLM._from_config(
                  config
              )
          # self.internlm_model.to_empty(device=config.device).to(torch.float16)
          self.internlm_model.to_empty(device=config.device).to(
              torch.float32
          )
      for n, m in self.internlm_model.named_modules():
          if "lora" in n:
              m.float()
  
      self.internlm_proj = nn.Linear(
          self.Qformer.config.hidden_size,
          self.internlm_model.config.hidden_size,
      )
      print("Done")
  
      self.vis_processor = transforms.Compose(
          [
              transforms.Resize(
                  (224, 224), interpolation=InterpolationMode.BICUBIC
              ),
              transforms.ToTensor(),
              transforms.Normalize(
                  (0.48145466, 0.4578275, 0.40821073),
                  (0.26862954, 0.26130258, 0.27577711),
              ),
          ]
      )
  
      self.tokenizer = None
  
imports: import copy
  import os
  import sys
  import contextlib
  import torch.utils.checkpoint
  from torch.nn import LayerNorm
  from torchvision import transforms
  from torchvision.transforms.functional import InterpolationMode
  from PIL import Image
  from .modeling_perceive_sampler import BertConfig, BertLMHeadModel
  from .modeling_vit import *
  from .modeling_InternLM import *
  from .modeling_utils import *
  from transformers.utils import logging
label_desc: Use image node_id 1 to create a new InternLMXComposerForCausalLM object from inherited base classes: PreTrainedModel with example: obj = InternLMXComposerForCausalLM(config)