MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / export_md

Function export_md

smallthinker/examples/gen-docs/gen-docs.cpp:50–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50static 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
78int main(int, char **) {
79 export_md("autogen-main.md", LLAMA_EXAMPLE_MAIN);

Callers 1

mainFunction · 0.85

Calls 4

write_tableFunction · 0.85
in_exampleMethod · 0.80
push_backMethod · 0.45

Tested by

no test coverage detected