ultralytics 8.0.214 Windows UTF-8 notebook fix (#6459)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Jorge Torres <63155200+JorgeT42@users.noreply.github.com> Co-authored-by: slxiu <121917717+slxiu@users.noreply.github.com>
This commit is contained in:
parent
6baa3bdde6
commit
d43fcecc8a
7 changed files with 25 additions and 76 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
||||
|
||||
__version__ = '8.0.213'
|
||||
__version__ = '8.0.214'
|
||||
|
||||
from ultralytics.models import RTDETR, SAM, YOLO
|
||||
from ultralytics.models.fastsam import FastSAM
|
||||
|
|
|
|||
|
|
@ -229,8 +229,15 @@ def set_logging(name=LOGGING_NAME, verbose=True):
|
|||
level = logging.INFO if verbose and RANK in {-1, 0} else logging.ERROR # rank in world for Multi-GPU trainings
|
||||
|
||||
# Configure the console (stdout) encoding to UTF-8
|
||||
if WINDOWS: # for Windows
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
if WINDOWS and sys.stdout.encoding != 'utf-8':
|
||||
try:
|
||||
if hasattr(sys.stdout, 'reconfigure'):
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
else:
|
||||
import io
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||
except Exception as e:
|
||||
print(f'ERROR setting UTF-8 encoding: {e}')
|
||||
|
||||
# Create and configure the StreamHandler
|
||||
stream_handler = logging.StreamHandler(sys.stdout)
|
||||
|
|
@ -501,14 +508,14 @@ def is_pytest_running():
|
|||
return ('PYTEST_CURRENT_TEST' in os.environ) or ('pytest' in sys.modules) or ('pytest' in Path(sys.argv[0]).stem)
|
||||
|
||||
|
||||
def is_github_actions_ci() -> bool:
|
||||
def is_github_action_running() -> bool:
|
||||
"""
|
||||
Determine if the current environment is a GitHub Actions CI Python runner.
|
||||
Determine if the current environment is a GitHub Actions runner.
|
||||
|
||||
Returns:
|
||||
(bool): True if the current environment is a GitHub Actions CI Python runner, False otherwise.
|
||||
(bool): True if the current environment is a GitHub Actions runner, False otherwise.
|
||||
"""
|
||||
return 'GITHUB_ACTIONS' in os.environ and 'RUNNER_OS' in os.environ and 'RUNNER_TOOL_CACHE' in os.environ
|
||||
return 'GITHUB_ACTIONS' in os.environ and 'GITHUB_WORKFLOW' in os.environ and 'RUNNER_OS' in os.environ
|
||||
|
||||
|
||||
def is_git_dir():
|
||||
|
|
@ -913,7 +920,7 @@ WEIGHTS_DIR = Path(SETTINGS['weights_dir']) # global weights directory
|
|||
RUNS_DIR = Path(SETTINGS['runs_dir']) # global runs directory
|
||||
ENVIRONMENT = 'Colab' if is_colab() else 'Kaggle' if is_kaggle() else 'Jupyter' if is_jupyter() else \
|
||||
'Docker' if is_docker() else platform.system()
|
||||
TESTS_RUNNING = is_pytest_running() or is_github_actions_ci()
|
||||
TESTS_RUNNING = is_pytest_running() or is_github_action_running()
|
||||
set_sentry()
|
||||
|
||||
# Apply monkey patches
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ from matplotlib import font_manager
|
|||
|
||||
from ultralytics.utils import (ASSETS, AUTOINSTALL, LINUX, LOGGER, ONLINE, ROOT, USER_CONFIG_DIR, SimpleNamespace,
|
||||
ThreadingLocked, TryExcept, clean_url, colorstr, downloads, emojis, is_colab, is_docker,
|
||||
is_jupyter, is_kaggle, is_online, is_pip_package, url2file)
|
||||
is_github_action_running, is_jupyter, is_kaggle, is_online, is_pip_package, url2file)
|
||||
|
||||
|
||||
def parse_requirements(file_path=ROOT.parent / 'requirements.txt', package=''):
|
||||
|
|
@ -552,6 +552,14 @@ def collect_system_info():
|
|||
is_met = '❌ '
|
||||
LOGGER.info(f'{r.name:<20}{is_met}{current}{r.specifier}')
|
||||
|
||||
if is_github_action_running():
|
||||
LOGGER.info(f"\nRUNNER_OS: {os.getenv('RUNNER_OS')}\n"
|
||||
f"GITHUB_EVENT_NAME: {os.getenv('GITHUB_EVENT_NAME')}\n"
|
||||
f"GITHUB_WORKFLOW: {os.getenv('GITHUB_WORKFLOW')}\n"
|
||||
f"GITHUB_ACTOR: {os.getenv('GITHUB_ACTOR')}\n"
|
||||
f"GITHUB_REPOSITORY: {os.getenv('GITHUB_REPOSITORY')}\n"
|
||||
f"GITHUB_REPOSITORY_OWNER: {os.getenv('GITHUB_REPOSITORY_OWNER')}\n")
|
||||
|
||||
|
||||
def check_amp(model):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue