glenn-jocher commited on
Commit
3356f26
Β·
unverified Β·
1 Parent(s): 4a295b1

Add Python version output (#7814)

Browse files
Files changed (2) hide show
  1. utils/general.py +1 -1
  2. utils/torch_utils.py +2 -2
utils/general.py CHANGED
@@ -256,7 +256,7 @@ def file_age(path=__file__):
256
  return dt.days # + dt.seconds / 86400 # fractional days
257
 
258
 
259
- def file_update_date(path=__file__):
260
  # Return human-readable file modification date, i.e. '2021-3-26'
261
  t = datetime.fromtimestamp(Path(path).stat().st_mtime)
262
  return f'{t.year}-{t.month}-{t.day}'
 
256
  return dt.days # + dt.seconds / 86400 # fractional days
257
 
258
 
259
+ def file_date(path=__file__):
260
  # Return human-readable file modification date, i.e. '2021-3-26'
261
  t = datetime.fromtimestamp(Path(path).stat().st_mtime)
262
  return f'{t.year}-{t.month}-{t.day}'
utils/torch_utils.py CHANGED
@@ -18,7 +18,7 @@ import torch.distributed as dist
18
  import torch.nn as nn
19
  import torch.nn.functional as F
20
 
21
- from utils.general import LOGGER, file_update_date, git_describe
22
 
23
  try:
24
  import thop # for FLOPs computation
@@ -51,7 +51,7 @@ def device_count():
51
 
52
  def select_device(device='', batch_size=0, newline=True):
53
  # device = 'cpu' or '0' or '0,1,2,3'
54
- s = f'YOLOv5 πŸš€ {git_describe() or file_update_date()} torch {torch.__version__} ' # string
55
  device = str(device).strip().lower().replace('cuda:', '') # to string, 'cuda:0' to '0'
56
  cpu = device == 'cpu'
57
  if cpu:
 
18
  import torch.nn as nn
19
  import torch.nn.functional as F
20
 
21
+ from utils.general import LOGGER, file_date, git_describe
22
 
23
  try:
24
  import thop # for FLOPs computation
 
51
 
52
  def select_device(device='', batch_size=0, newline=True):
53
  # device = 'cpu' or '0' or '0,1,2,3'
54
+ s = f'YOLOv5 πŸš€ {git_describe() or file_date()} Python-{platform.python_version()} torch-{torch.__version__} '
55
  device = str(device).strip().lower().replace('cuda:', '') # to string, 'cuda:0' to '0'
56
  cpu = device == 'cpu'
57
  if cpu: