Spaces:
Paused
Paused
Robin Genolet
commited on
Commit
·
dad4228
1
Parent(s):
73c445e
fix: tabs and only use pipeline
Browse files- app.py +7 -4
- utils/epfl_meditron_utils.py +4 -5
app.py
CHANGED
@@ -184,8 +184,9 @@ def plot_report(title, expected, predicted, display_labels):
|
|
184 |
|
185 |
|
186 |
def get_prompt_format(model_name):
|
|
|
187 |
if model_name == "TheBloke/Llama-2-13B-chat-GPTQ" or model_name== "TheBloke/Llama-2-7B-Chat-GPTQ":
|
188 |
-
|
189 |
{system_message}
|
190 |
<</SYS>>
|
191 |
{prompt}[/INST]
|
@@ -193,13 +194,15 @@ def get_prompt_format(model_name):
|
|
193 |
'''
|
194 |
|
195 |
if model_name == "TheBloke/meditron-7B-GPTQ" or model_name == "TheBloke/meditron-70B-GPTQ":
|
196 |
-
|
197 |
{system_message}<|im_end|>
|
198 |
<|im_start|>user
|
199 |
{prompt}<|im_end|>
|
200 |
-
<|im_start|>assistant
|
|
|
|
|
201 |
|
202 |
-
return ""
|
203 |
|
204 |
def format_prompt(template, system_message, prompt):
|
205 |
if template == "":
|
|
|
184 |
|
185 |
|
186 |
def get_prompt_format(model_name):
|
187 |
+
formatted_text = ""
|
188 |
if model_name == "TheBloke/Llama-2-13B-chat-GPTQ" or model_name== "TheBloke/Llama-2-7B-Chat-GPTQ":
|
189 |
+
formatted_text = '''[INST] <<SYS>>
|
190 |
{system_message}
|
191 |
<</SYS>>
|
192 |
{prompt}[/INST]
|
|
|
194 |
'''
|
195 |
|
196 |
if model_name == "TheBloke/meditron-7B-GPTQ" or model_name == "TheBloke/meditron-70B-GPTQ":
|
197 |
+
formatted_text = '''<|im_start|>system
|
198 |
{system_message}<|im_end|>
|
199 |
<|im_start|>user
|
200 |
{prompt}<|im_end|>
|
201 |
+
<|im_start|>assistant
|
202 |
+
|
203 |
+
'''
|
204 |
|
205 |
+
return formatted_text.replace("\t", "")
|
206 |
|
207 |
def format_prompt(template, system_message, prompt):
|
208 |
if template == "":
|
utils/epfl_meditron_utils.py
CHANGED
@@ -19,11 +19,10 @@ def get_llm_response(model_name_or_path, temperature, do_sample, top_p, top_k, m
|
|
19 |
print("Formatted prompt:")
|
20 |
print(formatted_prompt)
|
21 |
|
22 |
-
print("\n\n*** Generate:")
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
27 |
|
28 |
print("*** Pipeline:")
|
29 |
pipe = pipeline(
|
|
|
19 |
print("Formatted prompt:")
|
20 |
print(formatted_prompt)
|
21 |
|
22 |
+
#print("\n\n*** Generate:")
|
23 |
+
#input_ids = tokenizer(formatted_prompt, return_tensors='pt').input_ids.cuda()
|
24 |
+
#output = model.generate(inputs=input_ids, temperature=temperature, do_sample=do_sample, top_p=top_p, top_k=top_k, max_new_tokens=max_new_tokens)
|
25 |
+
#print(tokenizer.decode(output[0], skip_special_tokens=True))
|
|
|
26 |
|
27 |
print("*** Pipeline:")
|
28 |
pipe = pipeline(
|