Spaces:
Runtime error
Runtime error
Update run.py
Browse files
run.py
CHANGED
@@ -151,25 +151,26 @@ else:
|
|
151 |
|
152 |
def extend_prompt(message="", history=None, system=None, RAGAddon=None, system2=None, zeichenlimit=None,historylimit=4): #float("Inf")
|
153 |
if zeichenlimit is None: zeichenlimit=1000000000 # :-)
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
157 |
if("discolm_german_7b" in modelPath): #https://huggingface.co/DiscoResearch/DiscoLM_German_7b_v1
|
158 |
template0="<|im_start|>system\n{system}<|im_end|>\n"
|
159 |
template1="<|im_start|>user\n{message}<|im_end|>\n<|im_start|>assistant\n"
|
160 |
template2="{response}<|im_end|>\n"
|
161 |
if("mixtral-8x7b-instruct" in modelPath): # https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1
|
162 |
-
template0="[INST] {system} [/INST]</s>"
|
163 |
-
template1="[INST] {message} [/INST]
|
164 |
-
template2="{response}</s>"
|
|
|
|
|
|
|
|
|
165 |
if("gemma-" in modelPath): # https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1
|
166 |
template0="<start_of_turn>user{system}</end_of_turn>"
|
167 |
template1="<start_of_turn>user{message}</end_of_turn><start_of_turn>model"
|
168 |
template2="{response}</end_of_turn>"
|
169 |
-
if("Mistral-7B-Instruct" in modelPath): #https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2
|
170 |
-
template0="[INST] {system} [/INST]</s>" if onPrem else "[INST] {system} [/INST]</s>" #<s>?
|
171 |
-
template1="[INST] {message} [/INST] "
|
172 |
-
template2="{response}</s>"
|
173 |
if("openchat-3.5" in modelPath): #https://huggingface.co/TheBloke/openchat-3.5-0106-GGUF
|
174 |
template0="GPT4 Correct User: {system}<|end_of_turn|>GPT4 Correct Assistant: Okay.<|end_of_turn|>"
|
175 |
template1="GPT4 Correct User: {message}<|end_of_turn|>GPT4 Correct Assistant: "
|
|
|
151 |
|
152 |
def extend_prompt(message="", history=None, system=None, RAGAddon=None, system2=None, zeichenlimit=None,historylimit=4): #float("Inf")
|
153 |
if zeichenlimit is None: zeichenlimit=1000000000 # :-)
|
154 |
+
#https://huggingface.co/docs/transformers/main/chat_templating
|
155 |
+
template0="[INST] {system} [/INST]</s> " # <s> einleitend wird ergänzt, Leerzeichen um Input und nach </s>
|
156 |
+
template1="[INST] {message} [/INST]" # Leerzeichen um Input, keines nach [/INST]
|
157 |
+
template2="{response}</s> " # Antworten folgen unmittelbar, enden ohne Leerzeichen vor </s>
|
158 |
if("discolm_german_7b" in modelPath): #https://huggingface.co/DiscoResearch/DiscoLM_German_7b_v1
|
159 |
template0="<|im_start|>system\n{system}<|im_end|>\n"
|
160 |
template1="<|im_start|>user\n{message}<|im_end|>\n<|im_start|>assistant\n"
|
161 |
template2="{response}<|im_end|>\n"
|
162 |
if("mixtral-8x7b-instruct" in modelPath): # https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1
|
163 |
+
template0="[INST] {system} [/INST]</s> " # <s> einleitend wird ergänzt, Leerzeichen um Input und nach </s>
|
164 |
+
template1="[INST] {message} [/INST]" # Leerzeichen um Input, keines nach [/INST]
|
165 |
+
template2="{response}</s> " # Antworten folgen unmittelbar, enden ohne Leerzeichen vor </s>
|
166 |
+
if("Mistral-7B-Instruct" in modelPath): #https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2
|
167 |
+
template0="[INST] {system} [/INST]</s> " # <s> einleitend wird ergänzt, Leerzeichen um Input und nach </s>
|
168 |
+
template1="[INST] {message} [/INST]" # Leerzeichen um Input, keines nach [/INST]
|
169 |
+
template2="{response}</s> " # Antworten folgen unmittelbar, enden ohne Leerzeichen vor </s>
|
170 |
if("gemma-" in modelPath): # https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1
|
171 |
template0="<start_of_turn>user{system}</end_of_turn>"
|
172 |
template1="<start_of_turn>user{message}</end_of_turn><start_of_turn>model"
|
173 |
template2="{response}</end_of_turn>"
|
|
|
|
|
|
|
|
|
174 |
if("openchat-3.5" in modelPath): #https://huggingface.co/TheBloke/openchat-3.5-0106-GGUF
|
175 |
template0="GPT4 Correct User: {system}<|end_of_turn|>GPT4 Correct Assistant: Okay.<|end_of_turn|>"
|
176 |
template1="GPT4 Correct User: {message}<|end_of_turn|>GPT4 Correct Assistant: "
|