docstr: Pad input_ids in batch to max batch length while building loss mask 
docstr_tok: ["Pad","input_ids","in","batch","to","max","batch","length","while","building","loss","mask"]
code: def _build_loss_mask(self, processed_example):
      """Pad input_ids in batch to max batch length while building loss mask"""
      input_ids = processed_example["input_ids"]
      answer_start_idx = processed_example["answer_start_idx"]
      if self.answer_only_loss:
          loss_mask = [
              float(idx >= answer_start_idx)
              for idx in range(len(input_ids))
          ]
      else:
          loss_mask = [1.0] * len(input_ids)
  
      return loss_mask
  
imports: import re
  from typing import List, Mapping, Optional
  import datasets
  import numpy
  import torch
  from datasets import load_dataset
  from nemo.collections.common.tokenizers.tokenizer_spec import TokenizerSpec
  from nemo.collections.nlp.data.language_modeling.megatron.dataset_utils import get_samples_mapping
  from nemo.collections.nlp.data.language_modeling.text_memmap_dataset import JSONLMemMapDataset
  from nemo.core.classes import Dataset
  from nemo.utils import logging
label_desc: Use image node_id 12 for calling the GPTSFTDataset obj's underlying member method code with example usage: obj._build_loss_mask(processed_example) and returns: loss_mask