Skip to content

Commit

Permalink
examples/main: minor token print filtering for LLaVA
Browse files Browse the repository at this point in the history
In ChatML mode, for Yi-34B llava-1.6, don't print <|im_end|>
  • Loading branch information
Nekotekina committed Feb 27, 2024
1 parent ce85323 commit d7747aa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,9 @@ int main(int argc, char ** argv) {
// display text
if (input_echo && display) {
for (auto id : embd) {
const std::string token_str = llama_token_to_piece(ctx, id);
std::string token_str = llama_token_to_piece(ctx, id);
if (params.chatml && token_str == "<|im_end|>")
token_str.clear();
printf("%s", token_str.c_str());

if (embd.size() > 1) {
Expand Down

0 comments on commit d7747aa

Please sign in to comment.