|
33 | 33 |
|
34 | 34 | import yaml |
35 | 35 |
|
36 | | -# Root to all built-in recipes. Users can create own recipes. |
37 | | -BUILTIN_RECIPES_LIB = files("modelopt_recipes") |
| 36 | +# Root to all built-in configs and recipes. |
| 37 | +BUILTIN_CONFIG_ROOT = files("modelopt_recipes") |
38 | 38 |
|
39 | 39 | _EXMY_RE = re.compile(r"^[Ee](\d+)[Mm](\d+)$") |
40 | 40 | _EXMY_KEYS = frozenset({"num_bits", "scale_bits"}) |
@@ -73,22 +73,22 @@ def _load_raw_config(config_file: str | Path | Traversable) -> dict[str, Any] | |
73 | 73 | if not config_file.endswith(".yml") and not config_file.endswith(".yaml"): |
74 | 74 | paths_to_check.append(Path(f"{config_file}.yml")) |
75 | 75 | paths_to_check.append(Path(f"{config_file}.yaml")) |
76 | | - paths_to_check.append(BUILTIN_RECIPES_LIB.joinpath(f"{config_file}.yml")) |
77 | | - paths_to_check.append(BUILTIN_RECIPES_LIB.joinpath(f"{config_file}.yaml")) |
| 76 | + paths_to_check.append(BUILTIN_CONFIG_ROOT.joinpath(f"{config_file}.yml")) |
| 77 | + paths_to_check.append(BUILTIN_CONFIG_ROOT.joinpath(f"{config_file}.yaml")) |
78 | 78 | else: |
79 | 79 | paths_to_check.append(Path(config_file)) |
80 | | - paths_to_check.append(BUILTIN_RECIPES_LIB.joinpath(config_file)) |
| 80 | + paths_to_check.append(BUILTIN_CONFIG_ROOT.joinpath(config_file)) |
81 | 81 | elif isinstance(config_file, Path): |
82 | 82 | if config_file.suffix in (".yml", ".yaml"): |
83 | 83 | paths_to_check.append(config_file) |
84 | 84 | if not config_file.is_absolute(): |
85 | | - paths_to_check.append(BUILTIN_RECIPES_LIB.joinpath(str(config_file))) |
| 85 | + paths_to_check.append(BUILTIN_CONFIG_ROOT.joinpath(str(config_file))) |
86 | 86 | else: |
87 | 87 | paths_to_check.append(Path(f"{config_file}.yml")) |
88 | 88 | paths_to_check.append(Path(f"{config_file}.yaml")) |
89 | 89 | if not config_file.is_absolute(): |
90 | | - paths_to_check.append(BUILTIN_RECIPES_LIB.joinpath(f"{config_file}.yml")) |
91 | | - paths_to_check.append(BUILTIN_RECIPES_LIB.joinpath(f"{config_file}.yaml")) |
| 90 | + paths_to_check.append(BUILTIN_CONFIG_ROOT.joinpath(f"{config_file}.yml")) |
| 91 | + paths_to_check.append(BUILTIN_CONFIG_ROOT.joinpath(f"{config_file}.yaml")) |
92 | 92 | elif isinstance(config_file, Traversable): |
93 | 93 | paths_to_check.append(config_file) |
94 | 94 | else: |
|
0 commit comments