docstr: Creating a dataset for a chunk (= subset) of dicts.
  :param chunk: Instead of only having a list of dicts here we also supply an index (ascending int) for each.
      => [(0, dict), (1, dict) ...]
  :type chunk: list of tuples
  :return: PyTorch Dataset
docstr_tok: ["Creating","a","dataset","for","a","chunk","(","=","subset",")","of","dicts",".",":","param","chunk",":","Instead","of","only","having","a","list","of","dicts","here","we","also","supply","an","index","(","ascending","int",")","for","each",".","=",">","[","(","0",",","dict",")",",","(","1",",","dict",")","...","]",":","type","chunk",":","list","of","tuples",":","return",":","PyTorch","Dataset"]
code: def _dataset_from_chunk(self, chunk):
      """
      Creating a dataset for a chunk (= subset) of dicts.
      :param chunk: Instead of only having a list of dicts here we also supply an index (ascending int) for each.
          => [(0, dict), (1, dict) ...]
      :type chunk: list of tuples
      :return: PyTorch Dataset
      """
      dicts = [d[1] for d in chunk]
      # need at least 2 documents to sample random sentences from
      if (
          len(dicts) < 2
          and type(self.processor) == BertStyleLMProcessor
      ):
          logger.info(
              "Skipping a dict chunk as it contains less than 2 documents ..."
          )
          return None, None
      indices = [x[0] for x in chunk]
      datasets, tensor_names, _ = self.processor.dataset_from_dicts(
          dicts=dicts, indices=indices
      )
      return datasets, tensor_names
  
imports: import copy
  import logging
  import torch.multiprocessing
  from contextlib import ExitStack
  from functools import partial
  import random
  from pathlib import Path
  from itertools import chain, groupby
  import numpy
  from sklearn.utils.class_weight import compute_class_weight
  from torch.utils.data import Dataset, Subset, IterableDataset
  from torch.utils.data.distributed import DistributedSampler
  from torch.utils.data.sampler import RandomSampler, SequentialSampler
  import torch
  from sklearn.model_selection import StratifiedKFold, KFold, ShuffleSplit, StratifiedShuffleSplit
  from tqdm import tqdm
  from farm.data_handler.dataloader import NamedDataLoader
  from farm.data_handler.processor import Processor, BertStyleLMProcessor
  from farm.data_handler.utils import grouper
  from farm.data_handler.dataset import ConcatTensorDataset
  from farm.modeling.tokenization import EmbeddingTokenizer
  from farm.utils import MLFlowLogger
  from farm.utils import log_ascii_workers, calc_chunksize
  from farm.utils import get_dict_checksum
  from farm.visual.ascii.images import TRACTOR_SMALL
label_desc: Use image node_id 4 for calling the _StreamingDataSet obj's underlying member method code with example usage: obj._dataset_from_chunk(chunk) and returns: datasets,  tensor_names, None,  None