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

View File

@ -13,6 +13,7 @@ mixed_precision = True
try: # Mixed precision training https://github.com/NVIDIA/apex
from apex import amp
except:
print('Apex recommended for mixed precision and faster training: https://github.com/NVIDIA/apex')
mixed_precision = False # not installed
wdir = 'weights' + os.sep # weights dir

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