code: def load_hparams(model_dir):
      """Load hparams from an existing model directory."""
      hparams_file = os.path.join(model_dir, "hparams")
      if tf.gfile.Exists(hparams_file):
          print_out("# Loading hparams from %s" % hparams_file)
          with codecs.getreader("utf-8")(
              tf.gfile.GFile(hparams_file, "rb")
          ) as f:
              try:
                  hparams_values = json.load(f)
                  hparams = tf.contrib.training.HParams(
                      **hparams_values
                  )
              except ValueError:
                  print_out("  can't load hparams file")
                  return None
          return hparams
      else:
          return None
  
imports: from __future__ import print_function
  import codecs
  import collections
  import json
  import math
  import os
  import sys
  import time
  from distutils import version
  import tensorflow
label_desc: Use image node_id 6 for calling a global function with example usage: load_hparams(model_dir) and returns: hparams, None, None