File size: 9,170 Bytes
3f608c6
 
 
2843be3
b9a642a
3b00a19
9e58b03
166f484
9e58b03
 
214fb7b
55ab28a
 
 
 
 
67484b8
b776ce5
 
3f608c6
bf8c5bd
3965e1f
bf8c5bd
4a4b7c0
 
 
06e3150
bf8c5bd
b9a642a
bf8c5bd
b9a642a
bf8c5bd
b9a642a
bf8c5bd
b9a642a
 
 
bf8c5bd
9e58b03
166f484
9e58b03
60f8351
55ab28a
 
 
302bcc8
3e73fc6
55ab28a
 
67484b8
b776ce5
 
bf8c5bd
 
 
 
 
ff12c57
 
bf8c5bd
b9a642a
bf8c5bd
9e58b03
 
 
 
 
55ab28a
 
 
d3f75b3
b776ce5
 
bf8c5bd
 
 
40ba0ea
55ab28a
40ba0ea
 
 
 
 
 
55ab28a
40ba0ea
 
 
 
 
 
 
55ab28a
40ba0ea
 
 
 
 
 
 
55ab28a
40ba0ea
bcf3537
b9a642a
 
bcf3537
 
b9a642a
67484b8
bcf3537
cd6b52a
b9a642a
 
cd6b52a
 
b9a642a
55ab28a
cd6b52a
9e58b03
 
 
 
 
55ab28a
 
9e58b03
 
 
 
 
 
55ab28a
 
9e58b03
 
 
 
 
 
55ab28a
 
9e58b03
 
 
 
 
 
55ab28a
 
9e58b03
 
 
 
 
 
55ab28a
 
9e58b03
 
55ab28a
88dd848
9e58b03
 
55ab28a
 
d828201
 
 
 
 
 
55ab28a
 
d828201
 
55ab28a
d828201
 
 
55ab28a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d828201
67484b8
 
 
 
 
 
 
 
b776ce5
 
 
 
 
 
 
 
55ab28a
 
 
 
7a2c0f2
 
 
 
 
 
 
 
 
 
 
 
 
 
55ab28a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40ba0ea
55ab28a
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
MODEL_MAP = {
    "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.3",
    "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-4bit",
    "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",
    "qwen2-72b": "Qwen/Qwen2-72B-Instruct",
    "qwen2-7b-instruct": "Qwen/Qwen2-7B-Instruct",
    "qwen2-1.5b-instruct" : "Qwen/Qwen2-1.5B-Instruct",
    "llama3-8b" : "meta-llama/Meta-Llama-3-8B-Instruct",
    "mistral-nemo-instruct":"mistralai/Mistral-Nemo-Instruct-2407",
    "zephyr-7b-beta":"HuggingFaceH4/zephyr-7b-beta",
    "phi-3-mini-instruct":"microsoft/Phi-3-mini-4k-instruct",
    "falcon-7b-instruct":"tiiuae/falcon-7b-instruct"
}

AVAILABLE_MODELS = list(MODEL_MAP.keys())

# PRO_MODELS = ["command-r-plus", "llama3-70b", "zephyr-141b", "Qwen2-72B"]
PRO_MODELS = []


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|>",
    # https://huggingface.co/CohereForAI/c4ai-command-r-plus-4bit/blob/main/tokenizer_config.json#L305
    "command-r-plus": "<|END_OF_TURN_TOKEN|>",
    # https://huggingface.co/Qwen/Qwen2-72B-Instruct/blob/main/tokenizer_config.json#L30
    "qwen2-72b": "<|im_end|>",
    "qwen2-7b-instruct": "<|im_end|>",
    "qwen2-1.5b-instruct": "<|im_end|>", 
    
    "llama3-8b" : "<|eot_id|>",
    "llama3-70b" : "<|eot_id|>",
    "mistral-nemo-instruct": "</s>",
    "zephyr-7b-beta":"</s>",
    "phi-3-mini-instruct":"<|end|>",
    "falcon-7b-instruct":"<|endoftext|>"
}

TOKEN_LIMIT_MAP = {
    "mixtral-8x7b": 32768,
    "nous-mixtral-8x7b": 32768,
    "mistral-nemo-instruct":32768,
    "zephyr-7b-beta":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,
    "qwen2-72b": 32768,
    "qwen2-7b-instruct": 32768,
    "qwen2-1.5b-instruct": 32768,
    "llama3-8b": 8192,
    "phi-3-mini-instruct":4096,
    "falcon-7b-instruct":2048
}

TOKEN_RESERVED = 20

