Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,7 +14,6 @@ def generate(
|
|
| 14 |
temperature=0.4,
|
| 15 |
top_p=0.95,
|
| 16 |
top_k=50,
|
| 17 |
-
repetition_penalty=1.1,
|
| 18 |
max_new_tokens=256,
|
| 19 |
):
|
| 20 |
pipe = load_model(model_name)
|
|
@@ -27,7 +26,7 @@ def generate(
|
|
| 27 |
else:
|
| 28 |
prompt = f"<|im_start|>user\n{user_input}<|im_end|>\n<|im_start|>assistant\n"
|
| 29 |
outputs = pipe(prompt, max_new_tokens=max_new_tokens, do_sample=True,
|
| 30 |
-
temperature=temperature, top_k=top_k, top_p=top_p
|
| 31 |
return outputs[0]["generated_text"]
|
| 32 |
|
| 33 |
model_choices = ["Locutusque/OpenCerebrum-1.0-7B-beta", "M4-ai/NeuralReyna-Mini-1.8B-v0.2", "Locutusque/Hyperion-3.0-Mistral-7B-DPO", "Locutusque/Hyperion-3.0-Mistral-7B-alpha", "M4-ai/tau-1.8B", "Locutusque/Hercules-4.0-Mistral-v0.2-7B", "Locutusque/Hercules-2.5-Mistral-7B", "M4-ai/tau-0.5B"]
|
|
@@ -38,7 +37,6 @@ g = gr.Interface(
|
|
| 38 |
gr.components.Dropdown(choices=model_choices, label="Model", value=model_choices[0], interactive=True),
|
| 39 |
gr.components.Textbox(lines=2, label="Prompt", value="Write me a Python program that calculates the factorial of a given number."),
|
| 40 |
gr.components.Slider(minimum=0, maximum=1, value=0.4, label="Temperature"),
|
| 41 |
-
gr.components.Slider(minimum=1, maximum=2, value=1.1, label="Repetition Penalty"),
|
| 42 |
gr.components.Slider(minimum=0, maximum=1, value=0.95, label="Top p"),
|
| 43 |
gr.components.Slider(minimum=0, maximum=100, step=1, value=50, label="Top k"),
|
| 44 |
gr.components.Slider(minimum=1, maximum=2048, step=1, value=1024, label="Max tokens"),
|
|
|
|
| 14 |
temperature=0.4,
|
| 15 |
top_p=0.95,
|
| 16 |
top_k=50,
|
|
|
|
| 17 |
max_new_tokens=256,
|
| 18 |
):
|
| 19 |
pipe = load_model(model_name)
|
|
|
|
| 26 |
else:
|
| 27 |
prompt = f"<|im_start|>user\n{user_input}<|im_end|>\n<|im_start|>assistant\n"
|
| 28 |
outputs = pipe(prompt, max_new_tokens=max_new_tokens, do_sample=True,
|
| 29 |
+
temperature=temperature, top_k=top_k, top_p=top_p)
|
| 30 |
return outputs[0]["generated_text"]
|
| 31 |
|
| 32 |
model_choices = ["Locutusque/OpenCerebrum-1.0-7B-beta", "M4-ai/NeuralReyna-Mini-1.8B-v0.2", "Locutusque/Hyperion-3.0-Mistral-7B-DPO", "Locutusque/Hyperion-3.0-Mistral-7B-alpha", "M4-ai/tau-1.8B", "Locutusque/Hercules-4.0-Mistral-v0.2-7B", "Locutusque/Hercules-2.5-Mistral-7B", "M4-ai/tau-0.5B"]
|
|
|
|
| 37 |
gr.components.Dropdown(choices=model_choices, label="Model", value=model_choices[0], interactive=True),
|
| 38 |
gr.components.Textbox(lines=2, label="Prompt", value="Write me a Python program that calculates the factorial of a given number."),
|
| 39 |
gr.components.Slider(minimum=0, maximum=1, value=0.4, label="Temperature"),
|
|
|
|
| 40 |
gr.components.Slider(minimum=0, maximum=1, value=0.95, label="Top p"),
|
| 41 |
gr.components.Slider(minimum=0, maximum=100, step=1, value=50, label="Top k"),
|
| 42 |
gr.components.Slider(minimum=1, maximum=2048, step=1, value=1024, label="Max tokens"),
|