Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,7 +25,7 @@ temperature = st.sidebar.slider("Temperature", 0.1, 1.5, 1.0, 0.1) # Default 1.
|
|
| 25 |
top_p = st.sidebar.slider("Top-p (Nucleus Sampling)", 0.0, 1.0, 0.9, 0.05) # Default 0.9
|
| 26 |
top_k = st.sidebar.slider("Top-k", 0, 100, 50, 1) # Default 50
|
| 27 |
# Disable sampling when using beam search
|
| 28 |
-
|
| 29 |
|
| 30 |
# Input field for the student
|
| 31 |
student_question = st.text_input("Ask your question!")
|
|
@@ -44,11 +44,11 @@ if student_question:
|
|
| 44 |
temperature=temperature,
|
| 45 |
top_p=top_p,
|
| 46 |
top_k=top_k,
|
| 47 |
-
do_sample=
|
| 48 |
-
num_beams=2, # Use beam search
|
| 49 |
no_repeat_ngram_size=3, # Prevent repeating phrases of 3 words or more
|
| 50 |
-
|
| 51 |
-
early_stopping=
|
| 52 |
)
|
| 53 |
|
| 54 |
# Decode the generated response
|
|
|
|
| 25 |
top_p = st.sidebar.slider("Top-p (Nucleus Sampling)", 0.0, 1.0, 0.9, 0.05) # Default 0.9
|
| 26 |
top_k = st.sidebar.slider("Top-k", 0, 100, 50, 1) # Default 50
|
| 27 |
# Disable sampling when using beam search
|
| 28 |
+
do_sample = st.sidebar.checkbox("Enable Random Sampling", value=False)
|
| 29 |
|
| 30 |
# Input field for the student
|
| 31 |
student_question = st.text_input("Ask your question!")
|
|
|
|
| 44 |
temperature=temperature,
|
| 45 |
top_p=top_p,
|
| 46 |
top_k=top_k,
|
| 47 |
+
do_sample=True, # Disable sampling, using beam search
|
| 48 |
+
#num_beams=2, # Use beam search
|
| 49 |
no_repeat_ngram_size=3, # Prevent repeating phrases of 3 words or more
|
| 50 |
+
length_penalty=1.0, # Discourage overly long responses
|
| 51 |
+
early_stopping=False # Stops when it finds a sufficiently good output
|
| 52 |
)
|
| 53 |
|
| 54 |
# Decode the generated response
|