Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve docs #2438

Merged
merged 3 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 3 additions & 1 deletion docs/model_support.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@
- [openaccess-ai-collective/manticore-13b-chat-pyg](https://huggingface.co/openaccess-ai-collective/manticore-13b-chat-pyg)
- [OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5](https://huggingface.co/OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5)
- [VMware/open-llama-7b-v2-open-instruct](https://huggingface.co/VMware/open-llama-7b-v2-open-instruct)
- [Phind/Phind-CodeLlama-34B-v2](https://huggingface.co/Phind/Phind-CodeLlama-34B-v2)
- [project-baize/baize-v2-7b](https://huggingface.co/project-baize/baize-v2-7b)
- [Qwen/Qwen-7B-Chat](https://huggingface.co/Qwen/Qwen-7B-Chat)
- [Salesforce/codet5p-6b](https://huggingface.co/Salesforce/codet5p-6b)
- [StabilityAI/stablelm-tuned-alpha-7b](https://huggingface.co/stabilityai/stablelm-tuned-alpha-7b)
- [THUDM/chatglm-6b](https://huggingface.co/THUDM/chatglm-6b)
- [THUDM/chatglm2-6b](https://huggingface.co/THUDM/chatglm2-6b)
- [tiiuae/falcon-40b](https://huggingface.co/tiiuae/falcon-40b)
- [tiiuae/falcon-180B-chat](https://huggingface.co/tiiuae/falcon-180B-chat)
- [timdettmers/guanaco-33b-merged](https://huggingface.co/timdettmers/guanaco-33b-merged)
- [togethercomputer/RedPajama-INCITE-7B-Chat](https://huggingface.co/togethercomputer/RedPajama-INCITE-7B-Chat)
- [WizardLM/WizardLM-13B-V1.0](https://huggingface.co/WizardLM/WizardLM-13B-V1.0)
Expand Down Expand Up @@ -71,7 +73,7 @@ You can add `--debug` to see the actual prompt sent to the model.

FastChat uses the `Conversation` class to handle prompt templates and `BaseModelAdapter` class to handle model loading.

1. Implement a conversation template for the new model at [fastchat/conversation.py](https://github.com/lm-sys/FastChat/blob/main/fastchat/conversation.py). You can follow existing examples and use `register_conv_template` to add a new one.
1. Implement a conversation template for the new model at [fastchat/conversation.py](https://github.com/lm-sys/FastChat/blob/main/fastchat/conversation.py). You can follow existing examples and use `register_conv_template` to add a new one. Please also add a link to the official reference code if possible.
2. Implement a model adapter for the new model at [fastchat/model/model_adapter.py](https://github.com/lm-sys/FastChat/blob/main/fastchat/model/model_adapter.py). You can follow existing examples and use `register_model_adapter` to add a new one.
3. (Optional) add the model name to the "Supported models" [section](#supported-models) above and add more information in [fastchat/model/model_registry.py](https://github.com/lm-sys/FastChat/blob/main/fastchat/model/model_registry.py).

Expand Down
2 changes: 2 additions & 0 deletions fastchat/conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,7 @@ def get_conv_template(name: str) -> Conversation:
)

# Falcon 180B chat template
# source: https://huggingface.co/spaces/tiiuae/falcon-180b-demo/blob/d1590ee7fae9b6ce331ba7808e61a29dcce9239f/app.py#L28-L37
register_conv_template(
Conversation(
name="falcon-chat",
Expand All @@ -966,6 +967,7 @@ def get_conv_template(name: str) -> Conversation:
)

# Phind template
# source: https://huggingface.co/Phind/Phind-CodeLlama-34B-v2
register_conv_template(
Conversation(
name="phind",
Expand Down
24 changes: 12 additions & 12 deletions fastchat/model/model_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ def match(self, model_path: str):


class KoalaAdapter(BaseModelAdapter):
"""The model adapter for koala"""
"""The model adapter for Koala"""

use_fast_tokenizer = False

Expand All @@ -677,7 +677,7 @@ def get_default_conv_template(self, model_path: str) -> Conversation:


class AlpacaAdapter(BaseModelAdapter):
"""The model adapter for alpaca"""
"""The model adapter for Alpaca"""

use_fast_tokenizer = False

Expand Down Expand Up @@ -1267,7 +1267,7 @@ def get_default_conv_template(self, model_path: str) -> Conversation:


class Llama2Adapter(BaseModelAdapter):
"""The model adapter for llama-2"""
"""The model adapter for Llama-2 (e.g., meta-llama/Llama-2-7b-hf)"""

def match(self, model_path: str):
return "llama-2" in model_path.lower()
Expand All @@ -1283,7 +1283,7 @@ def get_default_conv_template(self, model_path: str) -> Conversation:


class CuteGPTAdapter(BaseModelAdapter):
"""The model adapter for llama-2"""
"""The model adapter for CuteGPT"""

def match(self, model_path: str):
return "cutegpt" in model_path.lower()
Expand Down Expand Up @@ -1327,7 +1327,7 @@ def get_default_conv_template(self, model_path: str) -> Conversation:


class WizardCoderAdapter(BaseModelAdapter):
"""The model adapter for WizardCoder"""
"""The model adapter for WizardCoder (e.g., WizardLM/WizardCoder-Python-34B-V1.0)"""

use_fast_tokenizer = False

Expand Down Expand Up @@ -1401,7 +1401,7 @@ def get_default_conv_template(self, model_path: str) -> Conversation:


class BGEAdapter(BaseModelAdapter):
"""The model adapter for BGE"""
"""The model adapter for BGE (e.g., BAAI/bge-large-en-v1.5)"""

use_fast_tokenizer = False

Expand Down Expand Up @@ -1430,7 +1430,7 @@ def get_default_conv_template(self, model_path: str) -> Conversation:


class E5Adapter(BaseModelAdapter):
"""The model adapter for E5"""
"""The model adapter for E5 (e.g., intfloat/e5-large-v2)"""

use_fast_tokenizer = False

Expand Down Expand Up @@ -1508,7 +1508,7 @@ def get_default_conv_template(self, model_path: str) -> Conversation:


class VigogneInstructAdapter(BaseModelAdapter):
"""The model adapter for Vigogne-Instruct"""
"""The model adapter for Vigogne-Instruct (e.g., bofenghuang/vigogne-2-7b-instruct)"""

use_fast_tokenizer = False

Expand Down Expand Up @@ -1536,7 +1536,7 @@ def get_default_conv_template(self, model_path: str) -> Conversation:


class VigogneChatAdapter(BaseModelAdapter):
"""The model adapter for Vigogne-Chat"""
"""The model adapter for Vigogne-Chat (e.g., bofenghuang/vigogne-7b-chat)"""

use_fast_tokenizer = False

Expand Down Expand Up @@ -1564,7 +1564,7 @@ def get_default_conv_template(self, model_path: str) -> Conversation:


class OpenLLaMaOpenInstructAdapter(BaseModelAdapter):
"""The model adapter for OpenLLaMa-Open-Instruct"""
"""The model adapter for OpenLLaMa-Open-Instruct (e.g., VMware/open-llama-7b-open-instruct)"""

use_fast_tokenizer = False

Expand Down Expand Up @@ -1594,7 +1594,7 @@ def get_default_conv_template(self, model_path: str) -> Conversation:


class CodeLlamaAdapter(BaseModelAdapter):
"""The model adapter for Code Llama"""
"""The model adapter for CodeLlama (e.g., codellama/CodeLlama-34b-hf)"""

def match(self, model_path: str):
return "codellama" in model_path.lower()
Expand All @@ -1610,7 +1610,7 @@ def get_default_conv_template(self, model_path: str) -> Conversation:


class PhindCodeLlamaAdapter(CodeLlamaAdapter):
"""The model adapter for Phind Code Llama"""
"""The model adapter for Phind-CodeLlama (e.g., Phind/Phind-CodeLlama-34B-v2)"""

def match(self, model_path: str):
return "phind-codellama-" in model_path.lower()
Expand Down
11 changes: 9 additions & 2 deletions fastchat/model/model_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,16 @@ def get_model_info(name: str) -> ModelInfo:
"A chatbot fine-tuned from RedPajama-INCITE-7B-Base by Together",
)
register_model_info(
["falcon-7b", "falcon-7b-instruct", "falcon-40b", "falcon-40b-instruct"],
[
"falcon-7b",
"falcon-7b-instruct",
"falcon-40b",
"falcon-40b-instruct",
"falcon-180b",
"falcon-180b-chat",
],
"Falcon",
"https://huggingface.co/tiiuae/falcon-40b",
"https://huggingface.co/tiiuae/falcon-180B",
"TII's flagship series of large language models",
)
register_model_info(
Expand Down