diff --git a/distiller/apputils/execution_env.py b/distiller/apputils/execution_env.py index a7745527f1fa1eb7f2687e49aba668d73c89271b..e32865061276b5ba411b8aebef7860d8e1c0695f 100755 --- a/distiller/apputils/execution_env.py +++ b/distiller/apputils/execution_env.py @@ -42,7 +42,7 @@ except ImportError: logger = logging.getLogger("app_cfg") -def log_execution_env_state(config_paths=None, logdir=None, gitroot='.'): +def log_execution_env_state(config_paths=None, logdir=None): """Log information about the execution environment. Files in 'config_paths' will be copied to directory 'logdir'. A common use-case @@ -62,7 +62,7 @@ def log_execution_env_state(config_paths=None, logdir=None, gitroot='.'): It is useful to know what git tag we're using, and if we have outstanding code. """ try: - repo = Repo(gitroot) + repo = Repo(os.path.join(os.path.dirname(__file__), '..', '..')) assert not repo.bare except InvalidGitRepositoryError: logger.debug("Cannot find a Git repository. You probably downloaded an archive of Distiller.") diff --git a/distiller/apputils/image_classifier.py b/distiller/apputils/image_classifier.py index 23c07a46d50c47ab28a7ec576b00cbb38e7b3cd5..f3be179f1e953b263ef9442b8f906813d013a699 100755 --- a/distiller/apputils/image_classifier.py +++ b/distiller/apputils/image_classifier.py @@ -293,10 +293,9 @@ def init_classifier_compression_arg_parser(): def _init_logger(args, script_dir): global msglogger - if not script_dir or not hasattr(args, "output_dir") or not args.output_dir: + if script_dir is None or not hasattr(args, "output_dir") or args.output_dir is None: msglogger.logdir = None return None - module_path = os.path.abspath(os.path.join(script_dir, '..', '..')) if not os.path.exists(args.output_dir): os.makedirs(args.output_dir) msglogger = apputils.config_pylogger(os.path.join(script_dir, 'logging.conf'), @@ -306,7 +305,7 @@ def _init_logger(args, script_dir): # to refer to past experiment executions and this information may be useful. apputils.log_execution_env_state( filter(None, [args.compress, args.qe_stats_file]), # remove both None and empty strings - msglogger.logdir, gitroot=module_path) + msglogger.logdir) msglogger.debug("Distiller: %s", distiller.__version__) return msglogger.logdir diff --git a/examples/ncf/ncf.py b/examples/ncf/ncf.py index 98376ca825ae800cbfbc8aeae08df176b765d174..3efa764e62a6534a4334ff56728da96554c0ba9d 100644 --- a/examples/ncf/ncf.py +++ b/examples/ncf/ncf.py @@ -188,7 +188,6 @@ def main(): global msglogger script_dir = os.path.dirname(__file__) - module_path = os.path.abspath(os.path.join(script_dir, '..', '..')) args = parse_args() @@ -206,7 +205,7 @@ def main(): args.qe_mode = str(args.qe_mode).split('.')[1] args.qe_clip_acts = str(args.qe_clip_acts).split('.')[1] - apputils.log_execution_env_state(sys.argv, gitroot=module_path) + apputils.log_execution_env_state(sys.argv) if args.gpus is not None: try: