-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Mistral support Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> * ci: auto fixes from pre-commit.ci For more information, see https://pre-commit.ci * chore: fix style Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> * chore: update README docs about mistral Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> --------- Signed-off-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
d9a7b6a
commit 4d356f4
Showing
7 changed files
with
100 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
openllm-core/src/openllm_core/config/configuration_mistral.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from __future__ import annotations | ||
|
||
import openllm_core | ||
|
||
START_MISTRAL_COMMAND_DOCSTRING = '''\ | ||
Run a LLMServer for Mistral model. | ||
\b | ||
> See more information about Mistral at [mistralai/Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) | ||
\b | ||
## Usage | ||
By default, this model will use the PyTorch model for inference. However, if vLLM exists, then it will use vLLM instead. | ||
\b | ||
- To use vLLM, set the environment variable ``OPENLLM_BACKEND="vllm"`` | ||
\b | ||
Mistral Runner will use mistralai/Mistral-7B-Instruct-v0.1 as the default model. To change to any other Mistral | ||
saved pretrained, or a fine-tune Mistral, provide ``OPENLLM_MODEL_ID='HuggingFaceH4/zephyr-7b-alpha'`` | ||
or provide `--model-id` flag when running ``openllm start mistral``: | ||
\b | ||
$ openllm start mistral --model-id HuggingFaceH4/zephyr-7b-alpha | ||
''' | ||
DEFAULT_PROMPT_TEMPLATE = '''{instruction}''' | ||
|
||
class MistralConfig(openllm_core.LLMConfig): | ||
"""Mistral's [paper](https://arxiv.org/abs/2310.06825) and first released by [MistralAI](https://mistral.ai/news/announcing-mistral-7b/). | ||
Mistral-7B-v0.1 is Mistral AI\'s first Large Language Model (LLM). | ||
Refer to [Mistral's HuggingFace page](https://huggingface.co/docs/transformers/v4.35.0/en/model_doc/mistral#overview) for more information. | ||
""" | ||
__config__ = { | ||
'name_type': 'lowercase', | ||
'url': 'https://huggingface.co/docs/transformers/v4.35.0/en/model_doc/mistral#overview', | ||
'default_id': 'mistralai/Mistral-7B-Instruct-v0.1', | ||
'architecture': 'MistralForCausalLM', | ||
'model_ids': ['mistralai/Mistral-7B-v0.1', 'mistralai/Mistral-7B-Instruct-v0.1', 'amazon/MistralLite', 'HuggingFaceH4/zephyr-7b-beta', 'HuggingFaceH4/zephyr-7b-alpha'], | ||
} | ||
|
||
class GenerationConfig: | ||
top_k: int = 12 | ||
temperature: float = 0.75 | ||
max_new_tokens: int = 256 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters