Merge 92fd715177 into 58062860af
This commit is contained in:
commit
1f7589c46f
|
|
@ -177,6 +177,26 @@ common_presets common_presets_load(const std::string & path, common_params_conte
|
||||||
auto key_to_opt = get_map_key_opt(ctx_params);
|
auto key_to_opt = get_map_key_opt(ctx_params);
|
||||||
auto ini_data = parse_ini_from_file(path);
|
auto ini_data = parse_ini_from_file(path);
|
||||||
|
|
||||||
|
// merge "added" into "base", preserving existing keys in "base"
|
||||||
|
auto merge_sections = [](std::map<std::string, std::string> & base, const std::map<std::string, std::string> & added) {
|
||||||
|
for (const auto & [key, value] : added) {
|
||||||
|
if (base.find(key) == base.end()) {
|
||||||
|
base[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// handle the "global" section as the default preset
|
||||||
|
if (ini_data.find("*") != ini_data.end()) {
|
||||||
|
auto & global_section = ini_data["*"];
|
||||||
|
for (auto & item : ini_data) {
|
||||||
|
merge_sections(item.second, global_section);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: support inheritance between presets in the future
|
||||||
|
// note: server-models also need to be aware of the case where presets inherit from cached models
|
||||||
|
|
||||||
for (auto section : ini_data) {
|
for (auto section : ini_data) {
|
||||||
common_preset preset;
|
common_preset preset;
|
||||||
if (section.first.empty()) {
|
if (section.first.empty()) {
|
||||||
|
|
|
||||||
|
|
@ -1438,6 +1438,12 @@ Example:
|
||||||
```ini
|
```ini
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
|
; (Optional) This section provides global settings shared across all presets.
|
||||||
|
; If the same key is defined in a specific preset, it will override the value in this global section.
|
||||||
|
[*]
|
||||||
|
c = 8192
|
||||||
|
n-gpu-layer = 8
|
||||||
|
|
||||||
; If the key corresponds to an existing model on the server,
|
; If the key corresponds to an existing model on the server,
|
||||||
; this will be used as the default config for that model
|
; this will be used as the default config for that model
|
||||||
[ggml-org/MY-MODEL-GGUF:Q8_0]
|
[ggml-org/MY-MODEL-GGUF:Q8_0]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue