| 164 | } |
| 165 | |
| 166 | void common_preset::apply_to_params(common_params & params) const { |
| 167 | for (const auto & [opt, val] : options) { |
| 168 | // apply each option to params |
| 169 | if (opt.handler_string) { |
| 170 | opt.handler_string(params, val); |
| 171 | } else if (opt.handler_int) { |
| 172 | opt.handler_int(params, std::stoi(val)); |
| 173 | } else if (opt.handler_bool) { |
| 174 | opt.handler_bool(params, common_arg_utils::is_truthy(val)); |
| 175 | } else if (opt.handler_str_str) { |
| 176 | // not supported yet |
| 177 | throw std::runtime_error(string_format( |
| 178 | "%s: option with two values is not supported yet", |
| 179 | __func__ |
| 180 | )); |
| 181 | } else if (opt.handler_void) { |
| 182 | opt.handler_void(params); |
| 183 | } else { |
| 184 | GGML_ABORT("unknown handler type"); |
| 185 | } |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | static std::map<std::string, std::map<std::string, std::string>> parse_ini_from_file(const std::string & path) { |
| 190 | std::map<std::string, std::map<std::string, std::string>> parsed; |
no test coverage detected