Browse Source

hotfix edge case where we try to render before tokenizer is set

Alex Cheema 10 months ago
parent
commit
85279007b3
1 changed files with 1 additions and 2 deletions
  1. 1 2
      main.py

+ 1 - 2
main.py

@@ -89,8 +89,7 @@ api = ChatGPTAPI(
   on_chat_completion_request=lambda req_id, __, prompt: topology_viz.update_prompt(req_id, prompt) if topology_viz else None
 )
 node.on_token.register("update_topology_viz").on_next(
-  lambda req_id, tokens, __: topology_viz.update_prompt_output(req_id,
-                                                               inference_engine.tokenizer.decode(tokens) if hasattr(inference_engine, "tokenizer") else tokens) if topology_viz else None
+  lambda req_id, tokens, __: topology_viz.update_prompt_output(req_id, inference_engine.tokenizer.decode(tokens)) if topology_viz and hasattr(inference_engine, "tokenizer") else None
 )