From a9b6236d9bea71d113fc8249e1dc6b7342230615 Mon Sep 17 00:00:00 2001 From: fluxlinkage Date: Wed, 10 Jul 2024 13:46:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8DWindows=E4=B8=8AMSVC?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=88=90=E5=8A=9F=E7=BC=96=E8=AF=91=E7=9A=84?= =?UTF-8?q?Bug=EF=BC=88=E5=8E=9F=E5=9B=A0=E6=98=AF=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E7=9A=84GetCurrentTime=E5=87=BD=E6=95=B0=E4=B8=8EVC?= =?UTF-8?q?=E5=86=85=E7=BD=AE=E5=87=BD=E6=95=B0=E9=87=8D=E5=90=8D=EF=BC=89?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/apiserver/apiserver.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/apiserver/apiserver.cpp b/example/apiserver/apiserver.cpp index 247ef016..f4d54e3f 100644 --- a/example/apiserver/apiserver.cpp +++ b/example/apiserver/apiserver.cpp @@ -121,7 +121,7 @@ using socket_t = int; #include #include "model.h" -long long GetCurrentTime() { +long long _GetCurrentTime() { auto now = std::chrono::high_resolution_clock::now(); auto duration = now.time_since_epoch(); return std::chrono::duration_cast(duration).count(); @@ -430,7 +430,7 @@ struct WorkQueue { } std::string curId = "fastllm-" + GenerateRandomID(); - auto createTime = GetCurrentTime(); + auto createTime = _GetCurrentTime(); if (isStream) { message = ""; From 1b504b34ee5d42b5c2f72a4a4c36bf6f9ea905c0 Mon Sep 17 00:00:00 2001 From: fluxlinkage Date: Thu, 11 Jul 2024 14:40:33 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BA=86Windows=E4=B8=8B?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E8=A1=8Cdemo=E7=A8=8B=E5=BA=8F=EF=BC=88main.?= =?UTF-8?q?exe=EF=BC=89=E4=B9=B1=E7=A0=81=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index a0bfa5d8..eb6aefdd 100644 --- a/main.cpp +++ b/main.cpp @@ -1,4 +1,7 @@ -#include "model.h" +#include "model.h" +#ifdef _WIN32 +#include +#endif std::map dataTypeDict = { {"float32", fastllm::DataType::FLOAT32}, @@ -89,6 +92,9 @@ void ParseArgs(int argc, char **argv, RunConfig &config, fastllm::GenerationConf } int main(int argc, char **argv) { +#ifdef _WIN32 + system("chcp 65001"); +#endif RunConfig config; fastllm::GenerationConfig generationConfig; ParseArgs(argc, argv, config, generationConfig); @@ -97,7 +103,7 @@ int main(int argc, char **argv) { fastllm::SetThreads(config.threads); fastllm::SetLowMemMode(config.lowMemMode); if (!fastllm::FileExists(config.path)) { - printf("模型文件 %s 不存在!\n", config.path.c_str()); + printf(u8"模型文件 %s 不存在!\n", config.path.c_str()); exit(0); } bool isHFDir = fastllm::FileExists(config.path + "/config.json") || fastllm::FileExists(config.path + "config.json"); @@ -114,10 +120,10 @@ int main(int argc, char **argv) { fastllm::ChatMessages messages = {{"system", systemConfig}}; static std::string modelType = model->model_type; - printf("欢迎使用 %s 模型. 输入内容对话,reset清空历史记录,stop退出程序.\n", model->model_type.c_str()); + printf(u8"欢迎使用 %s 模型. 输入内容对话,reset清空历史记录,stop退出程序.\n", model->model_type.c_str()); while (true) { - printf("用户: "); + printf(u8"用户: "); std::string input; std::getline(std::cin, input); if (input == "reset") { @@ -145,4 +151,4 @@ int main(int argc, char **argv) { } return 0; -} \ No newline at end of file +}