Unverified 提交 3356f260 authored 作者: Glenn Jocher's avatar Glenn Jocher 提交者: GitHub

Add Python version output (#7814)

上级 4a295b1a
...@@ -256,7 +256,7 @@ def file_age(path=__file__): ...@@ -256,7 +256,7 @@ def file_age(path=__file__):
return dt.days # + dt.seconds / 86400 # fractional days return dt.days # + dt.seconds / 86400 # fractional days
def file_update_date(path=__file__): def file_date(path=__file__):
# Return human-readable file modification date, i.e. '2021-3-26' # Return human-readable file modification date, i.e. '2021-3-26'
t = datetime.fromtimestamp(Path(path).stat().st_mtime) t = datetime.fromtimestamp(Path(path).stat().st_mtime)
return f'{t.year}-{t.month}-{t.day}' return f'{t.year}-{t.month}-{t.day}'
......
...@@ -18,7 +18,7 @@ import torch.distributed as dist ...@@ -18,7 +18,7 @@ import torch.distributed as dist
import torch.nn as nn import torch.nn as nn
import torch.nn.functional as F import torch.nn.functional as F
from utils.general import LOGGER, file_update_date, git_describe from utils.general import LOGGER, file_date, git_describe
try: try:
import thop # for FLOPs computation import thop # for FLOPs computation
...@@ -51,7 +51,7 @@ def device_count(): ...@@ -51,7 +51,7 @@ def device_count():
def select_device(device='', batch_size=0, newline=True): def select_device(device='', batch_size=0, newline=True):
# device = 'cpu' or '0' or '0,1,2,3' # device = 'cpu' or '0' or '0,1,2,3'
s = f'YOLOv5 🚀 {git_describe() or file_update_date()} torch {torch.__version__} ' # string s = f'YOLOv5 🚀 {git_describe() or file_date()} Python-{platform.python_version()} torch-{torch.__version__} '
device = str(device).strip().lower().replace('cuda:', '') # to string, 'cuda:0' to '0' device = str(device).strip().lower().replace('cuda:', '') # to string, 'cuda:0' to '0'
cpu = device == 'cpu' cpu = device == 'cpu'
if cpu: if cpu:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论