Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,6 +14,7 @@ def generate(
|
|
| 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)
|
|
@@ -24,7 +25,7 @@ def generate(
|
|
| 24 |
else:
|
| 25 |
prompt = f"<|im_start|>user\n{user_input}<|im_end|>\n<|im_start|>assistant\n"
|
| 26 |
outputs = pipe(prompt, max_new_tokens=max_new_tokens, do_sample=True,
|
| 27 |
-
temperature=temperature, top_k=top_k, top_p=top_p, repetition_penalty=
|
| 28 |
return outputs[0]["generated_text"]
|
| 29 |
|
| 30 |
model_choices = ["Locutusque/Hyperion-3.0-Mixtral-3x7B", "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"]
|
|
@@ -35,6 +36,7 @@ g = gr.Interface(
|
|
| 35 |
gr.components.Dropdown(choices=model_choices, label="Model", value=model_choices[0], interactive=True),
|
| 36 |
gr.components.Textbox(lines=2, label="Prompt", value="Write me a Python program that calculates the factorial of a given number."),
|
| 37 |
gr.components.Slider(minimum=0, maximum=1, value=0.4, label="Temperature"),
|
|
|
|
| 38 |
gr.components.Slider(minimum=0, maximum=1, value=0.95, label="Top p"),
|
| 39 |
gr.components.Slider(minimum=0, maximum=100, step=1, value=50, label="Top k"),
|
| 40 |
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 |
+
repetition_penalty=1.1,
|
| 18 |
max_new_tokens=256,
|
| 19 |
):
|
| 20 |
pipe = load_model(model_name)
|
|
|
|
| 25 |
else:
|
| 26 |
prompt = f"<|im_start|>user\n{user_input}<|im_end|>\n<|im_start|>assistant\n"
|
| 27 |
outputs = pipe(prompt, max_new_tokens=max_new_tokens, do_sample=True,
|
| 28 |
+
temperature=temperature, top_k=top_k, top_p=top_p, repetition_penalty=repetition_penalty)
|
| 29 |
return outputs[0]["generated_text"]
|
| 30 |
|
| 31 |
model_choices = ["Locutusque/Hyperion-3.0-Mixtral-3x7B", "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"]
|
|
|
|
| 36 |
gr.components.Dropdown(choices=model_choices, label="Model", value=model_choices[0], interactive=True),
|
| 37 |
gr.components.Textbox(lines=2, label="Prompt", value="Write me a Python program that calculates the factorial of a given number."),
|
| 38 |
gr.components.Slider(minimum=0, maximum=1, value=0.4, label="Temperature"),
|
| 39 |
+
gr.components.Slider(minimum=1, maximum=2, value=1.1, label="Repetition Penalty"),
|
| 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"),
|