/
githubmirror
/
yolov5
Обзор
Документация
Войти
/
githubmirror
/
yolov5
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
utils/__init__.py
46 строк
1 KB
Glenn Jocher
Use ultralytics' LOGGER everywhere (#13840)
29 июл 2026, 05:19
Не верифицирован
29 июл 2026, 05:19
f9e040b
Код
Авторство
О чём код?
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license """utils/initialization.""" import contextlib from ultralytics.utils import LOGGER, TryExcept, emojis, threaded # noqa: F401 def notebook_init(verbose=True): """Initializes notebook environment by checking requirements, cleaning up, and displaying system info.""" LOGGER.info("Checking setup...") import os import shutil from ultralytics.utils.checks import check_requirements from utils.general import check_font, is_colab from utils.torch_utils import select_device # imports check_font() import psutil if check_requirements("wandb", install=False): os.system("pip uninstall -y wandb") # eliminate unexpected account creation prompt with infinite hang if is_colab(): shutil.rmtree("/content/sample_data", ignore_errors=True) # remove colab /sample_data directory # System info display = None if verbose: gb = 1 << 30 # bytes to GiB (1024 ** 3) ram = psutil.virtual_memory().total total, _used, free = shutil.disk_usage("/") with contextlib.suppress(Exception): # clear display if ipython is installed from IPython import display display.clear_output() s = f"({os.cpu_count()} CPUs, {ram / gb:.1f} GB RAM, {(total - free) / gb:.1f}/{total / gb:.1f} GB disk)" else: s = "" select_device(newline=False) LOGGER.info(f"Setup complete ✅ {s}") return display