t5x.gin_utils package#

Utilities for using gin configurations with T5X binaries.

t5x.gin_utils.bool_fn(var1=<object object>)[source]#

bool function to use inside gin files.

t5x.gin_utils.get_gin_config_str(show_provenance=False)[source]#

Utility function retrieving configuration in string form.

This is only necessary to to provide a configurable name to toggle the show_provenance parameter.

Parameters:

show_provenance – Flag indicating whether to show (where possible) the provenance of configuration settings.

Returns:

Current gin configuration as string.

t5x.gin_utils.parse_gin_flags(gin_search_paths, gin_files, gin_bindings, skip_unknown=False, finalize_config=True)[source]#

Parses provided gin files override params.

Parameters:
  • gin_search_paths – paths that will be searched for gin files.

  • gin_files – paths to gin config files to be parsed. Files will be parsed in order with conflicting settings being overriden by later files. Paths may be relative to paths in gin_search_paths.

  • gin_bindings – individual gin bindings to be applied after the gin files are parsed. Will be applied in order with conflicting settings being overriden by later ones.

  • skip_unknown – whether to ignore unknown bindings or raise an error (default behavior). Alternatively, a list of configurable names to skip if unknown.

  • finalize_config – whether to finalize the config so that it cannot be modified (default behavior).

t5x.gin_utils.rewrite_gin_args(args)[source]#

Rewrite –gin.NAME=VALUE flags to –gin_bindings=NAME=VALUE.

t5x.gin_utils.run(main)[source]#

Wrapper for app.run that rewrites gin args before parsing.

t5x.gin_utils.string_split_fn(text=<object object>, separator=<object object>, maxsplit=-1, index=None)[source]#

String split function to use inside gin files.

t5x.gin_utils.sum_fn(var1=<object object>, var2=<object object>)[source]#

sum function to use inside gin files.

t5x.gin_utils.summarize_gin_config(model_dir, summary_writer, step)[source]#

Writes gin config to the model dir and TensorBoard summary.