From 74e9e4191167c162f61a9e8334cfe2445dd41d83 Mon Sep 17 00:00:00 2001 From: Czxck001 <10724409+Czxck001@users.noreply.github.com> Date: Sat, 29 Jun 2024 12:34:42 -0700 Subject: [PATCH] make up for the missing last token output of phi2 example (#2299) --- candle-examples/examples/phi/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/candle-examples/examples/phi/main.rs b/candle-examples/examples/phi/main.rs index 1cfeb443..1a0d9aca 100644 --- a/candle-examples/examples/phi/main.rs +++ b/candle-examples/examples/phi/main.rs @@ -114,6 +114,10 @@ impl TextGeneration { tokens.push(next_token); generated_tokens += 1; if next_token == eos_token { + if let Some(t) = self.tokenizer.decode_rest()? { + print!("{t}"); + std::io::stdout().flush()?; + } break; } if let Some(t) = self.tokenizer.next_token(next_token)? {