export_summary.py 963 B

123456789101112131415161718192021222324252627
  1. from pathlib import Path
  2. from matplotlib import pyplot
  3. from apppath import ensure_existence
  4. from draugr import PROJECT_APP_PATH
  5. from draugr.tensorboard_utilities import TensorboardEventExporter
  6. from draugr.writers import TrainingScalars
  7. if __name__ == "__main__":
  8. save = False
  9. event_files = list(PROJECT_APP_PATH.user_log.rglob("events.out.tfevents.*"))
  10. if len(event_files) > 0:
  11. for _path_to_events_file in event_files:
  12. print(f"Event file: {_path_to_events_file}")
  13. _out_dir = Path.cwd() / "exclude" / "results"
  14. ensure_existence(_out_dir)
  15. tee = TensorboardEventExporter(
  16. _path_to_events_file.parent, save_to_disk=save
  17. )
  18. print(f"Available tags: {tee.tags_available}")
  19. tee.export_line_plot(TrainingScalars.training_loss.value, out_dir=_out_dir)
  20. if not save:
  21. pyplot.show()
  22. else:
  23. print("No events found")