def load_config(filename):
  """Loads a serialized model config into a ModelConfig object."""
  with gfile.Open(filename) as infile:
    model_dict = json.load(infile)

  # Load the data options
  data_options = DataOptions(**model_dict['data_options'])
  model_parameters = ModelParameters(**model_dict['model_parameters'])
  training_options = TrainingOptions(**model_dict['training_options'])

  model_config = ModelConfig(
      data_options=data_options,
      model_parameters=model_parameters,
      training_options=training_options)

  return model_config
Loads a serialized model config into a ModelConfig object.
language/xsp/model/model_config.py