updated lite, up ver, remove bell

This commit is contained in:
Concedo 2023-08-10 22:01:33 +08:00
parent c5f5209d37
commit 886f4eed79
3 changed files with 19 additions and 8 deletions

View file

@ -334,6 +334,13 @@ static std::string FileFormatTokenizeID(int id, FileFormat file_format)
} }
} }
static std::string RemoveBell(const std::string & input) //removes the bell character
{
std::string word2;
std::remove_copy(input.begin(), input.end(), std::back_inserter(word2), '\a');
return word2;
}
ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in_file_format) ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in_file_format)
{ {
ggml_time_init(); ggml_time_init();
@ -1183,7 +1190,7 @@ generation_outputs gpttype_generate(const generation_inputs inputs, generation_o
} }
::utreplace(tmp, "\n", "\\n"); ::utreplace(tmp, "\n", "\\n");
outstr += tmp; outstr += tmp;
printf("%s\n\n", outstr.c_str()); printf("%s\n\n", RemoveBell(outstr).c_str());
} }
while (remaining_tokens > 0) while (remaining_tokens > 0)
@ -1446,7 +1453,7 @@ generation_outputs gpttype_generate(const generation_inputs inputs, generation_o
firstloop = false; firstloop = false;
std::string tokenizedstr = FileFormatTokenizeID(pick.id, file_format); std::string tokenizedstr = FileFormatTokenizeID(pick.id, file_format);
::utreplace(tokenizedstr, "\n", "\\n"); ::utreplace(tokenizedstr, "\n", "\\n");
printf("(%s %.2f%%)", tokenizedstr.c_str(), pick.p*100); printf("(%s %.2f%%)", RemoveBell(tokenizedstr).c_str(), pick.p*100);
} }
printf("]\n"); printf("]\n");
} }

File diff suppressed because one or more lines are too long

View file

@ -292,6 +292,7 @@ def utfprint(str):
except UnicodeEncodeError: except UnicodeEncodeError:
# Replace or omit the problematic character # Replace or omit the problematic character
utf_string = str.encode('ascii', 'ignore').decode('ascii') utf_string = str.encode('ascii', 'ignore').decode('ascii')
utf_string = utf_string.replace('\a', '') #remove bell characters
print(utf_string) print(utf_string)
################################################################# #################################################################
@ -304,7 +305,7 @@ maxhordectx = 1024
maxhordelen = 256 maxhordelen = 256
modelbusy = threading.Lock() modelbusy = threading.Lock()
defaultport = 5001 defaultport = 5001
KcppVersion = "1.40.1" KcppVersion = "1.41"
showdebug = True showdebug = True
showsamplerwarning = True showsamplerwarning = True
showmaxctxwarning = True showmaxctxwarning = True