File size: 5,552 Bytes
7db5a18
 
 
c90d65f
9ae615f
7db5a18
0bf2285
e51b66c
0bf2285
 
 
 
56aa981
7db5a18
 
3ed391d
7db5a18
56aa981
 
7db5a18
0bf2285
7db5a18
0bf2285
7db5a18
c90d65f
 
9ae615f
 
0bf2285
7db5a18
0bf2285
 
 
e51b66c
0bf2285
 
7db5a18
 
 
 
 
c90d65f
cbd543f
7db5a18
0bf2285
e51b66c
0bf2285
 
 
 
 
7db5a18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9ae615f
 
 
 
 
 
 
c90d65f
 
 
 
 
 
 
7db5a18
 
 
 
 
 
 
56aa981
0bf2285
 
56aa981
 
0bf2285
56aa981
c66ed52
0bf2285
 
c66ed52
 
0bf2285
c66ed52
0bf2285
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7db5a18
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
MODEL_MAP = {
    "mixtral-8x7b": "mistralai/Mixtral-8x7B-Instruct-v0.1",  # [Recommended]
    "nous-mixtral-8x7b": "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
    "Llama-3.1-70B-Instruct": "meta-llama/Meta-Llama-3.1-70B-Instruct",
    "Mistral-Nemo-Instruct-2407": "mistralai/Mistral-Nemo-Instruct-2407",
    "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",
}

AVAILABLE_MODELS = list(MODEL_MAP.keys())

PRO_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/meta-llama/Meta-Llama-3.1-70B-Instruct/blob/1d54af340dc8906a2d21146191a9c184c35e47bd/tokenizer_config.json#L2055
    "Llama-3.1-70B-Instruct": "<|eot_id|>",
    # https://huggingface.co/meta-llama/Meta-Llama-3.1-70B-Instruct/blob/1d54af340dc8906a2d21146191a9c184c35e47bd/tokenizer_config.json#L2055
    "Mistral-Nemo-Instruct-2407": "</s>",
    # 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,
    "Llama-3.1-70B-Instruct": 32768,
    "Mistral-Nemo-Instruct-2407": 1024000,
    "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 = 20


# https://platform.openai.com/docs/api-reference/models/list
AVAILABLE_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",
    },
    {
        "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",
    },
    {
        "id": "Mistral-Nemo-Instruct-2407",
        "description": "[mistralai/Mistral-Nemo-Instruct-2407]: https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407",
        "object": "model",
        "created": 1700000000,
        "owned_by": "mistralai",
    },
    {
        "id": "Llama-3.1-70B-Instruct",
        "description": "[meta-llama/Llama-3.1-70B-Instruct]: https://huggingface.co/meta-llama/Llama-3.1-70B-Instruct",
        "object": "model",
        "created": 1700000000,
        "owned_by": "mistralai",
    },
    {
        "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",
    },
    {
        "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",
    # },
]