code: def encode_queries(
      self, queries, batch_size: int = 256
  ) -> np.ndarray:
      embeddings = []
      with torch.no_grad():
          for start in trange(0, len(queries), batch_size):
              model_inputs = self.tokenizer.batch_encode_plus(
                  queries[start : start + batch_size],
                  return_tensors="pt",
                  max_length=self.max_query_length,
                  padding="max_length",
              )
              model_inputs = {
                  k: v.to(self.device) for k, v in model_inputs.items()
              }
              sequence_output = self.q_encoder(**model_inputs)[0]
              emb = sequence_output[:, 0, :].contiguous().cpu().numpy()
              embeddings.append(emb)
  
      return np.vstack(embeddings)
  
file_path: DeepPavlov/deeppavlov/models/doc_retrieval/bpr.py
imports: from typing import Tuple
  import faiss
  import numpy
  import torch
  from tqdm import trange
  from transformers import AutoTokenizer, BertModel
  from deeppavlov.core.common.registry import register
  from deeppavlov.core.models.component import Component
  from deeppavlov.core.models.serializable import Serializable
label_desc: Use image node_id 4 for calling the BPR obj's underlying member method code with example usage: obj.encode_queries(queries, batch_size) and returns: np