code: def __init__(
      self,
      doc,
      args,
      pretrain,
      vocab=None,
      evaluation=False,
      sort_during_eval=False,
      bert_tokenizer=None,
      **kwargs,
  ):
      self.args = args
      self.eval = evaluation
      self.shuffled = not self.eval
      self.sort_during_eval = sort_during_eval
      self.doc = doc
  
      if vocab is None:
          self.vocab = Dataset.init_vocab([doc], args)
      else:
          self.vocab = vocab
  
      self.has_upos = not all(
          x is None or x == "_"
          for x in doc.get(UPOS, as_sentences=False)
      )
      self.has_xpos = not all(
          x is None or x == "_"
          for x in doc.get(XPOS, as_sentences=False)
      )
      self.has_feats = not all(
          x is None or x == "_"
          for x in doc.get(FEATS, as_sentences=False)
      )
  
      data = self.load_doc(self.doc)
      # filter out the long sentences if bert is used
      if self.args.get("bert_model", None):
          data = filter_data(
              self.args["bert_model"], data, bert_tokenizer
          )
  
      # handle pretrain; pretrain vocab is used when args['pretrain'] == True and pretrain is not None
      self.pretrain_vocab = None
      if pretrain is not None and args["pretrain"]:
          self.pretrain_vocab = pretrain.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, self.pretrain_vocab, args
      )
  
      self.data = data
  
      self.num_examples = len(data)
      self.__punct_tags = self.vocab["upos"].map(["PUNCT"])
      self.augment_nopunct = self.args.get("augment_nopunct", 0.0)
  
imports: import random
  import logging
  import copy
  import torch
  from collections import namedtuple
  from torch.utils.data import DataLoader
  from torch.nn.utils.rnn import pad_sequence
  from stanza.models.common.bert_embedding import filter_data
  from stanza.models.common.data import map_to_ids, get_long_tensor, get_float_tensor, sort_all
  from stanza.models.common.vocab import PAD_ID, VOCAB_PREFIX, CharVocab
  from stanza.models.pos.vocab import WordVocab, XPOSVocab, FeatureVocab, MultiVocab
  from stanza.models.pos.xpos_vocab_factory import xpos_vocab_factory
  from stanza.models.common.doc import *
label_desc: Use image node_id 1 to create a new Dataset object  with example: obj = Dataset(doc, args, pretrain, vocab, evaluation, sort_during_eval, bert_tokenizer)