Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -36,12 +36,13 @@ def extend(input_text, max_size=20, top_k=50, top_p=0.95):
|
|
36 |
else:
|
37 |
input_ids = encoded_prompt
|
38 |
|
|
|
39 |
output_sequences = model.generate(
|
40 |
input_ids=input_ids,
|
41 |
max_length=max_size + len(encoded_prompt[0]),
|
42 |
top_k=top_k,
|
43 |
top_p=top_p,
|
44 |
-
do_sample=
|
45 |
repetition_penalty=25.0,
|
46 |
num_return_sequences=1)
|
47 |
|
@@ -95,7 +96,7 @@ if __name__ == "__main__":
|
|
95 |
|
96 |
model.to(device)
|
97 |
|
98 |
-
text_area = st.text_area("Enter the first few words (or leave blank), tap on \"Generate Text\" below. Tapping again
|
99 |
|
100 |
st.sidebar.subheader("Configurable parameters")
|
101 |
|
|
|
36 |
else:
|
37 |
input_ids = encoded_prompt
|
38 |
|
39 |
+
do_sample = False if top_k ==0 and top_p == 1.0 else True
|
40 |
output_sequences = model.generate(
|
41 |
input_ids=input_ids,
|
42 |
max_length=max_size + len(encoded_prompt[0]),
|
43 |
top_k=top_k,
|
44 |
top_p=top_p,
|
45 |
+
do_sample=do)sample,
|
46 |
repetition_penalty=25.0,
|
47 |
num_return_sequences=1)
|
48 |
|
|
|
96 |
|
97 |
model.to(device)
|
98 |
|
99 |
+
text_area = st.text_area("Enter the first few words (or leave blank), tap on \"Generate Text\" below. Tapping again may produce a different result.", 'ืืืจืช ืืืจืืื')
|
100 |
|
101 |
st.sidebar.subheader("Configurable parameters")
|
102 |
|