glenn-jocher commited on
Commit
77415a4
1 Parent(s): fca16dc

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

Browse files
Files changed (1) hide show
  1. utils/torch_utils.py +4 -3
utils/torch_utils.py CHANGED
@@ -45,9 +45,10 @@ def init_torch_seeds(seed=0):
45
 
46
  def git_describe():
47
  # return human-readable git description, i.e. v5.0-5-g3e25f1e https://git-scm.com/docs/git-describe
48
- if Path('.git').exists():
49
- return subprocess.check_output('git describe --tags --long --always', shell=True).decode('utf-8')[:-1]
50
- else:
 
51
  return ''
52
 
53
 
 
45
 
46
  def git_describe():
47
  # return human-readable git description, i.e. v5.0-5-g3e25f1e https://git-scm.com/docs/git-describe
48
+ s = f'git -C {Path(__file__).resolve().parent} describe --tags --long --always'
49
+ try:
50
+ return subprocess.check_output(s, shell=True).decode()[:-1]
51
+ except subprocess.CalledProcessError as e:
52
  return ''
53
 
54