class_docstr: Base class for information retrieval models.
docstr: Function which ensures that vocabulary size is divisivble by 8
  for faster mixed precision training.
docstr_tok: ["Function","which","ensures","that","vocabulary","size","is","divisivble","by","8","for","faster","mixed","precision","training","."]
code: def get_lm_model_with_padded_embedding(cfg: DictConfig):
      """
      Function which ensures that vocabulary size is divisivble by 8
      for faster mixed precision training.
      """
      model = get_lm_model(
          config_file=cfg.language_model.config_file,
          config_dict=OmegaConf.to_container(cfg.language_model.config)
          if cfg.language_model.config
          else None,
          vocab_file=cfg.tokenizer.vocab_file,
          trainer=trainer,
          cfg=cfg,
      )
      vocab_size, hidden_size = (
          model.config.vocab_size,
          model.config.hidden_size,
      )
      tokens_to_add = 8 * math.ceil(vocab_size / 8) - vocab_size
      zeros = torch.zeros((tokens_to_add, hidden_size))
      model.embeddings.word_embeddings.weight.data = torch.cat(
          (model.embeddings.word_embeddings.weight.data, zeros)
      )
      return model
  
imports: import math
  from typing import Dict, Optional
  import numpy
  import torch
  from omegaconf import DictConfig, OmegaConf
  from pytorch_lightning import Trainer
  from nemo.collections.nlp.data import BertInformationRetrievalDataset
  from nemo.collections.nlp.models.nlp_model import NLPModel
  from nemo.collections.nlp.modules.common.lm_utils import get_lm_model
  from nemo.core.classes.common import typecheck
label_desc: Use image node_id 4 for calling the BaseIRModel obj's underlying member method code with example usage: obj.get_lm_model_with_padded_embedding(cfg) and returns: model