karim23657 commited on
Commit
9dc64e3
·
verified ·
1 Parent(s): eda1a39

Upload folder using huggingface_hub

Browse files
Dockerfile CHANGED
@@ -1,16 +1,8 @@
1
- FROM python:3.9
2
- RUN pwd
3
  WORKDIR $HOME/app
4
- COPY . .
5
- RUN mkdir -p /.cache && chmod -R 777 /.cache
6
- RUN pwd
7
- RUN ls
8
- RUN pip install setuptools_scm
9
- RUN pip install --upgrade wheel
10
- RUN pip install sphinxcontrib-wavedrom
11
- # RUN pip install wavedrom --no-build-isolation
12
- # RUN pip install wavedrom==2.0.3.post3
13
  RUN pip install -r requirements.txt
14
- VOLUME /data
15
  EXPOSE 23333
16
  CMD ["python", "-m", "apis.chat_api"]
 
1
+ FROM python:3.11-slim
 
2
  WORKDIR $HOME/app
3
+ COPY requirements.txt $HOME/app
4
+ RUN mkdir /.cache && chmod 777 /.cache
 
 
 
 
 
 
 
5
  RUN pip install -r requirements.txt
6
+ COPY . $HOME/app
7
  EXPOSE 23333
8
  CMD ["python", "-m", "apis.chat_api"]
apis/chat_api.py CHANGED
@@ -65,8 +65,8 @@ class ChatAPIApp:
65
 
66
  class ChatCompletionsPostItem(BaseModel):
67
  model: str = Field(
68
- default="Mixtral-8x7B-Instruct-v0.1",
69
- description="(str) `Mixtral-8x7B-Instruct-v0.1`",
70
  )
