code: def initialize_vision_tokenizer(self, model_args, tokenizer):
      if model_args.mm_use_im_patch_token:
          tokenizer.add_tokens(
              [DEFAULT_IMAGE_PATCH_TOKEN], special_tokens=True
          )
          self.resize_token_embeddings(len(tokenizer))
  
      if model_args.mm_use_im_start_end:
          num_new_tokens = tokenizer.add_tokens(
              [DEFAULT_IM_START_TOKEN, DEFAULT_IM_END_TOKEN],
              special_tokens=True,
          )
          self.resize_token_embeddings(len(tokenizer))
  
          if num_new_tokens > 0:
              input_embeddings = self.get_input_embeddings().weight.data
              output_embeddings = (
                  self.get_output_embeddings().weight.data
              )
  
              input_embeddings_avg = input_embeddings[
                  :-num_new_tokens
              ].mean(dim=0, keepdim=True)
              output_embeddings_avg = output_embeddings[
                  :-num_new_tokens
              ].mean(dim=0, keepdim=True)
  
              input_embeddings[-num_new_tokens:] = input_embeddings_avg
              output_embeddings[
                  -num_new_tokens:
              ] = output_embeddings_avg
  
          if model_args.tune_mm_mlp_adapter:
              for p in self.get_input_embeddings().parameters():
                  p.requires_grad = True
              for p in self.get_output_embeddings().parameters():
                  p.requires_grad = False
  
          if model_args.pretrain_mm_mlp_adapter:
              mm_projector_weights = torch.load(
                  model_args.pretrain_mm_mlp_adapter, map_location="cpu"
              )
              embed_tokens_weight = mm_projector_weights[
                  "model.embed_tokens.weight"
              ]
              assert num_new_tokens == 2
              if input_embeddings.shape == embed_tokens_weight.shape:
                  input_embeddings[
                      -num_new_tokens:
                  ] = embed_tokens_weight[-num_new_tokens:]
              elif embed_tokens_weight.shape[0] == num_new_tokens:
                  input_embeddings[
                      -num_new_tokens:
                  ] = embed_tokens_weight
              else:
                  raise ValueError(
                      f"Unexpected embed_tokens_weight shape. Pretrained: {embed_tokens_weight.shape}. Current: {input_embeddings.shape}. Numer of new tokens: {num_new_tokens}."
                  )
      elif model_args.mm_use_im_patch_token:
          if model_args.tune_mm_mlp_adapter:
              for p in self.get_input_embeddings().parameters():
                  p.requires_grad = False
              for p in self.get_output_embeddings().parameters():
                  p.requires_grad = False
  
imports: from abc import ABC, abstractmethod
  import os
  import json
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from transformers import BertTokenizer
  from transformers.models.bert.modeling_bert import BertLMHeadModel
  from .qformer import BertConfig
  from .qformer import BertLMHeadModel
  from .multimodal_encoder.builder import build_vision_tower
  from .multimodal_projector.builder import build_vision_projector
  from llamavid.constants import IGNORE_INDEX, IMAGE_TOKEN_INDEX, DEFAULT_IMAGE_PATCH_TOKEN, DEFAULT_IM_START_TOKEN, DEFAULT_IM_END_TOKEN
label_desc: Use image node_id 8 for calling the LLaMAVIDMetaForCausalLM obj's underlying member method code with example usage: obj.initialize_vision_tokenizer(model_args, tokenizer) without return types