Skip to content

Instantly share code, notes, and snippets.

@tals
Last active March 16, 2020 22:16
Show Gist options
  • Save tals/58b8316c9fa0da7eb0f55cac17cafbfb to your computer and use it in GitHub Desktop.
Save tals/58b8316c9fa0da7eb0f55cac17cafbfb to your computer and use it in GitHub Desktop.
Quickly inspect tensorboard logs when they're scattered around
import subprocess
import os
import tempfile
import argparse
def main():
parser = argparse.ArgumentParser(__name__, usage='multitb <logdir1> <logdir2> ...')
parser.add_argument('inputs', nargs='+')
args, rest = parser.parse_known_args()
try:
with tempfile.TemporaryDirectory() as td:
for p in args.inputs:
if not os.path.exists(p):
print(f'"{p}" doesn\'t exist')
exit(1)
name = p.replace('/', '_').strip('_')
os.symlink(os.path.abspath(p), os.path.join(td, name))
subprocess.call(['tensorboard', '--logdir', td, *rest])
except KeyboardInterrupt:
...
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment