oobabooga / text-generation-webui

A Gradio web UI for Large Language Models.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OpenAI API endpoint v1/completions won't load model after unload unlike v1/chat/completions

Originalimoc opened this issue · comments

Describe the bug

Enable model auto unload then in the unloaded state call v1/completions will result in No Tokenizer Loaded error because it won't auto load back like v1/chat/completions

Is there an existing issue for this?

  • I have searched the existing issues

Reproduction

Above

Screenshot

No response

Logs

Above

System Info

WSL2

I'm getting the same error message. I'm using a fresh install of the latest release (v1.16) on windows.
I've posted the relevant console logs below.

12:08:04-495353 INFO     Unloading the model for inactivity.
Exception in ASGI application
Traceback (most recent call last):
  File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\sse_starlette\sse.py", line 247, in __call__
    await wrap(partial(self.listen_for_disconnect, receive))
  File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\sse_starlette\sse.py", line 236, in wrap
    await func()
  File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\sse_starlette\sse.py", line 191, in listen_for_disconnect
    message = await receive()
              ^^^^^^^^^^^^^^^
  File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 534, in receive
    await self.message_event.wait()
  File "P:\AI\oobabooga\installer_files\env\Lib\asyncio\locks.py", line 213, in wait
    await fut
asyncio.exceptions.CancelledError: Cancelled by cancel scope 22f631f7290

During handling of the above exception, another exception occurred:

  + Exception Group Traceback (most recent call last):
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 406, in run_asgi
  |     result = await app(  # type: ignore[func-returns-value]
  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 60, in __call__
  |     return await self.app(scope, receive, send)
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\fastapi\applications.py", line 1054, in __call__
  |     await super().__call__(scope, receive, send)
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\starlette\applications.py", line 113, in __call__
  |     await self.middleware_stack(scope, receive, send)
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\starlette\middleware\errors.py", line 187, in __call__
  |     raise exc
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\starlette\middleware\errors.py", line 165, in __call__
  |     await self.app(scope, receive, _send)
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\starlette\middleware\cors.py", line 85, in __call__
  |     await self.app(scope, receive, send)
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in __call__
  |     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\starlette\_exception_handler.py", line 62, in wrapped_app
  |     raise exc
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\starlette\_exception_handler.py", line 51, in wrapped_app
  |     await app(scope, receive, sender)
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\starlette\routing.py", line 715, in __call__
  |     await self.middleware_stack(scope, receive, send)
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\starlette\routing.py", line 735, in app
  |     await route.handle(scope, receive, send)
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\starlette\routing.py", line 288, in handle
  |     await self.app(scope, receive, send)
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\starlette\routing.py", line 76, in app
  |     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\starlette\_exception_handler.py", line 62, in wrapped_app
  |     raise exc
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\starlette\_exception_handler.py", line 51, in wrapped_app
  |     await app(scope, receive, sender)
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\starlette\routing.py", line 74, in app
  |     await response(scope, receive, send)
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\sse_starlette\sse.py", line 233, in __call__
  |     async with anyio.create_task_group() as task_group:
  |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\anyio\_backends\_asyncio.py", line 763, in __aexit__
  |     raise BaseExceptionGroup(
  | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\sse_starlette\sse.py", line 236, in wrap
    |     await func()
    |   File "P:\AI\oobabooga\installer_files\env\Lib\site-packages\sse_starlette\sse.py", line 221, in stream_response
    |     async for data in self.body_iterator:
    |   File "P:\AI\oobabooga\extensions\openai\script.py", line 106, in generator
    |     for resp in response:
    |   File "P:\AI\oobabooga\extensions\openai\completions.py", line 559, in stream_completions
    |     for resp in completions_common(body, is_legacy, stream=True):
    |   File "P:\AI\oobabooga\extensions\openai\completions.py", line 485, in completions_common
    |     token_count = len(encode(prompt)[0])
    |                       ^^^^^^^^^^^^^^
    |   File "P:\AI\oobabooga\modules\text_generation.py", line 133, in encode
    |     raise ValueError('No tokenizer is loaded')
    | ValueError: No tokenizer is loaded
    +------------------------------------