Spaces:
Runtime error
Runtime error
Commit
·
24da1a9
1
Parent(s):
1035aed
Added temp, top_k, top_p
Browse files- apps/home.py +19 -1
apps/home.py
CHANGED
@@ -76,12 +76,30 @@ def write():
|
|
76 |
value=3,
|
77 |
help="If set to int > 0, all ngrams of that size can only occur once.",
|
78 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
input_text = st.text_area(label='Enter a text: ', height=100,
|
81 |
value="Türkiye'nin başkenti neresidir?")
|
82 |
url = "https://api-inference.huggingface.co/models/boun-tabi-LMG/TURNA"
|
83 |
params = {"length_penalty": length_penalty, "no_repeat_ngram_size": no_repeat_ngram_size, "max_new_tokens": max_new_tokens,
|
84 |
-
"do_sample":do_sample, "num_beams":num_beams, "repetition_penalty":repetition_penalty
|
|
|
85 |
if st.button("Generate"):
|
86 |
with st.spinner('Generating...'):
|
87 |
output = query(input_text, url, params)
|
|
|
76 |
value=3,
|
77 |
help="If set to int > 0, all ngrams of that size can only occur once.",
|
78 |
)
|
79 |
+
temp = st.sidebar.slider(
|
80 |
+
"Temperature",
|
81 |
+
value=1.0,
|
82 |
+
min_value=0.1,
|
83 |
+
max_value=100.0,
|
84 |
+
help="The value used to module the next token probabilities.",
|
85 |
+
)
|
86 |
+
top_k = st.sidebar.number_input(
|
87 |
+
"Top k",
|
88 |
+
value=10,
|
89 |
+
help="The number of highest probability vocabulary tokens to keep for top-k-filtering.",
|
90 |
+
)
|
91 |
+
top_p = st.sidebar.number_input(
|
92 |
+
"Top p",
|
93 |
+
value=0.95,
|
94 |
+
help=" If set to float < 1, only the most probable tokens with probabilities that add up to top_p or higher are kept for generation.",
|
95 |
+
)
|
96 |
|
97 |
input_text = st.text_area(label='Enter a text: ', height=100,
|
98 |
value="Türkiye'nin başkenti neresidir?")
|
99 |
url = "https://api-inference.huggingface.co/models/boun-tabi-LMG/TURNA"
|
100 |
params = {"length_penalty": length_penalty, "no_repeat_ngram_size": no_repeat_ngram_size, "max_new_tokens": max_new_tokens,
|
101 |
+
"do_sample":do_sample, "num_beams":num_beams, "repetition_penalty":repetition_penalty,
|
102 |
+
"top_p"=top_p, "top_k"=top_k, "temperature"=temp}
|
103 |
if st.button("Generate"):
|
104 |
with st.spinner('Generating...'):
|
105 |
output = query(input_text, url, params)
|