From a1d62e8e550b1cbd0c1d61b5a95576132f632271 Mon Sep 17 00:00:00 2001 From: Bernardo Ramos Date: Wed, 26 Jul 2023 00:58:12 +0000 Subject: [PATCH] omit the leading space on the first token --- run.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/run.c b/run.c index fc24dbdf..aba2b488 100644 --- a/run.c +++ b/run.c @@ -468,7 +468,12 @@ int main(int argc, char *argv[]) { // we now want to sample from this distribution to get the next token next = sample(state.logits, config.vocab_size); } - printf("%s", vocab[next]); + // omit the leading space on the first token + if (pos == 0 && vocab[next][0] == ' ') { + printf("%s", vocab[next] + 1); + } else { + printf("%s", vocab[next]); + } fflush(stdout); // advance forward