Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
from threading import Thread
|
3 |
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline, TextIteratorStreamer
|
4 |
|
5 |
-
model_id = "rasyosef/gpt2-
|
6 |
|
7 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
8 |
model = AutoModelForCausalLM.from_pretrained(model_id)
|
@@ -27,11 +27,11 @@ def generate(prompt):
|
|
27 |
kwargs={
|
28 |
"text_inputs": prompt,
|
29 |
"max_new_tokens": max_new_tokens,
|
30 |
-
"temperature": 0.
|
31 |
"do_sample": True,
|
32 |
"top_k": 8,
|
33 |
"top_p": 0.8,
|
34 |
-
"repetition_penalty": 1.
|
35 |
"streamer": streamer
|
36 |
})
|
37 |
thread.start()
|
@@ -45,15 +45,14 @@ def generate(prompt):
|
|
45 |
with gr.Blocks(css="#prompt_textbox textarea {color: blue}") as demo:
|
46 |
gr.Markdown("""
|
47 |
# GPT2 Amharic
|
48 |
-
This is a demo for a smaller version of OpenAI's [gpt2](https://huggingface.co/openai-community/gpt2) decoder transformer model pretrained for
|
49 |
-
|
50 |
Please **enter a prompt** and click the **Generate** button to generate completions for the prompt.
|
51 |
#### Text generation parameters:
|
52 |
-
- `temperature` : **0.
|
53 |
- `do_sample` : **True**
|
54 |
- `top_k` : **8**
|
55 |
- `top_p` : **0.8**
|
56 |
-
- `repetition_penalty` : **1.
|
57 |
""")
|
58 |
|
59 |
prompt = gr.Textbox(label="Prompt", placeholder="Enter prompt here", lines=4, interactive=True, elem_id="prompt_textbox")
|
|
|
2 |
from threading import Thread
|
3 |
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline, TextIteratorStreamer
|
4 |
|
5 |
+
model_id = "rasyosef/gpt2-medium-amharic-28k-512"
|
6 |
|
7 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
8 |
model = AutoModelForCausalLM.from_pretrained(model_id)
|
|
|
27 |
kwargs={
|
28 |
"text_inputs": prompt,
|
29 |
"max_new_tokens": max_new_tokens,
|
30 |
+
"temperature": 0.4,
|
31 |
"do_sample": True,
|
32 |
"top_k": 8,
|
33 |
"top_p": 0.8,
|
34 |
+
"repetition_penalty": 1.4,
|
35 |
"streamer": streamer
|
36 |
})
|
37 |
thread.start()
|
|
|
45 |
with gr.Blocks(css="#prompt_textbox textarea {color: blue}") as demo:
|
46 |
gr.Markdown("""
|
47 |
# GPT2 Amharic
|
48 |
+
This is a demo for a smaller version of OpenAI's [gpt2](https://huggingface.co/openai-community/gpt2) decoder transformer model pretrained for 2 days on `290 million` tokens of **Amharic** text. The context size of [gpt2-medium-amharic](https://huggingface.co/rasyosef/gpt2-medium-amharic-28k-512) is 512 tokens. This is a base model and hasn't undergone any supervised finetuing yet.
|
|
|
49 |
Please **enter a prompt** and click the **Generate** button to generate completions for the prompt.
|
50 |
#### Text generation parameters:
|
51 |
+
- `temperature` : **0.4**
|
52 |
- `do_sample` : **True**
|
53 |
- `top_k` : **8**
|
54 |
- `top_p` : **0.8**
|
55 |
+
- `repetition_penalty` : **1.4**
|
56 |
""")
|
57 |
|
58 |
prompt = gr.Textbox(label="Prompt", placeholder="Enter prompt here", lines=4, interactive=True, elem_id="prompt_textbox")
|