Add Python version output (#7814)
Browse files- utils/general.py +1 -1
- 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
|
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,
|
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
|
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:
|