Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -76,7 +76,7 @@ def generate_cheatsheet_func(training_data_text, model_name_input, progress=gr.P
|
|
76 |
generator_template=GENERATOR_PROMPT,
|
77 |
cheatsheet_template=CURATOR_PROMPT,
|
78 |
temperature=0.1,
|
79 |
-
max_tokens=
|
80 |
)
|
81 |
cheatsheet_content = results_dict.get("final_cheatsheet", cheatsheet_content)
|
82 |
except Exception as e:
|
@@ -107,7 +107,7 @@ def get_answers_func(user_query, model_name_input):
|
|
107 |
generator_template=GENERATOR_PROMPT,
|
108 |
cheatsheet_template=CURATOR_PROMPT,
|
109 |
temperature=0.1,
|
110 |
-
max_tokens=
|
111 |
)
|
112 |
answer_with_cheatsheet = results_with_cheatsheet.get("final_answer", "Error: Could not extract answer.")
|
113 |
except Exception as e:
|
@@ -124,7 +124,7 @@ def get_answers_func(user_query, model_name_input):
|
|
124 |
generator_template=GENERATOR_PROMPT,
|
125 |
cheatsheet_template=CURATOR_PROMPT,
|
126 |
temperature=0.1,
|
127 |
-
max_tokens=
|
128 |
)
|
129 |
answer_without_cheatsheet = results_without_cheatsheet.get("final_answer", "Error: Could not extract answer.")
|
130 |
except Exception as e:
|
@@ -139,23 +139,25 @@ with gr.Blocks(title="Task Caching Demo", theme=gr.themes.Default(font=[gr.theme
|
|
139 |
gr.Markdown("# Task Caching Demo")
|
140 |
gr.Markdown("Demonstrates the effect of using a dynamically generated cheatsheet (Task Caching) on model inference. Uses SambaNova API via `litellm`.")
|
141 |
|
142 |
-
model_name_input = gr.Textbox(
|
143 |
-
label="SambaNova Model Name",
|
144 |
-
value="sambanova/DeepSeek-R1-Distill-Llama-70B", # Default value
|
145 |
-
info="Enter the SambaNova model name (e.g., sambanova/DeepSeek-R1-Distill-Llama-70B). Ensure the 'sambanova/' prefix if required by litellm configuration."
|
146 |
-
)
|
147 |
-
# END OF ADDED PART
|
148 |
-
|
149 |
training_data_example = '''
|
150 |
Solve for 24: 1 2 3 4
|
151 |
-
Solve for 24: 2 3 4 5
|
152 |
Solve for 24: 3 4 5 6
|
153 |
Solve for 24: 4 5 6 7
|
154 |
'''
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
|
157 |
with gr.Tabs():
|
158 |
-
with gr.TabItem("1.
|
159 |
gr.Markdown("Paste your training data below, one example per line. This data will be used to build a cumulative cheatsheet. The process may take some time depending on the number of examples.")
|
160 |
training_data_input = gr.Textbox(lines=10, label="Training Data", value=training_data_example)
|
161 |
generate_cheatsheet_button = gr.Button("Generate Cheatsheet (Task Caching)", variant="primary")
|
|
|
76 |
generator_template=GENERATOR_PROMPT,
|
77 |
cheatsheet_template=CURATOR_PROMPT,
|
78 |
temperature=0.1,
|
79 |
+
max_tokens=8192
|
80 |
)
|
81 |
cheatsheet_content = results_dict.get("final_cheatsheet", cheatsheet_content)
|
82 |
except Exception as e:
|
|
|
107 |
generator_template=GENERATOR_PROMPT,
|
108 |
cheatsheet_template=CURATOR_PROMPT,
|
109 |
temperature=0.1,
|
110 |
+
max_tokens=8192
|
111 |
)
|
112 |
answer_with_cheatsheet = results_with_cheatsheet.get("final_answer", "Error: Could not extract answer.")
|
113 |
except Exception as e:
|
|
|
124 |
generator_template=GENERATOR_PROMPT,
|
125 |
cheatsheet_template=CURATOR_PROMPT,
|
126 |
temperature=0.1,
|
127 |
+
max_tokens=8192
|
128 |
)
|
129 |
answer_without_cheatsheet = results_without_cheatsheet.get("final_answer", "Error: Could not extract answer.")
|
130 |
except Exception as e:
|
|
|
139 |
gr.Markdown("# Task Caching Demo")
|
140 |
gr.Markdown("Demonstrates the effect of using a dynamically generated cheatsheet (Task Caching) on model inference. Uses SambaNova API via `litellm`.")
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
training_data_example = '''
|
143 |
Solve for 24: 1 2 3 4
|
|
|
144 |
Solve for 24: 3 4 5 6
|
145 |
Solve for 24: 4 5 6 7
|
146 |
'''
|
147 |
+
with gr.Tabs():
|
148 |
+
model_name_input = gr.Textbox(
|
149 |
+
label="SambaNova Model Name",
|
150 |
+
value="sambanova/Meta-Llama-3.1-8B-Instruct", # Default value
|
151 |
+
info="Enter the SambaNova model name (e.g., sambanova/DeepSeek-R1-Distill-Llama-70B). Ensure the 'sambanova/' prefix if required by litellm configuration."
|
152 |
+
)
|
153 |
+
SAMBANOVA_API_KEY = gr.Textbox(
|
154 |
+
label="SambaNova API Key",
|
155 |
+
value="", # Default value
|
156 |
+
info="Please Enter your SambaNova API Key, otherwise by default will use Changran's key, but RPM is low"
|
157 |
+
)
|
158 |
|
159 |
with gr.Tabs():
|
160 |
+
with gr.TabItem("1. Task Caching (Generate Task-Specific Cheatsheet from Training Data)"):
|
161 |
gr.Markdown("Paste your training data below, one example per line. This data will be used to build a cumulative cheatsheet. The process may take some time depending on the number of examples.")
|
162 |
training_data_input = gr.Textbox(lines=10, label="Training Data", value=training_data_example)
|
163 |
generate_cheatsheet_button = gr.Button("Generate Cheatsheet (Task Caching)", variant="primary")
|