Minor visual changes to prints and code cleanup

This commit is contained in:
Angel-HF
2024-04-16 18:32:31 +02:00
committed by Pelochus
parent a02e69f46e
commit 20a9f1e0f6

View File

@@ -27,18 +27,17 @@
#define PROMPT_TEXT_POSTFIX "<|im_end|><|im_start|>assistant" #define PROMPT_TEXT_POSTFIX "<|im_end|><|im_start|>assistant"
using namespace std; using namespace std;
LLMHandle llmHandle = nullptr; LLMHandle llmHandle = nullptr;
void exit_handler(int signal) void exit_handler(int signal)
{ {
if (llmHandle != nullptr) if (llmHandle != nullptr)
{
{ {
cout << "Catched exit signal. Exiting..." << endl; cout << "Catched exit signal. Exiting..." << endl;
LLMHandle _tmp = llmHandle; LLMHandle _tmp = llmHandle;
llmHandle = nullptr; llmHandle = nullptr;
rkllm_destroy(_tmp); rkllm_destroy(_tmp);
}
exit(signal); exit(signal);
} }
} }
@@ -90,14 +89,14 @@ int main(int argc, char **argv)
pre_input.push_back("\nMore information here: https://github.com/Pelochus/ezrknpu"); pre_input.push_back("\nMore information here: https://github.com/Pelochus/ezrknpu");
pre_input.push_back("\nDetailed information for devs here: https://github.com/Pelochus/ezrknn-llm"); pre_input.push_back("\nDetailed information for devs here: https://github.com/Pelochus/ezrknn-llm");
cout << "\n************************ Pelochus' ezrkllm runtime **********************\n" << endl; cout << "\n*************************** Pelochus' ezrkllm runtime *************************\n" << endl;
for (int i = 0; i < (int)pre_input.size(); i++) for (int i = 0; i < (int)pre_input.size(); i++)
{ {
cout << "[" << i << "] " << pre_input[i] << endl; cout << pre_input[i];
} }
cout << "\n*************************************************************************\n" << endl; cout << "\n*******************************************************************************\n" << endl;
string text; string text;
while (true) while (true)
@@ -123,7 +122,7 @@ int main(int argc, char **argv)
} }
string text = PROMPT_TEXT_PREFIX + input_str + PROMPT_TEXT_POSTFIX; string text = PROMPT_TEXT_PREFIX + input_str + PROMPT_TEXT_POSTFIX;
printf("LLM Model: "); printf("LLM: ");
rkllm_run(llmHandle, text.c_str(), NULL); rkllm_run(llmHandle, text.c_str(), NULL);
} }