Spaces:
Sleeping
Sleeping
Commit
·
6b0c2cb
1
Parent(s):
af105a4
Update app.py
Browse files
app.py
CHANGED
@@ -20,22 +20,11 @@ def format_prompt(message, history):
|
|
20 |
prompt = "<s>"
|
21 |
if manual_content:
|
22 |
prompt += f"[INST]Leggi questo MANUALE dopo ti farò delle domande ***INIZIO_MANUALE***: [/INST] {manual_content} [INST] ***FINE_MANUALE***[/INST]"
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
#def format_prompt(message, history):
|
30 |
-
# prompt = "<s>"
|
31 |
-
# with open('Manuale.txt', 'r') as file:
|
32 |
-
# manual_content = file.read()
|
33 |
-
# prompt += f"[INST]Leggi questo MANUALE dopo ti farò delle domande ***INIZIO_MANUALE***: [/INST] {manual_content} [INST] ***FINE_MANUALE***[/INST]"
|
34 |
-
# for user_prompt, bot_response in history:
|
35 |
-
# prompt += f"[INST] {user_prompt} [/INST]"
|
36 |
-
# prompt += f" {bot_response}</s> "
|
37 |
-
# prompt += f"[INST]Tu sei Zucchetti AI, il mio assistente personale di AdHoc e... io ho un problema in AdHoc, rispondi proponendo SOLO con soluzione relativa al problmea a partire dal manuale (testo tra ***INIZIO_MANUALE*** e ***FINE_MANUALE***): {message} [/INST]"
|
38 |
-
# return prompt
|
39 |
|
40 |
def generate(
|
41 |
prompt, history, temperature=0.2, max_new_tokens=300, top_p=0.95, repetition_penalty=1.0,
|
|
|
20 |
prompt = "<s>"
|
21 |
if manual_content:
|
22 |
prompt += f"[INST]Leggi questo MANUALE dopo ti farò delle domande ***INIZIO_MANUALE***: [/INST] {manual_content} [INST] ***FINE_MANUALE***[/INST]"
|
23 |
+
for user_prompt, bot_response in history:
|
24 |
+
prompt += f"[INST] {user_prompt} [/INST]"
|
25 |
+
prompt += f" {bot_response}</s> "
|
26 |
+
prompt += f"[INST]Tu sei Zucchetti AI, il mio assistente personale di AdHoc e... io ho un problema in AdHoc, rispondi proponendo SOLO con soluzione relativa al problema a partire dal manuale (testo tra ***INIZIO_MANUALE*** e ***FINE_MANUALE***): {message} [/INST]"
|
27 |
+
return prompt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
def generate(
|
30 |
prompt, history, temperature=0.2, max_new_tokens=300, top_p=0.95, repetition_penalty=1.0,
|