From 4e24dedb0a85958c98669929e2d62a27d07dddb6 Mon Sep 17 00:00:00 2001 From: b4rtaz Date: Sat, 1 Jun 2024 00:40:43 +0200 Subject: [PATCH] fix: tokenizer error message. --- src/apps/dllama-api/dllama-api.cpp | 5 ----- src/tokenizer.cpp | 6 +++++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/apps/dllama-api/dllama-api.cpp b/src/apps/dllama-api/dllama-api.cpp index d9887d0..ec013db 100644 --- a/src/apps/dllama-api/dllama-api.cpp +++ b/src/apps/dllama-api/dllama-api.cpp @@ -404,11 +404,6 @@ void handleModelsRequest(HttpRequest& request) { } void server(Inference* inference, SocketPool* socketPool, Tokenizer *tokenizer, Sampler *sampler, AppArgs* args, TransformerSpec* spec) { - if (tokenizer->chatEosId < 0) { - printf("⛔ 0.8.0 version introduced a new format of the tokenizer that includes chatEosId. Please update your tokenizer.\n"); - exit(EXIT_FAILURE); - } - SocketServer* server = new SocketServer(args->port); TokenizerStops stops(tokenizer); diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp index 3d189de..93f41f4 100644 --- a/src/tokenizer.cpp +++ b/src/tokenizer.cpp @@ -416,7 +416,11 @@ void Sampler::setSeed(unsigned long long seed) { } TokenizerStops::TokenizerStops(Tokenizer* tokenizer) { - assert(tokenizer->nChatTemplates == 6); + if (tokenizer->nChatTemplates != 6) { + printf("⛔ 0.8.0 version introduced a new format of the tokenizer that includes the chat template. Please update your tokenizer.\n"); + exit(EXIT_FAILURE); + } + const bool hasExtraStop = tokenizer->chatTemplate[5][0] != '\0'; nStops = hasExtraStop ? 2 : 1; char** s = new char*[nStops];