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

Function main

examples/infill/infill.cpp:104–757  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102#endif
103
104int main(int argc, char ** argv) {
105 gpt_params params;
106 llama_sampling_params & sparams = params.sparams;
107 g_params = &params;
108
109 if (!gpt_params_parse(argc, argv, params)) {
110 return 1;
111 }
112
113#ifndef LOG_DISABLE_LOGS
114 log_set_target(log_filename_generator("infill", "log"));
115 LOG_TEE("Log start\n");
116 log_dump_cmdline(argc, argv);
117#endif // LOG_DISABLE_LOGS
118
119 console::init(params.simple_io, params.use_color);
120 atexit([]() { console::cleanup(); });
121
122 if (params.logits_all) {
123 printf("\n************\n");
124 printf("%s: please use the 'perplexity' tool for perplexity calculations\n", __func__);
125 printf("************\n\n");
126
127 return 0;
128 }
129
130 if (params.embedding) {
131 printf("\n************\n");
132 printf("%s: please use the 'embedding' tool for embedding calculations\n", __func__);
133 printf("************\n\n");
134
135 return 0;
136 }
137
138 if (params.n_ctx != 0 && params.n_ctx < 8) {
139 LOG_TEE("%s: warning: minimum context size is 8, using minimum size.\n", __func__);
140 params.n_ctx = 8;
141 }
142 if (params.instruct) {
143 printf("\n************\n");
144 printf("%s: please use the 'main' tool for instruct mode\n", __func__);
145 printf("************\n\n");
146
147 return 0;
148 }
149 if (!params.antiprompt.empty()) {
150 printf("\n************\n");
151 printf("%s: please use the 'main' tool for antiprompt mode\n", __func__);
152 printf("************\n\n");
153
154 return 0;
155 }
156 if (!params.interactive_first && (params.input_prefix.empty() && params.input_suffix.empty())) {
157 printf("\n************\n");
158 printf("%s: please use '--interactive_first' or specify '--in_prefix' and/or '--in_suffix'\n", __func__);
159 printf("************\n\n");
160
161 return 0;

Callers

nothing calls this directly

Calls 15

gpt_params_parseFunction · 0.85
printfFunction · 0.85
get_system_infoFunction · 0.85
llama_token_prefixFunction · 0.85
llama_token_suffixFunction · 0.85
llama_token_middleFunction · 0.85
LOG_TOKENS_TOSTR_PRETTYFunction · 0.85
llama_sampling_printFunction · 0.85
llama_sampling_initFunction · 0.85
llama_kv_cache_seq_rmFunction · 0.85

Tested by

no test coverage detected