google-research / t5x

Apache License 2.0
2.66k stars 303 forks source link

Missing import in t5x/checkpoints.py #1353

Open rajansaini691 opened 1 year ago

rajansaini691 commented 1 year ago

Hi! There seems to be a missing import in t5x/checkpoints.py. Inserting the proposed import (based on this) seems to have done the trick, but before that line gets permanently engraved into a PR until the end of time, I'd like to raise this for discussion.

Proposed import

from tensorboard.backend.event_processing import io_wrapper

Culprit code

  for subdir in io_wrapper.GetLogdirSubdirectories(checkpoints_dir):    # this io_wrapper is feeling very lost...
    rpath = os.path.relpath(subdir, checkpoints_dir)
    # Skip runs that do not match user-specified metric.
    if ((not metric_run and
         not _try_fill_metric_run_and_tag_names(metric_name, (rpath,))) or
        metric_run != rpath):
      logging.info('Skipping events in %s', subdir)
      continue

    logging.info('Looking for events in %s', subdir)
    loader = directory_watcher.DirectoryWatcher(
        subdir, event_file_loader.EventFileLoader,
        io_wrapper.IsTensorFlowEventsFile)              #  ... and this one, too :(
Dnmh commented 2 months ago

I'm having the same issue, some additional imports were missing (event_file_loader, directory_watcher). Extending the solution above resolved the issue:

from tensorboard.backend.event_processing import io_wrapper, event_file_loader, directory_watcher