| 48 | } |
| 49 | |
| 50 | static void export_md(std::string fname, llama_example ex) { |
| 51 | std::ofstream file(fname, std::ofstream::out | std::ofstream::trunc); |
| 52 | |
| 53 | common_params params; |
| 54 | auto ctx_arg = common_params_parser_init(params, ex); |
| 55 | |
| 56 | std::vector<common_arg *> common_options; |
| 57 | std::vector<common_arg *> sparam_options; |
| 58 | std::vector<common_arg *> specific_options; |
| 59 | for (auto & opt : ctx_arg.options) { |
| 60 | // in case multiple LLAMA_EXAMPLE_* are set, we prioritize the LLAMA_EXAMPLE_* matching current example |
| 61 | if (opt.is_sparam) { |
| 62 | sparam_options.push_back(&opt); |
| 63 | } else if (opt.in_example(ctx_arg.ex)) { |
| 64 | specific_options.push_back(&opt); |
| 65 | } else { |
| 66 | common_options.push_back(&opt); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | file << "**Common params**\n\n"; |
| 71 | write_table(file, common_options); |
| 72 | file << "\n\n**Sampling params**\n\n"; |
| 73 | write_table(file, sparam_options); |
| 74 | file << "\n\n**Example-specific params**\n\n"; |
| 75 | write_table(file, specific_options); |
| 76 | } |
| 77 | |
| 78 | int main(int, char **) { |
| 79 | export_md("autogen-main.md", LLAMA_EXAMPLE_MAIN); |
no test coverage detected