71
  messages: list = Field(
72
  default=[{"role": "user", "content": "Hello, who are you?"}],
 
65
 
66
  class ChatCompletionsPostItem(BaseModel):
67
  model: str = Field(
68
+ default="nous-mixtral-8x7b",
69
+ description="(str) `nous-mixtral-8x7b`",
70
  )
71
  messages: list = Field(
72
  default=[{"role": "user", "content": "Hello, who are you?"}],
constants/models.py CHANGED
@@ -1,35 +1,15 @@
1
  MODEL_MAP = {
2
- "mixtral-8x7b": "mistralai/Mixtral-8x7B-Instruct-v0.1",
3
- "default": "meta-llama/Llama-3.3-70B-Instruct",
4
- "Llama-3.3-70B-Instruct": "meta-llama/Llama-3.3-70B-Instruct",
5
- "Qwen2.5-72B-Instruct": "Qwen/Qwen2.5-72B-Instruct",
6
- "c4ai-command-r-plus-08-2024": "CohereForAI/c4ai-command-r-plus-08-2024",
7
- "DeepSeek-R1-Distill-Qwen-32B": "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
8
- "Llama-3.1-Nemotron-70B-Instruct-HF": "nvidia/Llama-3.1-Nemotron-70B-Instruct-HF",
9
- "QwQ-32B-Preview": "Qwen/QwQ-32B-Preview",
10
- "Qwen2.5-Coder-32B-Instruct": "Qwen/Qwen2.5-Coder-32B-Instruct",
11
- "Llama-3.2-11B-Vision-Instruct": "meta-llama/Llama-3.2-11B-Vision-Instruct",
12
- "Hermes-3-Llama-3.1-8B": "NousResearch/Hermes-3-Llama-3.1-8B",
13
- "Mistral-Nemo-Instruct-2407": "mistralai/Mistral-Nemo-Instruct-2407",
14
- "Phi-3.5-mini-instruct": "microsoft/Phi-3.5-mini-instruct",
15
- "DeepSeek-V3-0324": "deepseek-ai/DeepSeek-V3-0324",
16
  "nous-mixtral-8x7b": "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
17
  "mistral-7b": "mistralai/Mistral-7B-Instruct-v0.2",
18
  "yi-1.5-34b": "01-ai/Yi-1.5-34B-Chat",
19
  "gemma-7b": "google/gemma-1.1-7b-it",
 
 
 
 
 
20
  }
21
- # {
22
- # "mixtral-8x7b": "mistralai/Mixtral-8x7B-Instruct-v0.1", # [Recommended]
23
- # "nous-mixtral-8x7b": "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
24
- # "mistral-7b": "mistralai/Mistral-7B-Instruct-v0.2",
25
- # "yi-1.5-34b": "01-ai/Yi-1.5-34B-Chat",
26
- # "gemma-7b": "google/gemma-1.1-7b-it",
27
- # # "openchat-3.5": "openchat/openchat-3.5-0106",
28
- # # "command-r-plus": "CohereForAI/c4ai-command-r-plus",
29
- # # "llama3-70b": "meta-llama/Meta-Llama-3-70B-Instruct",
30
- # # "zephyr-141b": "HuggingFaceH4/zephyr-orpo-141b-A35b-v0.1",
31
- # "default": "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
32
- # }
33
 
34
  AVAILABLE_MODELS = list(MODEL_MAP.keys())
35
 
@@ -46,16 +26,6 @@ STOP_SEQUENCES_MAP = {
46
  "yi-1.5-34b": "<|im_end|>",
47
  # https://huggingface.co/google/gemma-1.1-7b-it/blob/main/tokenizer_config.json#L1509
48
  "gemma-7b": "<eos>",
49
- # https://huggingface.co/huihui-ai/Llama-3.3-70B-Instruct-abliterated/blob/fa13334669544bab573e0e5313cad629a9c02e2c/tokenizer_config.json#L2055
50
- "Llama-3.3-70B-Instruct": "<|eot_id|>",
51
- # https://huggingface.co/google/gemma-1.1-7b-it/blob/main/tokenizer_config.json#L1509
52
- "c4ai-command-r-plus-08-2024": "<|END_OF_TURN_TOKEN|>",
53
- # https://huggingface.co/unsloth/Qwen2.5-72B-Instruct/blob/main/tokenizer_config.json
54
- "Qwen2.5-72B-Instruct":"<|im_end|>",
55
- # https://huggingface.co/unsloth/DeepSeek-R1-Distill-Qwen-32B/blob/main/tokenizer_config.json
56
- "DeepSeek-R1-Distill-Qwen-32B":"<|end▁of▁sentence|>",
57
- "DeepSeek-V3-0324":"<|end▁of▁sentence|>",
58
-
59
  # "openchat-3.5": "<|end_of_turn|>",
60
  # "command-r-plus": "<|END_OF_TURN_TOKEN|>",
61
  }
@@ -66,12 +36,6 @@ TOKEN_LIMIT_MAP = {
66
  "mistral-7b": 32768,
67
  "yi-1.5-34b": 4096,
68
  "gemma-7b": 8192,
69
- "Llama-3.3-70B-Instruct": 131072,
70
- "c4ai-command-r-plus-08-2024":1000000000000000019884624838656,
71
- "Qwen2.5-72B-Instruct":131072,
72
- "DeepSeek-R1-Distill-Qwen-32B":131072,
73
- "DeepSeek-R1-Distill-Qwen-32B":131072,
74
-
75
  # "openchat-3.5": 8192,
76
  # "command-r-plus": 32768,
77
  # "llama3-70b": 8192,
@@ -84,131 +48,74 @@ TOKEN_RESERVED = 20
84
 
85
  # https://platform.openai.com/docs/api-reference/models/list
86
  AVAILABLE_MODELS_DICTS = [
87
- {
88
- "id": "Llama-3.3-70B-Instruct",
89
- "description": "[meta-llama/Llama-3.3-70B-Instruct]: https://huggingface.co/meta-llama/Llama-3.3-70B-Instruct",
90
- "object": "model",
91
- "created": 1700000000,
92
- "owned_by": "meta-llama"
93
- },
94
- {
95
- "id": "Qwen2.5-72B-Instruct",
96
- "description": "[Qwen/Qwen2.5-72B-Instruct]: https://huggingface.co/Qwen/Qwen2.5-72B-Instruct",
97
- "object": "model",
98
- "created": 1700000000,
99
- "owned_by": "Qwen"
100
- },
101
- {
102
- "id": "c4ai-command-r-plus-08-2024",
103
- "description": "[CohereForAI/c4ai-command-r-plus-08-2024]: https://huggingface.co/CohereForAI/c4ai-command-r-plus-08-2024",
104
- "object": "model",
105
- "created": 1700000000,
106
- "owned_by": "CohereForAI"
107
- },
108
- {
109
- "id": "DeepSeek-R1-Distill-Qwen-32B",
110
- "description": "[deepseek-ai/DeepSeek-R1-Distill-Qwen-32B]: https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
111
- "object": "model",
112
- "created": 1700000000,
113
- "owned_by": "deepseek-ai"
114
- },
115
- },
116
- {
117
- "id": "DeepSeek-V3-0324",
118
- "description": "[deepseek-ai/DeepSeek-V3-0324]: https://huggingface.co/deepseek-ai/DeepSeek-V3-0324",
119
- "object": "model",
120
- "created": 1700000000,
121
- "owned_by": "deepseek-ai"
122
- },
123
- {
124
- "id": "Llama-3.1-Nemotron-70B-Instruct-HF",
125
- "description": "[nvidia/Llama-3.1-Nemotron-70B-Instruct-HF]: https://huggingface.co/nvidia/Llama-3.1-Nemotron-70B-Instruct-HF",
126
- "object": "model",
127
- "created": 1700000000,
128
- "owned_by": "nvidia"
129
- },
130
- {
131
- "id": "QwQ-32B-Preview",
132
- "description": "[Qwen/QwQ-32B-Preview]: https://huggingface.co/Qwen/QwQ-32B-Preview",
133
- "object": "model",
134
- "created": 1700000000,
135
- "owned_by": "Qwen"
136
- },
137
- {
138
- "id": "Qwen2.5-Coder-32B-Instruct",
139
- "description": "[Qwen/Qwen2.5-Coder-32B-Instruct]: https://huggingface.co/Qwen/Qwen2.5-Coder-32B-Instruct",
140
- "object": "model",
141
- "created": 1700000000,
142
- "owned_by": "Qwen"
143
- },
144
- {
145
- "id": "Llama-3.2-11B-Vision-Instruct",
146
- "description": "[meta-llama/Llama-3.2-11B-Vision-Instruct]: https://huggingface.co/meta-llama/Llama-3.2-11B-Vision-Instruct",
147
- "object": "model",
148
- "created": 1700000000,
149
- "owned_by": "meta-llama"
150
- },
151
- {
152
- "id": "Hermes-3-Llama-3.1-8B",
153
- "description": "[NousResearch/Hermes-3-Llama-3.1-8B]: https://huggingface.co/NousResearch/Hermes-3-Llama-3.1-8B",
154
- "object": "model",
155
- "created": 1700000000,
156
- "owned_by": "NousResearch"
157
- },
158
- {
159
- "id": "Mistral-Nemo-Instruct-2407",
160
- "description": "[mistralai/Mistral-Nemo-Instruct-2407]: https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407",
161
- "object": "model",
162
- "created": 1700000000,
163
- "owned_by": "mistralai"
164
- },
165
- {
166
- "id": "Phi-3.5-mini-instruct",
167
- "description": "[microsoft/Phi-3.5-mini-instruct]: https://huggingface.co/microsoft/Phi-3.5-mini-instruct",
168
- "object": "model",
169
- "created": 1700000000,
170
- "owned_by": "microsoft"
171
- }
172
- ]
173
-
174
-
175
- '''
176
- https://huggingface.co/chat/models
177
- var links = document.querySelectorAll('div.relative a');
178
- var mlist=[];
179
- links.forEach(link=>{
180
- mlist.push(link.href.split('https://huggingface.co/chat/models/')[1])
181
- })
182
-
183
- p_MODEL_MAP(mlist);
184
- p_AVAILABLE_MODELS_DICTS(mlist);
185
-
186
-
187
- function p_MODEL_MAP(mlist){
188
- let d = {}
189
- mlist.forEach(m=>{
190
- d[m.split('/')[1]]=m
191
- });
192
- console.log(d)
193
- return d
194
- }
195
-
196
-
197
-
198
- function p_AVAILABLE_MODELS_DICTS(mlist){
199
- let d = []
200
- mlist.forEach(m=>{
201
- d.push({
202
- "id": m.split('/')[1],
203
- "description": `[${m}]: https://huggingface.co/${m}`,
204
  "object": "model",
205
  "created": 1700000000,
206
- "owned_by": m.split('/')[0],
207
- },)
208
-
209
- });
210
- console.log(d)
211
- return d
212
- }
213
-
214
- '''
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  MODEL_MAP = {
2
+ "mixtral-8x7b": "mistralai/Mixtral-8x7B-Instruct-v0.1", # [Recommended]
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  "nous-mixtral-8x7b": "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
4
  "mistral-7b": "mistralai/Mistral-7B-Instruct-v0.2",
5
  "yi-1.5-34b": "01-ai/Yi-1.5-34B-Chat",
6
  "gemma-7b": "google/gemma-1.1-7b-it",
7
+ # "openchat-3.5": "openchat/openchat-3.5-0106",
8
+ # "command-r-plus": "CohereForAI/c4ai-command-r-plus",
9
+ # "llama3-70b": "meta-llama/Meta-Llama-3-70B-Instruct",
10
+ # "zephyr-141b": "HuggingFaceH4/zephyr-orpo-141b-A35b-v0.1",
11
+ "default": "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
12
  }
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  AVAILABLE_MODELS = list(MODEL_MAP.keys())
15
 
 
26
  "yi-1.5-34b": "<|im_end|>",
27
  # https://huggingface.co/google/gemma-1.1-7b-it/blob/main/tokenizer_config.json#L1509
28
  "gemma-7b": "<eos>",
 
 
 
 
 
 
 
 
 
 
29
  # "openchat-3.5": "<|end_of_turn|>",
30
  # "command-r-plus": "<|END_OF_TURN_TOKEN|>",
31
  }
 
36
  "mistral-7b": 32768,
37
  "yi-1.5-34b": 4096,
38
  "gemma-7b": 8192,
 
 
 
 
 
 
39
  # "openchat-3.5": 8192,
40
  # "command-r-plus": 32768,
41
  # "llama3-70b": 8192,
 
48
 
49
  # https://platform.openai.com/docs/api-reference/models/list
50
  AVAILABLE_MODELS_DICTS = [
51
+ {
52
+ "id": "mixtral-8x7b",
53
+ "description": "[mistralai/Mixtral-8x7B-Instruct-v0.1]: https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  "object": "model",
55
  "created": 1700000000,
56
+ "owned_by": "mistralai",
57
+ },
58
+ {
59
+ "id": "nous-mixtral-8x7b",
60
+ "description": "[NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO]: https://huggingface.co/NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
61
+ "object": "model",
62
+ "created": 1700000000,
63
+ "owned_by": "NousResearch",
64
+ },
65
+ {
66
+ "id": "mistral-7b",
67
+ "description": "[mistralai/Mistral-7B-Instruct-v0.2]: https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2",
68
+ "object": "model",
69
+ "created": 1700000000,
70
+ "owned_by": "mistralai",
71
+ },
72
+ {
73
+ "id": "yi-1.5-34b",
74
+ "description": "[01-ai/Yi-1.5-34B-Chat]: https://huggingface.co/01-ai/Yi-1.5-34B-Chat",
75
+ "object": "model",
76
+ "created": 1700000000,
77
+ "owned_by": "01-ai",
78
+ },
79
+ {
80
+ "id": "gemma-7b",
81
+ "description": "[google/gemma-1.1-7b-it]: https://huggingface.co/google/gemma-1.1-7b-it",
82
+ "object": "model",
83
+ "created": 1700000000,
84
+ "owned_by": "Google",
85
+ },
86
+ # {
87
+ # "id": "openchat-3.5",
88
+ # "description": "[openchat/openchat-3.5-0106]: https://huggingface.co/openchat/openchat-3.5-0106",
89
+ # "object": "model",
90
+ # "created": 1700000000,
91
+ # "owned_by": "openchat",
92
+ # },
93
+ # {
94
+ # "id": "command-r-plus",
95
+ # "description": "[CohereForAI/c4ai-command-r-plus]: https://huggingface.co/CohereForAI/c4ai-command-r-plus",
96
+ # "object": "model",
97
+ # "created": 1700000000,
98
+ # "owned_by": "CohereForAI",
99
+ # },
100
+ # {
101
+ # "id": "llama3-70b",
102
+ # "description": "[meta-llama/Meta-Llama-3-70B]: https://huggingface.co/meta-llama/Meta-Llama-3-70B",
103
+ # "object": "model",
104
+ # "created": 1700000000,
105
+ # "owned_by": "Meta",
106
+ # },
107
+ # {
108
+ # "id": "zephyr-141b",
109
+ # "description": "[HuggingFaceH4/zephyr-orpo-141b-A35b-v0.1]: https://huggingface.co/HuggingFaceH4/zephyr-orpo-141b-A35b-v0.1",
110
+ # "object": "model",
111
+ # "created": 1700000000,
112
+ # "owned_by": "Huggingface",
113
+ # },
114
+ # {
115
+ # "id": "gpt-3.5-turbo",
116
+ # "description": "[openai/gpt-3.5-turbo]: https://platform.openai.com/docs/models/gpt-3-5-turbo",
117
+ # "object": "model",
118
+ # "created": 1700000000,
119
+ # "owned_by": "OpenAI",
120
+ # },
121
+ ]
networks/huggingchat_streamer.py CHANGED
@@ -20,7 +20,7 @@ class HuggingchatRequester:
20
  if model in MODEL_MAP.keys():
21
  self.model = model
22
  else:
23
- self.model = "Llama-3.3-70B-Instruct"
24
  self.model_fullname = MODEL_MAP[self.model]
25
 
26
  def get_hf_chat_id(self):
 
20
  if model in MODEL_MAP.keys():
21
  self.model = model
22
  else:
23
+ self.model = "nous-mixtral-8x7b"
24
  self.model_fullname = MODEL_MAP[self.model]
25
 
26
  def get_hf_chat_id(self):
requirements.txt CHANGED
@@ -15,5 +15,4 @@ tclogger
15
  tiktoken
16
  transformers
17
  uvicorn
18
- websockets
19
- # wavedrom==2.0.3
 
15
  tiktoken
16
  transformers
17
  uvicorn
18
+ websockets