(bundle_file)
return generator
Returns initialized generator from bundle file path or None if fails.
Returns initialized generator from bundle file path or None if fails.
Returns initialized generator from bundle file path or None if fails .
def _load_generator_from_bundle_file(bundle_file):
  """Returns initialized generator from bundle file path or None if fails."""
  try:
    bundle = sequence_generator_bundle.read_bundle_file(bundle_file)
  except sequence_generator_bundle.GeneratorBundleParseError:
    print('Failed to parse bundle file: %s' % FLAGS.bundle_file)
    return None

  generator_id = bundle.generator_details.id
  if generator_id not in _GENERATOR_MAP:
    print("Unrecognized SequenceGenerator ID '%s' in bundle file: %s" % (
        generator_id, FLAGS.bundle_file))
    return None

  generator = _GENERATOR_MAP[generator_id](checkpoint=None, bundle=bundle)
  generator.initialize()
  print("Loaded '%s' generator bundle from file '%s'." % (
      bundle.generator_details.id, bundle_file))
  return generator
def _load_generator_from_bundle_file ( bundle_file ) : try : bundle = sequence_generator_bundle . read_bundle_file ( bundle_file ) except sequence_generator_bundle . GeneratorBundleParseError : print ( 'Failed to parse bundle file: %s' % FLAGS . bundle_file ) return None generator_id = bundle . generator_details . id if generator_id not in _GENERATOR_MAP : print ( "Unrecognized SequenceGenerator ID '%s' in bundle file: %s" % ( generator_id , FLAGS . bundle_file ) ) return None generator = _GENERATOR_MAP [ generator_id ] ( checkpoint = None , bundle = bundle ) generator . initialize ( ) print ( "Loaded '%s' generator bundle from file '%s'." % ( bundle . generator_details . id , bundle_file ) ) return generator