code: def get_query_embedding(query, model):
      """Use entity linking encoder to get embedding for index query"""
      model_input = model.tokenizer(
          query,
          add_special_tokens=True,
          padding=True,
          truncation=True,
          max_length=512,
          return_token_type_ids=True,
          return_attention_mask=True,
      )
  
      query_emb = model.forward(
          input_ids=torch.LongTensor([model_input["input_ids"]]).to(
              device
          ),
          token_type_ids=torch.LongTensor(
              [model_input["token_type_ids"]]
          ).to(device),
          attention_mask=torch.LongTensor(
              [model_input["attention_mask"]]
          ).to(device),
      )
  
      return query_emb
  
file_path: NeMo/examples/nlp/entity_linking/query_index.py
imports: import os
  import pickle
  from argparse import ArgumentParser
  from collections import OrderedDict
  from typing import Dict
  import numpy
  import torch
  from build_index import load_model
  from omegaconf import DictConfig, OmegaConf
  from nemo.utils import logging
label_desc: Use image node_id 1 for calling a global function with example usage: get_query_embedding(query, model) and returns: query_emb