Commit
·
0cdb2ad
1
Parent(s):
1d66e54
Add top_k, update defaults for this model
Browse files
app.py
CHANGED
@@ -6,8 +6,8 @@ happy_gen = HappyGeneration("GPTNEO", "DarwinAnim8or/Pythia-Greentext-1.4b")
|
|
6 |
|
7 |
from happytransformer import GENSettings
|
8 |
|
9 |
-
def generate(text, length=100, penalty=3, temperature=0.8):
|
10 |
-
args_top_k = GENSettings(no_repeat_ngram_size=penalty, do_sample=True, top_k=
|
11 |
|
12 |
inputText = "Write a greentext from 4chan.org. The story should be like a bullet-point list using > as the start of each line. It must be funny and have a twist near the end.\n"
|
13 |
inputText += ">" + text + "\n>"
|
@@ -43,12 +43,13 @@ demo = gr.Interface(
|
|
43 |
gr.inputs.Textbox(lines=5, label="Input Text"),
|
44 |
gr.inputs.Slider(5, 200, label='Length', default=100, step=5),
|
45 |
gr.inputs.Slider(1, 10, label='no repeat ngram size', default=2, step=1),
|
46 |
-
gr.inputs.Slider(0.0, 1.0, label='Temperature - control randomness', default=0.
|
|
|
47 |
],
|
48 |
outputs=gr.outputs.Textbox(label="Generated Text"),
|
49 |
examples=examples,
|
50 |
-
title="
|
51 |
-
description="Using the 1.
|
52 |
)
|
53 |
|
54 |
demo.launch()
|
|
|
6 |
|
7 |
from happytransformer import GENSettings
|
8 |
|
9 |
+
def generate(text, length=100, penalty=3, temperature=0.8, topk=40):
|
10 |
+
args_top_k = GENSettings(no_repeat_ngram_size=penalty, do_sample=True, top_k=topk, temperature=temperature, max_length=length, early_stopping=True)
|
11 |
|
12 |
inputText = "Write a greentext from 4chan.org. The story should be like a bullet-point list using > as the start of each line. It must be funny and have a twist near the end.\n"
|
13 |
inputText += ">" + text + "\n>"
|
|
|
43 |
gr.inputs.Textbox(lines=5, label="Input Text"),
|
44 |
gr.inputs.Slider(5, 200, label='Length', default=100, step=5),
|
45 |
gr.inputs.Slider(1, 10, label='no repeat ngram size', default=2, step=1),
|
46 |
+
gr.inputs.Slider(0.0, 1.0, label='Temperature - control randomness', default=0.2, step=0.1),
|
47 |
+
gr.inputs.Slider(10, 100, label="top_k", default=40, step=10)
|
48 |
],
|
49 |
outputs=gr.outputs.Textbox(label="Generated Text"),
|
50 |
examples=examples,
|
51 |
+
title="Pythia-Greentext Playground",
|
52 |
+
description="Using the 1.4b size model. You may need to run it a few times in order to get something good!"
|
53 |
)
|
54 |
|
55 |
demo.launch()
|