|
16 | 16 | # include <windows.h> |
17 | 17 | #endif |
18 | 18 |
|
| 19 | +#define JSON_ASSERT GGML_ASSERT |
| 20 | +#include <nlohmann/json.hpp> |
| 21 | + |
19 | 22 | #include <algorithm> |
20 | 23 | #include <climits> |
21 | 24 | #include <cstdarg> |
|
36 | 39 | # include <future> |
37 | 40 | #endif |
38 | 41 |
|
39 | | -#include "json-schema-to-grammar.h" |
40 | | - |
41 | 42 | using json = nlohmann::ordered_json; |
42 | 43 |
|
43 | 44 | std::initializer_list<enum llama_example> mmproj_examples = { |
@@ -1300,6 +1301,7 @@ common_params_context common_params_parser_init(common_params & params, |
1300 | 1301 | sampler_type_names.pop_back(); |
1301 | 1302 |
|
1302 | 1303 | params.optimize = ggml_opt_get_default_optimizer_params(NULL); |
| 1304 | + params.optimize.lr = 1e-8; |
1303 | 1305 |
|
1304 | 1306 | /** |
1305 | 1307 | * filter options by example |
@@ -1385,19 +1387,22 @@ common_params_context common_params_parser_init(common_params & params, |
1385 | 1387 | add_opt(common_arg( |
1386 | 1388 | {"--prio"}, "N", |
1387 | 1389 | string_format("set process/thread priority : low(-1), normal(0), medium(1), high(2), realtime(3) (default: %d)\n", params.cpuparams.priority), |
1388 | | - [](common_params & params, int prio) { |
1389 | | - if (prio < 0 || prio > 3) { |
1390 | | - throw std::invalid_argument("invalid value"); |
1391 | | - } |
1392 | | - params.cpuparams.priority = (enum ggml_sched_priority) prio; |
1393 | | - })); |
1394 | | - add_opt(common_arg({ "--poll" }, |
1395 | | - "<0...100>", |
1396 | | - string_format( |
1397 | | - "use polling level to wait for work (0 - no polling, default: %u)\n", (unsigned) params.cpuparams.poll), |
1398 | | - [](common_params & params, const std::string & value) { params.cpuparams.poll = std::stoul(value); })); |
1399 | | - add_opt(common_arg({ "-Cb", "--cpu-mask-batch" }, |
1400 | | - "M", |
| 1390 | + [](common_params & params, int prio) { |
| 1391 | + if (prio < GGML_SCHED_PRIO_LOW || prio > GGML_SCHED_PRIO_REALTIME) { |
| 1392 | + throw std::invalid_argument("invalid value"); |
| 1393 | + } |
| 1394 | + params.cpuparams.priority = (enum ggml_sched_priority) prio; |
| 1395 | + } |
| 1396 | + )); |
| 1397 | + add_opt(common_arg( |
| 1398 | + {"--poll"}, "<0...100>", |
| 1399 | + string_format("use polling level to wait for work (0 - no polling, default: %u)\n", (unsigned) params.cpuparams.poll), |
| 1400 | + [](common_params & params, const std::string & value) { |
| 1401 | + params.cpuparams.poll = std::stoul(value); |
| 1402 | + } |
| 1403 | + )); |
| 1404 | + add_opt(common_arg( |
| 1405 | + {"-Cb", "--cpu-mask-batch"}, "M", |
1401 | 1406 | "CPU affinity mask: arbitrarily long hex. Complements cpu-range-batch (default: same as --cpu-mask)", |
1402 | 1407 | [](common_params & params, const std::string & mask) { |
1403 | 1408 | params.cpuparams_batch.mask_valid = true; |
@@ -2138,7 +2143,7 @@ common_params_context common_params_parser_init(common_params & params, |
2138 | 2143 | .set_examples({ LLAMA_EXAMPLE_FINETUNE })); |
2139 | 2144 | add_opt(common_arg({ "-opt", "--optimizer" }, |
2140 | 2145 | "sgd|adamw", |
2141 | | - "adamw or //TODO:sgd", |
| 2146 | + "adamw or sgd", |
2142 | 2147 | [](common_params & params, const std::string & name) { |
2143 | 2148 | params.optimize.optimizer = ggml_opt_get_optimizer(name.c_str()); |
2144 | 2149 | if (params.optimize.optimizer == GGML_OPT_OPTIMIZER_COUNT) { |
|
0 commit comments