Spaces:
Running
Running
:zap: [Enhance] Add new model yi-1.5-34b, and remove unavailable models
Browse filesFiles changed (3)
63 unmodified lines6465666768697063 unmodified linesraise INVALID_API_KEY_ERRORclass ChatCompletionsPostItem(BaseModel):model: str = Field(default="nous-mixtral-8x7b",description="(str) `nous-mixtral-8x7b`",63 unmodified lines64656667686963 unmodified linesraise INVALID_API_KEY_ERRORclass ChatCompletionsPostItem(BaseModel):model: str = Field(default="nous-mixtral-8x7b",description="(str) `nous-mixtral-8x7b`",
1 unmodified line234567891011122 unmodified lines15161718192021222324252627282930313233343536373822 unmodified lines6162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061 unmodified line"mixtral-8x7b": "mistralai/Mixtral-8x7B-Instruct-v0.1", # [Recommended]"nous-mixtral-8x7b": "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO","mistral-7b": "mistralai/Mistral-7B-Instruct-v0.2",# "openchat-3.5": "openchat/openchat-3.5-0106","gemma-7b": "google/gemma-1.1-7b-it","command-r-plus": "CohereForAI/c4ai-command-r-plus","llama3-70b": "meta-llama/Meta-Llama-3-70B-Instruct","zephyr-141b": "HuggingFaceH4/zephyr-orpo-141b-A35b-v0.1","default": "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",}2 unmodified linesPRO_MODELS = ["command-r-plus", "llama3-70b", "zephyr-141b"]STOP_SEQUENCES_MAP = {"mixtral-8x7b": "</s>","nous-mixtral-8x7b": "<|im_end|>","mistral-7b": "</s>",# "openchat-3.5": "<|end_of_turn|>","gemma-7b": "<eos>","command-r-plus": "<|END_OF_TURN_TOKEN|>",}TOKEN_LIMIT_MAP = {"mixtral-8x7b": 32768,"nous-mixtral-8x7b": 32768,"mistral-7b": 32768,# "openchat-3.5": 8192,"gemma-7b": 8192,"command-r-plus": 32768,"llama3-70b": 8192,"zephyr-141b": 2048,"gpt-3.5-turbo": 8192,}TOKEN_RESERVED = 2022 unmodified lines"created": 1700000000,"owned_by": "mistralai",},# {# "id": "openchat-3.5",# "description": "[openchat/openchat-3.5-0106]: https://huggingface.co/openchat/openchat-3.5-0106",# "object": "model",# "created": 1700000000,# "owned_by": "openchat",# },{"id": "gemma-7b","description": "[google/gemma-1.1-7b-it]: https://huggingface.co/google/gemma-1.1-7b-it","object": "model","created": 1700000000,"owned_by": "Google",},{"id": "command-r-plus","description": "[CohereForAI/c4ai-command-r-plus]: https://huggingface.co/CohereForAI/c4ai-command-r-plus","object": "model","created": 1700000000,"owned_by": "CohereForAI",},{"id": "llama3-70b","description": "[meta-llama/Meta-Llama-3-70B]: https://huggingface.co/meta-llama/Meta-Llama-3-70B","object": "model","created": 1700000000,"owned_by": "Meta",},{"id": "zephyr-141b","description": "[HuggingFaceH4/zephyr-orpo-141b-A35b-v0.1]: https://huggingface.co/HuggingFaceH4/zephyr-orpo-141b-A35b-v0.1","object": "model","created": 1700000000,"owned_by": "Huggingface",},{"id": "gpt-3.5-turbo","description": "[openai/gpt-3.5-turbo]: https://platform.openai.com/docs/models/gpt-3-5-turbo","object": "model","created": 1700000000,"owned_by": "OpenAI",},]1 unmodified line23456789101112132 unmodified lines1617181920212223242526272829303132333435363738394041424344454622 unmodified lines697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211 unmodified line"mixtral-8x7b": "mistralai/Mixtral-8x7B-Instruct-v0.1", # [Recommended]"nous-mixtral-8x7b": "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO","mistral-7b": "mistralai/Mistral-7B-Instruct-v0.2","yi-1.5-34b": "01-ai/Yi-1.5-34B-Chat","gemma-7b": "google/gemma-1.1-7b-it",# "openchat-3.5": "openchat/openchat-3.5-0106",# "command-r-plus": "CohereForAI/c4ai-command-r-plus",# "llama3-70b": "meta-llama/Meta-Llama-3-70B-Instruct",# "zephyr-141b": "HuggingFaceH4/zephyr-orpo-141b-A35b-v0.1","default": "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",}2 unmodified linesPRO_MODELS = ["command-r-plus", "llama3-70b", "zephyr-141b"]STOP_SEQUENCES_MAP = {# https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1/blob/main/tokenizer_config.json#L33"mixtral-8x7b": "</s>",# https://huggingface.co/NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO/blob/main/tokenizer_config.json#L50"nous-mixtral-8x7b": "<|im_end|>",# https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2/blob/main/tokenizer_config.json#L33"mistral-7b": "</s>",# https://huggingface.co/01-ai/Yi-1.5-34B-Chat/blob/main/tokenizer_config.json#L42"yi-1.5-34b": "<|im_end|>",# https://huggingface.co/google/gemma-1.1-7b-it/blob/main/tokenizer_config.json#L1509"gemma-7b": "<eos>",# "openchat-3.5": "<|end_of_turn|>",# "command-r-plus": "<|END_OF_TURN_TOKEN|>",}TOKEN_LIMIT_MAP = {"mixtral-8x7b": 32768,"nous-mixtral-8x7b": 32768,"mistral-7b": 32768,"yi-1.5-34b": 4096,"gemma-7b": 8192,# "openchat-3.5": 8192,# "command-r-plus": 32768,# "llama3-70b": 8192,# "zephyr-141b": 2048,# "gpt-3.5-turbo": 8192,}TOKEN_RESERVED = 2022 unmodified lines"created": 1700000000,"owned_by": "mistralai",},{"id": "yi-1.5-34b","description": "[01-ai/Yi-1.5-34B-Chat]: https://huggingface.co/01-ai/Yi-1.5-34B-Chat","object": "model","created": 1700000000,"owned_by": "01-ai",},{"id": "gemma-7b","description": "[google/gemma-1.1-7b-it]: https://huggingface.co/google/gemma-1.1-7b-it","object": "model","created": 1700000000,"owned_by": "Google",},# {# "id": "openchat-3.5",# "description": "[openchat/openchat-3.5-0106]: https://huggingface.co/openchat/openchat-3.5-0106",# "object": "model",# "created": 1700000000,# "owned_by": "openchat",# },# {# "id": "command-r-plus",# "description": "[CohereForAI/c4ai-command-r-plus]: https://huggingface.co/CohereForAI/c4ai-command-r-plus",# "object": "model",# "created": 1700000000,# "owned_by": "CohereForAI",# },# {# "id": "llama3-70b",# "description": "[meta-llama/Meta-Llama-3-70B]: https://huggingface.co/meta-llama/Meta-Llama-3-70B",# "object": "model",# "created": 1700000000,# "owned_by": "Meta",# },# {# "id": "zephyr-141b",# "description": "[HuggingFaceH4/zephyr-orpo-141b-A35b-v0.1]: https://huggingface.co/HuggingFaceH4/zephyr-orpo-141b-A35b-v0.1",# "object": "model",# "created": 1700000000,# "owned_by": "Huggingface",# },# {# "id": "gpt-3.5-turbo",# "description": "[openai/gpt-3.5-turbo]: https://platform.openai.com/docs/models/gpt-3-5-turbo",# "object": "model",# "created": 1700000000,# "owned_by": "OpenAI",# },]
149 unmodified lines150151152153154155156157149 unmodified linesself.merged_str = "<bos>" + "\n".join(self.merged_str_list)# https://huggingface.co/NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO#prompt-format# https://huggingface.co/openchat/openchat-3.5-0106# elif self.model in ["openchat-3.5", "nous-mixtral-8x7b"]:elif self.model in ["openchat-3.5", "command-r-plus", "gemma-7b"]:tokenizer = AutoTokenizer.from_pretrained(self.model_fullname)self.merged_str = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True149 unmodified lines150151152153154155156157149 unmodified linesself.merged_str = "<bos>" + "\n".join(self.merged_str_list)# https://huggingface.co/NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO#prompt-format# https://huggingface.co/openchat/openchat-3.5-0106# https://huggingface.co/01-ai/Yi-1.5-34B-Chatelif self.model in ["openchat-3.5", "command-r-plus", "gemma-7b", "yi-1.5-34b"]:tokenizer = AutoTokenizer.from_pretrained(self.model_fullname)self.merged_str = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True
apis/chat_api.py-1
constants/models.py+60-45
messagers/message_composer.py+2-2