Spaces:
Runtime error
Runtime error
fix: seed had some odd issue
Browse files
app.py
CHANGED
@@ -28,24 +28,20 @@ client = InferenceClient(
|
|
28 |
def format_prompt(message, history, system_prompt):
|
29 |
prompt = ""
|
30 |
if system_prompt:
|
31 |
-
prompt += f"
|
32 |
for user_prompt, bot_response in history:
|
33 |
-
prompt += f"
|
34 |
-
prompt += f"
|
35 |
-
prompt += f"""
|
36 |
-
Falcon:"""
|
37 |
return prompt
|
38 |
|
39 |
-
seed = 42
|
40 |
-
|
41 |
def generate(
|
42 |
-
prompt, history, system_prompt="<|endoftext|>", temperature=0.9, max_new_tokens=100, top_p=0.95, repetition_penalty=1.0,
|
43 |
):
|
44 |
temperature = float(temperature)
|
45 |
if temperature < 1e-2:
|
46 |
temperature = 1e-2
|
47 |
top_p = float(top_p)
|
48 |
-
global seed
|
49 |
generate_kwargs = dict(
|
50 |
temperature=temperature,
|
51 |
max_new_tokens=max_new_tokens,
|
|
|
28 |
def format_prompt(message, history, system_prompt):
|
29 |
prompt = ""
|
30 |
if system_prompt:
|
31 |
+
prompt += f"{system_prompt}"
|
32 |
for user_prompt, bot_response in history:
|
33 |
+
prompt += f"{user_prompt}"
|
34 |
+
prompt += f"{bot_response}"
|
35 |
+
prompt += f"""{message}"""
|
|
|
36 |
return prompt
|
37 |
|
|
|
|
|
38 |
def generate(
|
39 |
+
prompt, history, system_prompt="<|endoftext|>", temperature=0.9, max_new_tokens=100, top_p=0.95, repetition_penalty=1.0, seed=42,
|
40 |
):
|
41 |
temperature = float(temperature)
|
42 |
if temperature < 1e-2:
|
43 |
temperature = 1e-2
|
44 |
top_p = float(top_p)
|
|
|
45 |
generate_kwargs = dict(
|
46 |
temperature=temperature,
|
47 |
max_new_tokens=max_new_tokens,
|