Spaces:
Runtime error
Runtime error
aixsatoshi
commited on
Commit
•
0287bad
1
Parent(s):
ab2c4ae
Update app.py
Browse files
app.py
CHANGED
@@ -133,68 +133,60 @@ description = """<p align="center">Defaults to Oumuamua-7b-RP (you can switch to
|
|
133 |
</center></p>
|
134 |
"""
|
135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
templates = [
|
137 |
"MISTRAL", "CHATML", "VICUNA", "LLAMA_2", "SYNTHIA",
|
138 |
"NEURAL_CHAT", "SOLAR", "OPEN_CHAT", "ALPACA", "CODE_DS",
|
139 |
"B22", "LLAMA_3", "PHI_3"
|
140 |
]
|
141 |
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
maximum=1
|
167 |
-
value=0.
|
168 |
-
step=0.05,
|
169 |
-
label="Top-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
gr.
|
179 |
-
minimum=0.0,
|
180 |
-
maximum=2.0,
|
181 |
-
value=1.1,
|
182 |
-
step=0.1,
|
183 |
-
label="Repetition penalty",
|
184 |
-
),
|
185 |
-
],
|
186 |
-
retry_btn="Retry",
|
187 |
-
undo_btn="Undo",
|
188 |
-
clear_btn="Clear",
|
189 |
-
submit_btn="Send",
|
190 |
-
title="Chat with various models using llama.cpp",
|
191 |
-
description=description,
|
192 |
-
chatbot=gr.Chatbot(
|
193 |
-
scale=1,
|
194 |
-
likeable=False,
|
195 |
-
show_copy_button=True
|
196 |
)
|
197 |
-
)
|
198 |
|
199 |
if __name__ == "__main__":
|
200 |
demo.launch()
|
|
|
133 |
</center></p>
|
134 |
"""
|
135 |
|
136 |
+
# 各モデルに対応する説明を定義
|
137 |
+
model_descriptions = {
|
138 |
+
"Oumuamua-7b-RP_Q4_K_M.gguf": "This is the Oumuamua-7b-RP_Q4_K_M model description.",
|
139 |
+
"Oumuamua-7b-instruct-v2-Q4_K_M.gguf": "This is the Oumuamua-7b-instruct-v2-Q4_K_M model description.",
|
140 |
+
"umiyuki-Umievo-itr012-Gleipnir-7B-Q4_K_M.gguf": "This is the umiyuki-Umievo-itr012-Gleipnir-7B-Q4_K_M model description.",
|
141 |
+
"Ninja-V3-Q4_K_M.gguf": "This is the Ninja-V3-Q4_K_M model description.",
|
142 |
+
"kagemusya-7b-v1Q8_0.gguf": "This is the kagemusya-7b-v1Q8_0 model description.",
|
143 |
+
"Llama-3-ELYZA-JP-8B-q4_k_m.gguf": "This is the Llama-3-ELYZA-JP-8B-q4_k_m model description."
|
144 |
+
}
|
145 |
+
|
146 |
templates = [
|
147 |
"MISTRAL", "CHATML", "VICUNA", "LLAMA_2", "SYNTHIA",
|
148 |
"NEURAL_CHAT", "SOLAR", "OPEN_CHAT", "ALPACA", "CODE_DS",
|
149 |
"B22", "LLAMA_3", "PHI_3"
|
150 |
]
|
151 |
|
152 |
+
def update_description(model_name):
|
153 |
+
return model_descriptions.get(model_name, "No description available.")
|
154 |
+
|
155 |
+
with gr.Blocks() as demo:
|
156 |
+
description = gr.Markdown("")
|
157 |
+
|
158 |
+
model_dropdown = gr.Dropdown(
|
159 |
+
choices=list(model_descriptions.keys()),
|
160 |
+
value="Oumuamua-7b-RP_Q4_K_M.gguf",
|
161 |
+
label="Model"
|
162 |
+
)
|
163 |
+
|
164 |
+
model_dropdown.change(fn=update_description, inputs=model_dropdown, outputs=description)
|
165 |
+
|
166 |
+
gr.ChatInterface(
|
167 |
+
respond,
|
168 |
+
additional_inputs=[
|
169 |
+
model_dropdown,
|
170 |
+
gr.Dropdown(
|
171 |
+
choices=templates,
|
172 |
+
value="LLAMA_2",
|
173 |
+
label="Template"
|
174 |
+
),
|
175 |
+
gr.Textbox(value="You are a helpful assistant.", label="System message"),
|
176 |
+
gr.Slider(minimum=1, maximum=4096, value=2048, step=1, label="Max tokens"),
|
177 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
178 |
+
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p"),
|
179 |
+
gr.Slider(minimum=0, maximum=100, value=40, step=1, label="Top-k"),
|
180 |
+
gr.Slider(minimum=0.0, maximum=2.0, value=1.1, step=0.1, label="Repetition penalty"),
|
181 |
+
],
|
182 |
+
retry_btn="Retry",
|
183 |
+
undo_btn="Undo",
|
184 |
+
clear_btn="Clear",
|
185 |
+
submit_btn="Send",
|
186 |
+
title="Chat with various models using llama.cpp",
|
187 |
+
description=description,
|
188 |
+
chatbot=gr.Chatbot(scale=1, likeable=False, show_copy_button=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
)
|
|
|
190 |
|
191 |
if __name__ == "__main__":
|
192 |
demo.launch()
|