DanielHesslow
commited on
Commit
•
83a6345
1
Parent(s):
2c2fdca
Update app.py
Browse files
app.py
CHANGED
@@ -36,6 +36,8 @@ def format_prompt(message, history, system_prompt):
|
|
36 |
Falcon:"""
|
37 |
return prompt
|
38 |
|
|
|
|
|
39 |
def generate(
|
40 |
prompt, history, system_prompt="", temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
|
41 |
):
|
@@ -43,7 +45,7 @@ def generate(
|
|
43 |
if temperature < 1e-2:
|
44 |
temperature = 1e-2
|
45 |
top_p = float(top_p)
|
46 |
-
|
47 |
generate_kwargs = dict(
|
48 |
temperature=temperature,
|
49 |
max_new_tokens=max_new_tokens,
|
@@ -51,9 +53,9 @@ def generate(
|
|
51 |
repetition_penalty=repetition_penalty,
|
52 |
stop_sequences=STOP_SEQUENCES,
|
53 |
do_sample=True,
|
54 |
-
seed=
|
55 |
)
|
56 |
-
|
57 |
formatted_prompt = format_prompt(prompt, history, system_prompt)
|
58 |
|
59 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|
|
|
36 |
Falcon:"""
|
37 |
return prompt
|
38 |
|
39 |
+
seed = 42
|
40 |
+
|
41 |
def generate(
|
42 |
prompt, history, system_prompt="", temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
|
43 |
):
|
|
|
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,
|
|
|
53 |
repetition_penalty=repetition_penalty,
|
54 |
stop_sequences=STOP_SEQUENCES,
|
55 |
do_sample=True,
|
56 |
+
seed=seed,
|
57 |
)
|
58 |
+
seed = seed + 1
|
59 |
formatted_prompt = format_prompt(prompt, history, system_prompt)
|
60 |
|
61 |
stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
|