docstr: For each example, this function determines the format of input and output sequences based on user-specified conguration.
  This is controlled by model.dataset.input_field and model.dataset.output_field
  For instance:
      If model.dataset.input_field == response and model.dataset.output_field == fluent_response:
          Input = "response: <response>" and output = "response: <response> fluent_response: <fluent_response>" (with loss calculated from <fluent_response> only)
      If model.dataset.input_field == utterance and model.dataset.output_field == response:
          Input = "utterance: <utterance>" and output = "utterance: <utterance> response: <response>" (with loss calculated from <response> only) 
      If model.dataset.input_field == passage+utterance and model.dataset.output_field == response:
          Input = "passage: <passage> utterance: <utterance>" and output="passage: <passage> utterance: <utterance> response: <response>" (with loss calculated from <response> only) 
docstr_tok: ["For","each","example",",","this","function","determines","the","format","of","input","and","output","sequences","based","on","user-specified","conguration",".","This","is","controlled","by","model.dataset.input_field","and","model.dataset.output_field","For","instance",":","If","model.dataset.input_field","==","response","and","model.dataset.output_field","==","fluent_response",":","Input","=","``","response",":","<","response",">","''","and","output","=","``","response",":","<","response",">","fluent_response",":","<","fluent_response",">","''","(","with","loss","calculated","from","<","fluent_response",">","only",")","If","model.dataset.input_field","==","utterance","and","model.dataset.output_field","==","response",":","Input","=","``","utterance",":","<","utterance",">","''","and","output","=","``","utterance",":","<","utterance",">","response",":","<","response",">","''","(","with","loss","calculated","from","<","response",">","only",")","If","model.dataset.input_field","==","passage+utterance","and","model.dataset.output_field","==","response",":","Input","=","``","passage",":","<","passage",">","utterance",":","<","utterance",">","''","and","output=","''","passage",":","<","passage",">","utterance",":","<","utterance",">","response",":","<","response",">","''","(","with","loss","calculated","from","<","response",">","only",")"]
code: def __getitem__(self, idx: int):
      """
      For each example, this function determines the format of input and output sequences based on user-specified conguration.
      This is controlled by model.dataset.input_field and model.dataset.output_field
      For instance:
          If model.dataset.input_field == response and model.dataset.output_field == fluent_response:
              Input = "response: <response>" and output = "response: <response> fluent_response: <fluent_response>" (with loss calculated from <fluent_response> only)
          If model.dataset.input_field == utterance and model.dataset.output_field == response:
              Input = "utterance: <utterance>" and output = "utterance: <utterance> response: <response>" (with loss calculated from <response> only)
          If model.dataset.input_field == passage+utterance and model.dataset.output_field == response:
              Input = "passage: <passage> utterance: <utterance>" and output="passage: <passage> utterance: <utterance> response: <response>" (with loss calculated from <response> only)
      """
      ex = self.features[idx].data
  
      input_sentence = self.format_prompt(ex)
  
      utterance_length = self.get_n_tokens_in_sentence(input_sentence)
  
      output_sentence = ex["labels"][self.output_label_type]
  
      base_template = input_sentence
  
      sentence_without_answer = (
          base_template + " " + self.output_label_type + ":"
      )
  
      sentence = sentence_without_answer + " " + output_sentence
  
      encodings_dict, input_ids, attn_masks = self.default_encode(
          sentence
      )
  
      labels = copy.copy(torch.squeeze(encodings_dict["input_ids"]))
  
      training_mask_end = self.get_n_tokens_in_sentence(
          sentence_without_answer
      )
  
      labels.data = torch.tensor(
          [
              -100 if i < training_mask_end else labels.data[i]
              for i in range(len(labels.data))
          ]
      )
  
      return (
          input_ids,
          attn_masks,
          labels,
          training_mask_end,
          utterance_length,
      )
  
file_path: NeMo/nemo/collections/nlp/data/dialogue/dataset/dialogue_gpt_generation_dataset.py
imports: import copy
  import torch
  from nemo.collections.nlp.data.dialogue.dataset.dialogue_dataset import DialogueDataset
label_desc: Use image node_id 7 for calling the DialogueGPTGenerationDataset obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: input_ids,  attn_masks,  labels,  training_mask_end,  utterance_length