Skip to content

Commit

Permalink
Adjust dependency of gradio server (#236)
Browse files Browse the repository at this point in the history
* import if lib directory exists

* only modify app.py
  • Loading branch information
AllentDan authored Aug 16, 2023
1 parent f06db80 commit 0d21f36
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lmdeploy/serve/gradio/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
from lmdeploy.model import MODELS
from lmdeploy.serve.gradio.css import CSS
from lmdeploy.serve.turbomind.chatbot import Chatbot
from lmdeploy.turbomind.chat import valid_str
from lmdeploy.turbomind.tokenizer import Tokenizer

THEME = gr.themes.Soft(
primary_hue=gr.themes.colors.blue,
Expand Down Expand Up @@ -169,6 +167,7 @@ def chat_stream_local(
nth_round (gr.State): round num
request (gr.Request): the request from a user
"""
from lmdeploy.turbomind.chat import valid_str
session_id = threading.current_thread().ident
if request is not None:
session_id = int(request.kwargs['client']['host'].replace('.', ''))
Expand Down Expand Up @@ -264,6 +263,7 @@ def run_local(model_path: str,
server_name (str): the ip address of gradio server
server_port (int): the port of gradio server
"""
from lmdeploy.turbomind.tokenizer import Tokenizer
InterFace.tokenizer_model_path = osp.join(model_path, 'triton_models',
'tokenizer')
InterFace.tokenizer = Tokenizer(InterFace.tokenizer_model_path)
Expand Down

0 comments on commit 0d21f36

Please sign in to comment.