This commit is contained in:
2026-01-22 20:52:42 +08:00
parent 5238e105e4
commit 518dea58f6

View File

@@ -18,7 +18,7 @@ from hybrid_diffusion import (
q_sample_continuous, q_sample_continuous,
q_sample_discrete, q_sample_discrete,
) )
from platform_utils import resolve_device, safe_path, ensure_dir from platform_utils import resolve_device, safe_path, ensure_dir, resolve_path
BASE_DIR = Path(__file__).resolve().parent BASE_DIR = Path(__file__).resolve().parent
@@ -84,12 +84,17 @@ def resolve_config_paths(config, base_dir: Path):
if key in config: if key in config:
# 如果值是字符串转换为Path对象 # 如果值是字符串转换为Path对象
if isinstance(config[key], str): if isinstance(config[key], str):
path = Path(config[key]) path_str = config[key]
# glob pattern cannot be Path.resolve()'d on Windows
if "*" in path_str or "?" in path_str or "[" in path_str:
config[key] = str((base_dir / Path(path_str)))
continue
path = Path(path_str)
else: else:
path = config[key] path = config[key]
if not path.is_absolute(): if not path.is_absolute():
config[key] = str((base_dir / path).resolve()) config[key] = str(resolve_path(base_dir, path))
else: else:
config[key] = str(path) config[key] = str(path)
return config return config