docstr: Reshape the Embedding layer to make the embedding dimension divisible by world_size
docstr_tok: ["Reshape","the","Embedding","layer","to","make","the","embedding","dimension","divisible","by","world_size"]
code: def preprocess(self):
      # reshape the embedding layer
      r"""
      Reshape the Embedding layer to make the embedding dimension divisible by world_size
      """
      # TODO:
      vocab_size = self.model.config.qformer_config.vocab_size
      world_size = self.shard_config.tensor_parallel_size
      if vocab_size % world_size != 0:
          new_vocab_size = (
              vocab_size + world_size - vocab_size % world_size
          )
          self.model.resize_token_embeddings(new_vocab_size)
      return self.model
  
file_path: ColossalAI/colossalai/shardformer/policies/blip2.py
imports: import colossalai.shardformer.layer
  from ..modeling.blip2 import forward_fn, get_blip2_flash_attention_forward, get_jit_fused_blip2_QFormer_output_forward, get_jit_fused_blip2_QFormer_self_output_forward
  from ..modeling.jit import get_jit_fused_dropout_add_func
  from .base_policy import ModulePolicyDescription, Policy, SubModuleReplacementDescription
label_desc: Use image node_id 2 for calling the BlipPolicy obj's underlying member method code with example usage: obj.preprocess() and returns: self