class_docstr: This Dataset loads training examples from tarred tokenized pickle files.
  If using multiple processes the number of shards should be divisible by the number of workers to ensure an
  even split among workers. If it is not divisible, logging will give a warning but training will proceed.
  Additionally, please note that the len() of this DataLayer is assumed to be the number of tokens
  of the text data. Shard strategy is scatter - each node gets a unique set of shards, which are permanently
  pre-allocated and never changed at runtime.
  Args:
      text_tar_filepaths: a string (can be brace-expandable).
      shuffle_n (int): How many samples to look ahead and load to be shuffled.
          See WebDataset documentation for more details.
          Defaults to 0.
      global_rank (int): Worker rank, used for partitioning shards. Defaults to 0.
      world_size (int): Total number of processes, used for partitioning shards. Defaults to 1.
      pad_token_id: id of pad token (used in collate_fn)
class_docstr_tok: ["This","Dataset","loads","training","examples","from","tarred","tokenized","pickle","files",".","If","using","multiple","processes","the","number","of","shards","should","be","divisible","by","the","number","of","workers","to","ensure","an","even","split","among","workers",".","If","it","is","not","divisible",",","logging","will","give","a","warning","but","training","will","proceed",".","Additionally",",","please","note","that","the","len","(",")","of","this","DataLayer","is","assumed","to","be","the","number","of","tokens","of","the","text","data",".","Shard","strategy","is","scatter","-","each","node","gets","a","unique","set","of","shards",",","which","are","permanently","pre-allocated","and","never","changed","at","runtime",".","Args",":","text_tar_filepaths",":","a","string","(","can","be","brace-expandable",")",".","shuffle_n","(","int",")",":","How","many","samples","to","look","ahead","and","load","to","be","shuffled",".","See","WebDataset","documentation","for","more","details",".","Defaults","to","0.","global_rank","(","int",")",":","Worker","rank",",","used","for","partitioning","shards",".","Defaults","to","0.","world_size","(","int",")",":","Total","number","of","processes",",","used","for","partitioning","shards",".","Defaults","to","1.","pad_token_id",":","id","of","pad","token","(","used","in","collate_fn",")"]
code: def _build_sample(self, fname):
      # Load file
      pkl_file, _ = fname
      pkl_file = BytesIO(pkl_file)
      data = pickle.load(pkl_file)
      pkl_file.close()
      input_ids = data["input_ids"]
      input_mask = data["input_mask"]
      segment_ids = data["segment_ids"]
      input_ids_for_subwords = data["input_ids_for_subwords"]
      input_mask_for_subwords = data["input_mask_for_subwords"]
      segment_ids_for_subwords = data["segment_ids_for_subwords"]
      character_pos_to_subword_pos = data[
          "character_pos_to_subword_pos"
      ]
      labels_mask = data["labels_mask"]
      labels = data["labels"]
      spans = data["spans"]
  
      return (
          input_ids,
          input_mask,
          segment_ids,
          input_ids_for_subwords,
          input_mask_for_subwords,
          segment_ids_for_subwords,
          character_pos_to_subword_pos,
          labels_mask,
          labels,
          spans,
      )
  
imports: import pickle
  from io import BytesIO
  from typing import Dict, List, Optional, Tuple
  import braceexpand
  import numpy
  import torch
  import webdataset
  from nemo.collections.nlp.data.spellchecking_asr_customization.bert_example import BertExampleBuilder
  from nemo.core.classes.dataset import Dataset, IterableDataset
  from nemo.core.neural_types import ChannelType, IntType, LabelsType, MaskType, NeuralType
  from nemo.utils import logging
label_desc: Use image node_id 2 for calling the TarredSpellcheckingAsrCustomizationDataset obj's underlying member method code with example usage: obj._build_sample(fname) and returns: input_ids,  input_mask,  segment_ids,  input_ids_for_subwords,  input_mask_for_subwords,  segment_ids_for_subwords,  character_pos_to_subword_pos,  labels_mask,  labels,  spans