code: def __init__(
      self,
      doc,
      batch_size,
      args,
      vocab=None,
      evaluation=False,
      conll_only=False,
      skip=None,
  ):
      self.batch_size = batch_size
      self.args = args
      self.eval = evaluation
      self.shuffled = not self.eval
      self.doc = doc
  
      data = self.load_doc(self.doc)
  
      if conll_only:  # only load conll file
          return
  
      if skip is not None:
          assert len(data) == len(skip)
          data = [x for x, y in zip(data, skip) if not y]
  
      # handle vocab
      if vocab is not None:
          self.vocab = vocab
      else:
          self.vocab = dict()
          char_vocab, pos_vocab = self.init_vocab(data)
          self.vocab = MultiVocab(
              {"char": char_vocab, "pos": pos_vocab}
          )
  
      # filter and sample data
      if args.get("sample_train", 1.0) < 1.0 and not self.eval:
          keep = int(args["sample_train"] * len(data))
          data = random.sample(data, keep)
          logger.debug(
              "Subsample training set with rate {:g}".format(
                  args["sample_train"]
              )
          )
  
      data = self.preprocess(
          data, self.vocab["char"], self.vocab["pos"], args
      )
      # shuffle for training
      if self.shuffled:
          indices = list(range(len(data)))
          random.shuffle(indices)
          data = [data[i] for i in indices]
      self.num_examples = len(data)
  
      # chunk into batches
      data = [
          data[i : i + batch_size]
          for i in range(0, len(data), batch_size)
      ]
      self.data = data
      logger.debug("{} batches created.".format(len(data)))
  
imports: import random
  import numpy
  import os
  from collections import Counter
  import logging
  import torch
  import stanza.models.common.seq2seq_constant
  from stanza.models.common.data import map_to_ids, get_long_tensor, get_float_tensor, sort_all
  from stanza.models.lemma.vocab import Vocab, MultiVocab
  from stanza.models.lemma import edit
  from stanza.models.common.doc import *
label_desc: Use image node_id 1 to create a new DataLoader object  with example: obj = DataLoader(doc, batch_size, args, vocab, evaluation, conll_only, skip)