Skip to content

Instantly share code, notes, and snippets.

@PeterMitrano
Created November 29, 2018 20:28
Show Gist options
  • Save PeterMitrano/8a9c5cac829e2f14c2ded3f703cd6699 to your computer and use it in GitHub Desktop.
Save PeterMitrano/8a9c5cac829e2f14c2ded3f703cd6699 to your computer and use it in GitHub Desktop.
Tensorflow Experiment Naming
import os
from datetime import datetime
import git
import argparse
def make_log_path(args):
repo = git.Repo(search_parent_directories=True)
sha = repo.head.object.hexsha
stamp = "{:%B_%d_%H:%M:%S}".format(datetime.now())
log_subdir = args.log
log_path = os.path.join(log_subdir, "{}__{}".format(stamp, sha))
return log_path
def main():
# set up parser and use something like this
train_subparser.add_argument("--log", "-l", nargs='?', help="save/log, and provide a subdirectory")
# ...
args = argparse.parse_args()
log_path = make_log_path(args)
# pass log_path to FileWriter()
@PeterMitrano
Copy link
Author

obviously this i just pseudo code to inspire you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment