瀏覽代碼

Update git_describe() for remote dir usage (#2606)

5.0
Glenn Jocher GitHub 3 年之前
父節點
當前提交
77415a42e5
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. +4
    -3
      utils/torch_utils.py

+ 4
- 3
utils/torch_utils.py 查看文件

@@ -45,9 +45,10 @@ def init_torch_seeds(seed=0):

def git_describe():
# return human-readable git description, i.e. v5.0-5-g3e25f1e https://git-scm.com/docs/git-describe
if Path('.git').exists():
return subprocess.check_output('git describe --tags --long --always', shell=True).decode('utf-8')[:-1]
else:
s = f'git -C {Path(__file__).resolve().parent} describe --tags --long --always'
try:
return subprocess.check_output(s, shell=True).decode()[:-1]
except subprocess.CalledProcessError as e:
return ''



Loading…
取消
儲存