handler_util.py 589 B

123456789101112131415161718192021
  1. import wandb.data_types as data_types
  2. def get_types():
  3. classes = map(data_types.__dict__.get, data_types.__all__)
  4. types = []
  5. for cls in classes:
  6. if hasattr(cls, "_log_type") and cls._log_type is not None:
  7. types.append(cls._log_type)
  8. # add table-file type because this is a special case
  9. # that does not have a matching _log_type for artifacts
  10. # and files
  11. types.append("table-file")
  12. return types
  13. WANDB_TYPES = get_types()
  14. def metric_is_wandb_dict(metric):
  15. return "_type" in list(metric.keys()) and metric["_type"] in WANDB_TYPES