Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ client = InferenceClient(
|
|
| 7 |
|
| 8 |
|
| 9 |
def format_prompt(message, history):
|
| 10 |
-
prompt = "
|
| 11 |
for user_prompt, bot_response in history:
|
| 12 |
prompt += f"[INST] {user_prompt} [/INST]"
|
| 13 |
prompt += f" {bot_response}</s> "
|
|
@@ -15,7 +15,7 @@ def format_prompt(message, history):
|
|
| 15 |
return prompt
|
| 16 |
|
| 17 |
def generate(
|
| 18 |
-
prompt, history, temperature=0.9,
|
| 19 |
):
|
| 20 |
temperature = float(temperature)
|
| 21 |
if temperature < 1e-2:
|
|
@@ -24,7 +24,7 @@ def generate(
|
|
| 24 |
|
| 25 |
generate_kwargs = dict(
|
| 26 |
temperature=temperature,
|
| 27 |
-
|
| 28 |
top_p=top_p,
|
| 29 |
repetition_penalty=repetition_penalty,
|
| 30 |
do_sample=True,
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
def format_prompt(message, history):
|
| 10 |
+
prompt = "You are a helpful chatbot specialized in medical knowledge.\n"
|
| 11 |
for user_prompt, bot_response in history:
|
| 12 |
prompt += f"[INST] {user_prompt} [/INST]"
|
| 13 |
prompt += f" {bot_response}</s> "
|
|
|
|
| 15 |
return prompt
|
| 16 |
|
| 17 |
def generate(
|
| 18 |
+
prompt, history, temperature=0.9, max_length=2000, top_p=0.95, repetition_penalty=1.0,
|
| 19 |
):
|
| 20 |
temperature = float(temperature)
|
| 21 |
if temperature < 1e-2:
|
|
|
|
| 24 |
|
| 25 |
generate_kwargs = dict(
|
| 26 |
temperature=temperature,
|
| 27 |
+
max_length=max_length,
|
| 28 |
top_p=top_p,
|
| 29 |
repetition_penalty=repetition_penalty,
|
| 30 |
do_sample=True,
|