Spaces:
Running
on
L4
Running
on
L4
Commit
·
eb5f7f4
1
Parent(s):
ad53e30
remove top_k openai
Browse files- app.py +3 -5
- prompts.py +1 -2
app.py
CHANGED
@@ -178,20 +178,19 @@ with st.sidebar:
|
|
178 |
model = st.selectbox("Choose the LLM model", ["gpt-4o-mini", "gpt-3.5-turbo", "llama-tommi-0.35"], key='a1model')
|
179 |
|
180 |
if model == "llama-tommi-0.35":
|
181 |
-
tommi_do_sample = st.toggle("Enable Sampling", value=
|
182 |
|
183 |
if tommi_do_sample:
|
184 |
tommi_temperature = st.slider("Temperature", 0.0, 1.5, 0.7, key='tommi_temp')
|
185 |
tommi_top_k = st.slider("Top K", 0, 100, 50, key='tommi_top_k')
|
186 |
tommi_top_p = st.slider("Top P", 0.0, 1.0, 0.95, key='tommi_top_p')
|
187 |
else:
|
188 |
-
tommi_num_beams = st.slider("Num Beams", 1,
|
189 |
|
190 |
tommi_max_new_tokens = st.slider("Max New Tokens", 100, 2000, 500, step=50, key='tommi_max_new_tokens')
|
191 |
else:
|
192 |
expert_temperature = st.slider("Temperature", 0.0, 1.5, 0.7, key='a1t')
|
193 |
expert_top_p = st.slider("Top P", 0.0, 1.0, 0.9, key='a1p')
|
194 |
-
expert_top_k = st.slider("Top K", 0, 100, 50, key='a1k')
|
195 |
|
196 |
with st.expander('Synthesis model',expanded=False):
|
197 |
|
@@ -324,8 +323,7 @@ if submit_button_placeholder.button("AI Answer", type="primary"):
|
|
324 |
st.session_state.question,
|
325 |
model=model,
|
326 |
temperature=expert_temperature,
|
327 |
-
top_p=expert_top_p
|
328 |
-
top_k=expert_top_k
|
329 |
)
|
330 |
else:
|
331 |
st.session_state.expert_answer = 'No Expert Answer. Only use the context.'
|
|
|
178 |
model = st.selectbox("Choose the LLM model", ["gpt-4o-mini", "gpt-3.5-turbo", "llama-tommi-0.35"], key='a1model')
|
179 |
|
180 |
if model == "llama-tommi-0.35":
|
181 |
+
tommi_do_sample = st.toggle("Enable Sampling", value=False, key='tommi_sample')
|
182 |
|
183 |
if tommi_do_sample:
|
184 |
tommi_temperature = st.slider("Temperature", 0.0, 1.5, 0.7, key='tommi_temp')
|
185 |
tommi_top_k = st.slider("Top K", 0, 100, 50, key='tommi_top_k')
|
186 |
tommi_top_p = st.slider("Top P", 0.0, 1.0, 0.95, key='tommi_top_p')
|
187 |
else:
|
188 |
+
tommi_num_beams = st.slider("Num Beams", 1, 4, 1, key='tommi_num_beams')
|
189 |
|
190 |
tommi_max_new_tokens = st.slider("Max New Tokens", 100, 2000, 500, step=50, key='tommi_max_new_tokens')
|
191 |
else:
|
192 |
expert_temperature = st.slider("Temperature", 0.0, 1.5, 0.7, key='a1t')
|
193 |
expert_top_p = st.slider("Top P", 0.0, 1.0, 0.9, key='a1p')
|
|
|
194 |
|
195 |
with st.expander('Synthesis model',expanded=False):
|
196 |
|
|
|
323 |
st.session_state.question,
|
324 |
model=model,
|
325 |
temperature=expert_temperature,
|
326 |
+
top_p=expert_top_p
|
|
|
327 |
)
|
328 |
else:
|
329 |
st.session_state.expert_answer = 'No Expert Answer. Only use the context.'
|
prompts.py
CHANGED
@@ -14,7 +14,7 @@ def fix_latex(text):
|
|
14 |
|
15 |
|
16 |
# Step 1: Domain-Specific Answer Generation
|
17 |
-
def openai_domain_specific_answer_generation(subject, question, model="gpt4o-mini", temperature=0.3, top_p=0.1
|
18 |
system_prompt = f"""
|
19 |
You are a highly specialized assistant for the subject {subject}. Provide a direct and focused answer to the following question based on your specialized training.
|
20 |
"""
|
@@ -40,7 +40,6 @@ def openai_domain_specific_answer_generation(subject, question, model="gpt4o-min
|
|
40 |
],
|
41 |
temperature=temperature, # Set low for deterministic and precise responses.
|
42 |
top_p=top_p, # Focus on high-probability outputs to ensure accuracy.
|
43 |
-
top_k=top_k,
|
44 |
frequency_penalty=0.1, # Reduce repetition of technical terms.
|
45 |
presence_penalty=0.0 # Prevent introduction of unrelated ideas.
|
46 |
)
|
|
|
14 |
|
15 |
|
16 |
# Step 1: Domain-Specific Answer Generation
|
17 |
+
def openai_domain_specific_answer_generation(subject, question, model="gpt4o-mini", temperature=0.3, top_p=0.1):
|
18 |
system_prompt = f"""
|
19 |
You are a highly specialized assistant for the subject {subject}. Provide a direct and focused answer to the following question based on your specialized training.
|
20 |
"""
|
|
|
40 |
],
|
41 |
temperature=temperature, # Set low for deterministic and precise responses.
|
42 |
top_p=top_p, # Focus on high-probability outputs to ensure accuracy.
|
|
|
43 |
frequency_penalty=0.1, # Reduce repetition of technical terms.
|
44 |
presence_penalty=0.0 # Prevent introduction of unrelated ideas.
|
45 |
)
|