LLM_MODELS_DICTS = [
    {
        "id": "mixtral-8x7b",
        "description": "[mistralai/Mixtral-8x7B-Instruct-v0.1]: https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1",
        "object": "model",
        "created": 1700000000,
        "owned_by": "mistralai",
        "type": "basic",
    },
    {
        "id": "nous-mixtral-8x7b",
        "description": "[NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO]: https://huggingface.co/NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
        "object": "model",
        "created": 1700000000,
        "owned_by": "NousResearch",
        "type": "basic",
    },
    {
        "id": "mistral-7b",
        "description": "[mistralai/Mistral-7B-Instruct-v0.2]: https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2",
        "object": "model",
        "created": 1700000000,
        "owned_by": "mistralai",
        "type": "basic",
    },
    {
        "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",
        "type": "basic",
    },
    {
        "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",
        "type": "basic",
    },
    {
        "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",
        "type": "basic",
    },
    {
        "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",
        "type": "pro",
    },
    {
        "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",
        "type": "pro",
    },
    {
        "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",
        "type": "pro",
    },
    {
        "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",
        "type": "subscription",
    },
    {
        "id": "qwen2-72b",
        "description": "[Qwen/Qwen2-72B]: https://huggingface.co/Qwen/Qwen2-72B",
        "object": "model",
        "created": 1700000000,
        "owned_by": "Qwen",
        "type": "pro",
    },
    {
        "id": "llama3-8b",
        "description": "[meta-llama/Meta-Llama-3-8B]: https://huggingface.co/meta-llama/Meta-Llama-3-8B",
        "object": "model",
        "created": 1700000000,
        "owned_by": "Meta",
        "type": "basic",
    },
    {
        "id": "qwen2-1.5b-instruct",
        "description": "[Qwen/Qwen2-1.5B-Instruct]: https://huggingface.co/Qwen/Qwen2-1.5B-Instruct",
        "object": "model",
        "created": 1700000000,
        "owned_by": "Qwen",
        "type": "basic",
    },
    {
        "id": "mistral-nemo-instruct",
        "description": "[mistralai/Mistral-Nemo-Instruct-2407]: https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407",
        "object": "model",
        "created": 1700000000,
        "owned_by": "mistralai",
        "type": "basic",
    },
    {
        "id": "zephyr-7b-beta",
        "description": "[HuggingFaceH4/zephyr-7b-beta]: https://huggingface.co/HuggingFaceH4/zephyr-7b-beta",
        "object": "model",
        "created": 1700000000,
        "owned_by": "HuggingFaceH4",
        "type": "basic",
    },
    {
        "id": "phi-3-mini-instruct",
        "description": "[microsoft/Phi-3-mini-4k-instruct]: https://huggingface.co/microsoft/Phi-3-mini-4k-instruct",
        "object": "model",
        "created": 1700000000,
        "owned_by": "microsoft",
        "type": "basic",
    },
    {
        "id": "falcon-7b-instruct",
        "description": "[tiiuae/falcon-7b-instruct]: https://huggingface.co/tiiuae/falcon-7b-instruct",
        "object": "model",
        "created": 1700000000,
        "owned_by": "tiiuae",
        "type": "basic",
    },
]


EMBEDDINGS_MODELS_DICTS = [
    {
        "id": "nomic-text-embed",
        "description": "[nomic-ai/nomic-embed-text-v1.5]: https://huggingface.co/nomic-ai/nomic-embed-text-v1.5",
        "object": "embeddings",
        "created": 1700000000,
        "owned_by": "nomic-ai"
    },
    {
        "id": "mxbai-embed-large",
        "description": "[mixedbread-ai/mxbai-embed-large-v1]: https://huggingface.co/mixedbread-ai/mxbai-embed-large-v1",
        "object": "embeddings",
        "created": 1700000000,
        "owned_by": "mixedbread-ai"
    },
    {
        "id": "mixbread-ai/mxbai-embed-large-v1",
        "description": "[mixedbread-ai/mxbai-embed-large-v1]: https://huggingface.co/mixedbread-ai/mxbai-embed-large-v1",
        "object": "embeddings",
        "created": 1700000000,
        "owned_by": "mixedbread-ai"
    },
    {
        "id": "multilingual-e5-large-instruct",
        "description": "[intfloat/multilingual-e5-large-instruct]: https://huggingface.co/intfloat/multilingual-e5-large-instruct",
        "object": "embeddings",
        "created": 1700000000,
        "owned_by": "intfloat"
    },
    {
        "id": "intfloat/multilingual-e5-large-instruct",
        "description": "[intfloat/multilingual-e5-large-instruct]: https://huggingface.co/intfloat/multilingual-e5-large-instruct",
        "object": "embeddings",
        "created": 1700000000,
        "owned_by": "intfloat"
    },
]


# https://platform.openai.com/docs/api-reference/models/list
AVAILABLE_MODELS_DICTS = LLM_MODELS_DICTS + EMBEDDINGS_MODELS_DICTS