Last active
March 16, 2020 22:16
-
-
Save tals/58b8316c9fa0da7eb0f55cac17cafbfb to your computer and use it in GitHub Desktop.
Quickly inspect tensorboard logs when they're scattered around
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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