Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix docs
  • Loading branch information
merrymercy committed Oct 2, 2023
commit ed25c414d64173060f54f23fa33f97a400f38cfc
13 changes: 7 additions & 6 deletions fastchat/serve/huggingface_api_worker.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
"""
A model worker to call huggingface api.
JSON file format:
A model worker that calls huggingface inference endpoint.

Register models in a JSON file with the following format:
{
"falcon-180b-chat": {
"model_path": "tiiuae/falcon-180B-chat",
"api_base": "https://api-inference.huggingface.co/models",
"token": "hf_xxx",
"context_length": 2048
"context_length": 2048,
"model_names": "falcon-180b-chat",
"conv_template": null,
"conv_template": null
}
}

Only "model_path", "api_base", and "token" are necessary, others are optional.
"model_path", "api_base", "token", and "context_length" are necessary, while others are optional.
"""
import argparse
import asyncio
Expand Down Expand Up @@ -312,7 +313,7 @@ def create_huggingface_api_worker():
api_base_list.append(model_info[m]["api_base"])
token_list.append(model_info[m]["token"])

context_length = model_info[m].get("context_length", 1024)
context_length = model_info[m]["context_length"]
model_names = model_info[m].get("model_names", [m.split("/")[-1]])
if isinstance(model_names, str):
model_names = [model_names]
Expand Down