Browse Source

trim off the eos_token_id from chatgpt api response

Alex Cheema 1 year ago
parent
commit
9759408a67
1 changed files with 2 additions and 0 deletions
  1. 2 0
      exo/api/chatgpt_api.py

+ 2 - 0
exo/api/chatgpt_api.py

@@ -64,6 +64,8 @@ class ChatGPTAPI:
                 continue
             await asyncio.sleep(0.1)
             if is_finished:
+                if result[-1] == tokenizer._tokenizer.eos_token_id:
+                    result = result[:-1]
                 return web.json_response({
                     "id": f"chatcmpl-{request_id}",
                     "object": "chat.completion",