class_docstr: Creates a Dataset for GPT architecture based Generative QA 
class_docstr_tok: ["Creates","a","Dataset","for","GPT","architecture","based","Generative","QA"]
docstr: Loss mask for GPT is constructed to ignore loss for padding tokens
  GPT eos token is same as pas token and needs to be excluded from loss mask
  This is done using the attention mask inversion as described in:
      https://github.com/huggingface/transformers/issues/7135#issuecomment-1172962080
docstr_tok: ["Loss","mask","for","GPT","is","constructed","to","ignore","loss","for","padding","tokens","GPT","eos","token","is","same","as","pas","token","and","needs","to","be","excluded","from","loss","mask","This","is","done","using","the","attention","mask","inversion","as","described","in",":","https",":","\/\/github.com\/huggingface\/transformers\/issues\/7135","#","issuecomment-1172962080"]
code: def update_labels_for_no_pad_loss(
      cls, input_ids, training_mask_end, input_attn_mask
  ):
      """
      Loss mask for GPT is constructed to ignore loss for padding tokens
      GPT eos token is same as pas token and needs to be excluded from loss mask
      This is done using the attention mask inversion as described in:
          https://github.com/huggingface/transformers/issues/7135#issuecomment-1172962080
      """
      labels = copy.copy(torch.squeeze(input_ids))
      inv_bool_attn_mask = torch.eq(torch.squeeze(input_attn_mask), 0)
      labels.data = torch.tensor(
          [
              -100
              if ((i < training_mask_end) or (inv_bool_attn_mask[i]))
              else labels.data[i]
              for i in range(len(labels.data))
          ]
      )
  
      return labels
  
imports: import copy
  import os
  import numpy
  import torch
  from tqdm import trange
  from nemo.collections.nlp.data.question_answering.data_processor.qa_processing import INFERENCE_MODE, TRAINING_MODE
  from nemo.collections.nlp.data.question_answering.dataset.qa_dataset import QADataset
  from nemo.collections.nlp.data.question_answering.input_example.qa_gpt_input_example import GPTQAInputExample
  from nemo.utils import logging
label_desc: Use image node_id 9 for calling the GPTQADataset obj's underlying member method code with example usage: obj.update_labels_for_no_pad_loss(cls, input_ids, training_mask_end, input_attn_mask) and returns: labels