MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / apply_to_params

Method apply_to_params

subprojects/llama.cpp/common/preset.cpp:166–187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166void 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
189static 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;

Callers 1

Calls 1

string_formatFunction · 0.70

Tested by

no test coverage detected