Skip to content

Commit

Permalink
Update gradio web server
Browse files Browse the repository at this point in the history
  • Loading branch information
merrymercy committed Sep 19, 2023
1 parent 3bbc68d commit 3157116
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
6 changes: 5 additions & 1 deletion fastchat/model/model_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ def register_model_info(


def get_model_info(name: str) -> ModelInfo:
return model_info[name]
if name in model_info:
return model_info[name]
else:
# To fix this, please use `register_model_info` to register your model
return ModelInfo(name, "", "Register the description at fastchat/model/model_registry.py")


register_model_info(
Expand Down
18 changes: 6 additions & 12 deletions fastchat/serve/gradio_web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
SESSION_EXPIRATION_TIME,
)
from fastchat.model.model_adapter import get_conversation_template
from fastchat.model.model_registry import model_info
from fastchat.model.model_registry import get_model_info
from fastchat.serve.api_provider import (
anthropic_api_stream_iter,
openai_api_stream_iter,
Expand Down Expand Up @@ -530,17 +530,11 @@ def get_model_description_md(models):
ct = 0
visited = set()
for i, name in enumerate(models):
if name in model_info:
minfo = model_info[name]
if minfo.simple_name in visited:
continue
visited.add(minfo.simple_name)
one_model_md = f"[{minfo.simple_name}]({minfo.link}): {minfo.description}"
else:
visited.add(name)
one_model_md = (
f"[{name}](): Add the description at fastchat/model/model_registry.py"
)
minfo = get_model_info(name)
if minfo.simple_name in visited:
continue
visited.add(minfo.simple_name)
one_model_md = f"[{minfo.simple_name}]({minfo.link}): {minfo.description}"

if ct % 3 == 0:
model_description_md += "|"
Expand Down

0 comments on commit 3157116

Please sign in to comment.