code: def load_dataset_with_cache(
      src_corpus_path: str,
      tgt_corpus_path: str,
      src_tokenizer: BaseTokenizerWithVocab,
      tgt_tokenizer: BaseTokenizerWithVocab,
      overwrite_cache: bool,
      local_rank: int,
      max_src_length: int = None,
      max_tgt_length: int = None,
      pretokenized=True,
  ):
      src_md5sum = md5sum(src_corpus_path)
      tgt_md5sum = md5sum(tgt_corpus_path)
      cache_filepath = os.path.join(
          CACHE_PATH,
          "{}_{}_{}_{}.cache.npz".format(
              src_md5sum[:6],
              tgt_md5sum[:6],
              max_src_length,
              max_tgt_length,
          ),
      )
      if os.path.exists(cache_filepath) and not overwrite_cache:
          if local_rank == 0:
              logging.info("Load cache from {}".format(cache_filepath))
          npz_data = np.load(cache_filepath, allow_pickle=True)
          src_data, tgt_data = (
              npz_data["src_data"][:],
              npz_data["tgt_data"][:],
          )
      else:
          assert src_tokenizer.vocab.eos_id is not None, (
              "You will need to add the EOS token to the vocabulary used in the tokenizer of "
              "the source language."
          )
          assert (
              tgt_tokenizer.vocab.bos_id is not None
              and tgt_tokenizer.vocab.eos_id is not None
          ), (
              "You will need to add both the BOS token and the EOS tokens to the vocabulary used "
              "in the tokenizer of the target language."
          )
          src_data = []
          tgt_data = []
          # TODO(sxjscience) Optimize the speed of converting to cache
          with open(src_corpus_path) as f:
              for line in f:
                  if pretokenized:
                      src_tokens = src_tokenizer.vocab[
                          line.strip().split()
                      ]
                  else:
                      src_tokens = src_tokenizer.encode(
                          line.strip(), output_type=int
                      )
                  if max_src_length is not None:
                      src_tokens = src_tokens[:max_src_length]
                  sample = np.array(
                      src_tokens + [src_tokenizer.vocab.eos_id],
                      dtype=np.int32,
                  )
                  src_data.append(sample)
          with open(tgt_corpus_path) as f:
              for line in f:
                  if pretokenized:
                      tgt_tokens = tgt_tokenizer.vocab[
                          line.strip().split()
                      ]
                  else:
                      tgt_tokens = tgt_tokenizer.encode(
                          line.strip(), output_type=int
                      )
                  if max_tgt_length is not None:
                      tgt_tokens = tgt_tokens[:max_tgt_length]
                  sample = np.array(
                      [tgt_tokenizer.vocab.bos_id]
                      + tgt_tokens
                      + [tgt_tokenizer.vocab.eos_id],
                      dtype=np.int32,
                  )
                  tgt_data.append(sample)
          src_data = np.array(src_data)
          tgt_data = np.array(tgt_data)
          np.savez(cache_filepath, src_data=src_data, tgt_data=tgt_data)
      return src_data, tgt_data
  
imports: import argparse
  import time
  import random
  import os
  import logging
  import json
  import math
  import numpy
  import mxnet
  import sacrebleu
  from mxnet import gluon
  from gluonnlp.models.transformer import TransformerModel, TransformerInference
  from gluonnlp.sequence_sampler import BeamSearchSampler, BeamSearchScorer
  from gluonnlp.utils.misc import logging_config, md5sum, grouper, init_comm, repeat
  from gluonnlp.data.sampler import ConstWidthBucket, LinearWidthBucket, ExpWidthBucket, FixedBucketSampler, BoundedBudgetSampler, ShardedIterator
  from tensorboardX import SummaryWriter
  import gluonnlp.data.batchify
  from gluonnlp.data import Vocab
  from gluonnlp.data import tokenizers
  from gluonnlp.data.tokenizers import BaseTokenizerWithVocab, huggingface, MosesTokenizer
  from gluonnlp.lr_scheduler import InverseSquareRootScheduler
  from gluonnlp.loss import LabelSmoothCrossEntropyLoss
  from gluonnlp.utils.parameter import grad_global_norm, clip_grad_global_norm, deduplicate_param_dict, count_parameters, AverageSGDTracker
label_desc: Use image node_id 3 for calling a global function with example usage: load_dataset_with_cache(src_corpus_path, tgt_corpus_path, src_tokenizer, tgt_tokenizer, overwrite_cache, local_rank, max_src_length, max_tgt_length, pretokenized) and returns: src_data,  tgt_data