class_docstr: TextClassificationModel to be trained on two- or three-class textual entailment data, to be used for zero shot intent recognition.
class_docstr_tok: ["TextClassificationModel","to","be","trained","on","two-","or","three-class","textual","entailment","data",",","to","be","used","for","zero","shot","intent","recognition","."]
docstr: Setup method for inference data loader. Here the premise-hypothesis pairs are made from queries and candidate labels.
  
  Args:
      queries: the queries to classify
      candidate_labels: strings to be used as labels
      hypothesis_template: the template used to turn each label into an NLI-style hypothesis. Must include a {}
          or similar syntax for the candidate label to be inserted.
      batch_size: batch size to use during inference
      max_seq_length: maximum length of queries, default is -1 for no limit
  Returns:
      A pytorch DataLoader.
docstr_tok: ["Setup","method","for","inference","data","loader",".","Here","the","premise-hypothesis","pairs","are","made","from","queries","and","candidate","labels",".","Args",":","queries",":","the","queries","to","classify","candidate_labels",":","strings","to","be","used","as","labels","hypothesis_template",":","the","template","used","to","turn","each","label","into","an","NLI-style","hypothesis",".","Must","include","a","{","}","or","similar","syntax","for","the","candidate","label","to","be","inserted",".","batch_size",":","batch","size","to","use","during","inference","max_seq_length",":","maximum","length","of","queries",",","default","is","-1","for","no","limit","Returns",":","A","pytorch","DataLoader","."]
code: def _setup_infer_dataloader(
      self,
      queries: List[str],
      candidate_labels: List[str],
      hypothesis_template=str,
      batch_size=1,
      max_seq_length: int = -1,
  ) -> "torch.utils.data.DataLoader":
      """
      Setup method for inference data loader. Here the premise-hypothesis pairs are made from queries and candidate labels.
  
      Args:
          queries: the queries to classify
          candidate_labels: strings to be used as labels
          hypothesis_template: the template used to turn each label into an NLI-style hypothesis. Must include a {}
              or similar syntax for the candidate label to be inserted.
          batch_size: batch size to use during inference
          max_seq_length: maximum length of queries, default is -1 for no limit
      Returns:
          A pytorch DataLoader.
      """
      dataset = ZeroShotIntentInferenceDataset(
          queries=queries,
          candidate_labels=candidate_labels,
          tokenizer=self.tokenizer,
          max_seq_length=max_seq_length,
          hypothesis_template=hypothesis_template,
      )
  
      return torch.utils.data.DataLoader(
          dataset=dataset,
          batch_size=batch_size,
          shuffle=False,
          num_workers=2,
          pin_memory=False,
          drop_last=False,
          collate_fn=dataset.collate_fn,
      )
  
imports: import os
  from typing import Dict, List, Optional, Union
  import numpy
  import torch
  from omegaconf import DictConfig
  from pytorch_lightning import Trainer
  from nemo.collections.nlp.data.zero_shot_intent_recognition.zero_shot_intent_dataset import ZeroShotIntentDataset, ZeroShotIntentInferenceDataset, calc_class_weights_from_dataloader
  from nemo.collections.nlp.models import TextClassificationModel
  from nemo.core.classes.common import PretrainedModelInfo
  from nemo.utils import logging
label_desc: Use image node_id 6 for calling the ZeroShotIntentModel obj's underlying member method code with example usage: obj._setup_infer_dataloader(queries, candidate_labels, hypothesis_template, batch_size, max_seq_length) and returns: torch