From 03e43747b65a5831f38244cfed72c33ba9ae1d96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E4=BA=91=E9=BE=99?= <76432572+nankingjing@users.noreply.github.com> Date: Sat, 11 Jul 2026 18:25:19 +0800 Subject: [PATCH] fix(config): read YAML config files as UTF-8 _load_yaml opened config files with the platform default (locale) encoding instead of UTF-8. The shipped configs (e.g. configs/_base_/default.yaml) contain UTF-8 non-ASCII characters (em-dash, arrows, box-drawing), so load_config() raises UnicodeDecodeError on any non-UTF-8 locale (e.g. Windows cp936/cp1252), breaking scripts/train.py and scripts/eval_only.py before startup. YAML is UTF-8 by spec, and the rest of the codebase already opens text files with encoding="utf-8". Pass encoding="utf-8" here for parity. --- skillopt/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skillopt/config.py b/skillopt/config.py index e7dbb834..8b133676 100644 --- a/skillopt/config.py +++ b/skillopt/config.py @@ -158,7 +158,7 @@ def _load_yaml(path: str, _visited: set[str] | None = None) -> dict: raise ValueError(f"Circular _base_ inheritance: {abs_path}") _visited.add(abs_path) - with open(abs_path) as f: + with open(abs_path, encoding="utf-8") as f: cfg = yaml.safe_load(f) or {} base_ref = cfg.pop("_base_", None)