Apex and 'git pull' suggestions

This commit is contained in:
Glenn Jocher
2020-04-15 12:54:56 -07:00
parent b8c3644a18
commit 510eadcfa5
2 changed files with 7 additions and 0 deletions
+6
View File
@@ -3,6 +3,7 @@ import math
import os
import random
import shutil
import subprocess
from pathlib import Path
import cv2
@@ -18,6 +19,11 @@ from . import torch_utils # , google_utils
matplotlib.rc('font', **{'size': 11})
# Suggest 'git pull'
s = subprocess.check_output('git status -uno', shell=True).decode('utf-8')
if 'Your branch is behind' in s:
print(s[s.find('Your branch is behind'):s.find('\n\n')] + '\n')
# Set printoptions
torch.set_printoptions(linewidth=320, precision=5, profile='long')
np.set_printoptions(linewidth=320, formatter={'float_kind': '{:11.5g}'.format}) # format short g, %precision=5