def flatten_config(config, parent_key = '', sep = '_'):
  """Flattens config and remove tuple/list values for logging in tboard."""
  items = {}
  for k, v in config.items():
    new_key = sep.join(filter(None, (parent_key, k)))
    if isinstance(v, ml_collections.ConfigDict):
      items.update(flatten_config(v, new_key, sep=sep))
    elif isinstance(v, (list, tuple)):
      continue
    else:
      items[new_key] = v
  return items
Flattens config and remove tuple/list values for logging in tboard.
language/gscan/xattn_model/train_utils.py