Spaces:
Build error
Build error
Commit
·
87bdb14
1
Parent(s):
9c1b483
removed the temperature
Browse files
app.py
CHANGED
|
@@ -43,7 +43,8 @@ def generate_text(prompt, max_length=100, num_samples=1, temperature=0.8):
|
|
| 43 |
break
|
| 44 |
|
| 45 |
logits = model(tokens)[0]
|
| 46 |
-
logits = logits[:, -1, :]
|
|
|
|
| 47 |
probs = F.softmax(logits, dim=-1)
|
| 48 |
|
| 49 |
# Top-k sampling
|
|
@@ -70,7 +71,7 @@ iface = gr.Interface(
|
|
| 70 |
gr.Textbox(label="Prompt", value="We are accounted poor citizens, the"),
|
| 71 |
gr.Slider(minimum=10, maximum=200, value=100, step=1, label="Max Length"),
|
| 72 |
gr.Slider(minimum=1, maximum=5, value=1, step=1, label="Number of Samples"),
|
| 73 |
-
gr.Slider(minimum=0.1, maximum=2.0, value=0.8, step=0.1, label="Temperature")
|
| 74 |
],
|
| 75 |
outputs=gr.Textbox(label="Generated Text"),
|
| 76 |
title="Shakespeare-style Text Generator",
|
|
|
|
| 43 |
break
|
| 44 |
|
| 45 |
logits = model(tokens)[0]
|
| 46 |
+
logits = logits[:, -1, :]
|
| 47 |
+
#logits = logits[:, -1, :] / temperature
|
| 48 |
probs = F.softmax(logits, dim=-1)
|
| 49 |
|
| 50 |
# Top-k sampling
|
|
|
|
| 71 |
gr.Textbox(label="Prompt", value="We are accounted poor citizens, the"),
|
| 72 |
gr.Slider(minimum=10, maximum=200, value=100, step=1, label="Max Length"),
|
| 73 |
gr.Slider(minimum=1, maximum=5, value=1, step=1, label="Number of Samples"),
|
| 74 |
+
#gr.Slider(minimum=0.1, maximum=2.0, value=0.8, step=0.1, label="Temperature")
|
| 75 |
],
|
| 76 |
outputs=gr.Textbox(label="Generated Text"),
|
| 77 |
title="Shakespeare-style Text Generator",
|