code: def __init__(self, input_file, size):
      self.seq_length = param.seq_len
      self._size = size
  
      logger.info("Loading corpus...")
      # preprocess data
      with open(input_file, "rb") as f:
          data = f.read()
      data = [chr(c) for c in data if c < 128]
      counter = Counter(data)
      char_cnt = sorted(
          counter.items(), key=operator.itemgetter(1), reverse=True
      )
      self.chars = [x[0] for x in char_cnt]
      print(sorted(self.chars))
      self.vocab_size = len(self.chars)
      param.vocab_size = self.vocab_size
      self.char2idx = {c: i for i, c in enumerate(self.chars)}
      self.whole_seq = np.array(
          [self.char2idx[c] for c in data], dtype="int32"
      )
      logger.info(
          "Corpus loaded. Vocab size: {}".format(self.vocab_size)
      )
  
imports: import argparse
  import numpy
  import operator
  import os
  import sys
  from collections import Counter
  import tensorflow
  from tensorpack import *
  from tensorpack.tfutils import optimizer, summary
  from tensorpack.tfutils.gradproc import GlobalNormClip
label_desc: Use image node_id 1 to create a new CharRNNData object from inherited base classes: RNGDataFlow with example: obj = CharRNNData(input_file, size)