def save_gin(self):
    """"Saves the operative gin config, only if it is the chief."""
    if not self._is_chief:
      return
    assert self._output_dir is not None
    config_path = os.path.join(self._output_dir, 'config.gin')
    config_str = gin.operative_config_str()
    with tf.io.gfile.GFile(config_path, 'w') as f:
      f.write(config_str)
    sw = self._train_sw
    if sw:
      sw.text('gin_config',
              jaxboard.markdownify_operative_config_str(config_str))
"Saves the operative gin config, only if it is the chief.
trax/supervised/trainer_lib.py