Created
November 29, 2018 20:28
-
-
Save PeterMitrano/8a9c5cac829e2f14c2ded3f703cd6699 to your computer and use it in GitHub Desktop.
Tensorflow Experiment Naming
This file contains hidden or 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 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() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
obviously this i just pseudo code to inspire you