code: def load_data(path, vocab, direction):
      if os.path.isdir(path):
          filenames = sorted(os.listdir(path))
          for filename in filenames:
              logger.info("Loading data from {}".format(filename))
              data = load_file(
                  os.path.join(path, filename), vocab, direction
              )
              yield data
      else:
          data = load_file(path, vocab, direction)
          yield data
  
imports: import argparse
  from copy import copy
  import logging
  import lzma
  import math
  import os
  import random
  import time
  from types import GeneratorType
  import numpy
  import torch
  from stanza.models.common.char_model import build_charlm_vocab, CharacterLanguageModel, CharacterLanguageModelTrainer
  from stanza.models.common.vocab import CharVocab
  from stanza.models.common import utils
  from stanza.models import _training_logging
label_desc: Use image node_id 5 for calling a global function with example usage: load_data(path, vocab, direction) without return types