Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,8 +28,6 @@ def generate(your_prompt, task_prefix, max_new_tokens, repetition_penalty, tempe
|
|
| 28 |
|
| 29 |
model.to(dtype)
|
| 30 |
|
| 31 |
-
repetition_penalty = float(repetition_penalty)
|
| 32 |
-
|
| 33 |
input_text = f"{task_prefix}: {your_prompt}"
|
| 34 |
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(device)
|
| 35 |
|
|
@@ -53,7 +51,7 @@ task_prefix = gr.Textbox(label="Task Prefix", info="The prompt prefix for how th
|
|
| 53 |
|
| 54 |
max_new_tokens = gr.Slider(value=512, minimum=250, maximum=512, step=1, label="Max New Tokens", info="The maximum numbers of new tokens, controls how long is the output")
|
| 55 |
|
| 56 |
-
repetition_penalty = gr.Slider(value=1.2, minimum=0, maximum=2.0, step=0.05, label="Repetition Penalty", info="Penalize repeated tokens, making the AI repeat less itself")
|
| 57 |
|
| 58 |
temperature = gr.Slider(value=0.7, minimum=0, maximum=1, step=0.05, label="Temperature", info="Higher values produce more diverse outputs")
|
| 59 |
|
|
|
|
| 28 |
|
| 29 |
model.to(dtype)
|
| 30 |
|
|
|
|
|
|
|
| 31 |
input_text = f"{task_prefix}: {your_prompt}"
|
| 32 |
input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(device)
|
| 33 |
|
|
|
|
| 51 |
|
| 52 |
max_new_tokens = gr.Slider(value=512, minimum=250, maximum=512, step=1, label="Max New Tokens", info="The maximum numbers of new tokens, controls how long is the output")
|
| 53 |
|
| 54 |
+
repetition_penalty = gr.Slider(value=1.2, minimum=0, maximum=2.0, step=0.05, precision=2, label="Repetition Penalty", info="Penalize repeated tokens, making the AI repeat less itself")
|
| 55 |
|
| 56 |
temperature = gr.Slider(value=0.7, minimum=0, maximum=1, step=0.05, label="Temperature", info="Higher values produce more diverse outputs")
|
| 57 |
|