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/llama-3.2-amharic-
|
6 |
|
7 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
8 |
model = AutoModelForCausalLM.from_pretrained(model_id)
|
@@ -24,11 +24,11 @@ def generate(prompt):
|
|
24 |
"inputs": inputs["input_ids"],
|
25 |
"attention_mask": inputs["attention_mask"],
|
26 |
"max_new_tokens": max_new_tokens,
|
27 |
-
"temperature": 0.
|
28 |
"do_sample": True,
|
29 |
"top_k": 8,
|
30 |
"top_p": 0.8,
|
31 |
-
"repetition_penalty": 1.
|
32 |
"streamer": streamer,
|
33 |
"pad_token_id": tokenizer.pad_token_id,
|
34 |
"eos_token_id": tokenizer.eos_token_id
|
@@ -44,15 +44,15 @@ def generate(prompt):
|
|
44 |
with gr.Blocks(css="#prompt_textbox textarea {color: blue}") as demo:
|
45 |
gr.Markdown("""
|
46 |
# Llama 3.2 Amharic
|
47 |
-
This is a demo for [llama-3.2-amharic](https://huggingface.co/rasyosef/llama-3.2-amharic-
|
48 |
|
49 |
Please **enter a prompt** and click the **Generate** button to generate completions for the prompt.
|
50 |
#### Text generation parameters:
|
51 |
-
- `temperature` : **0.
|
52 |
- `do_sample` : **True**
|
53 |
- `top_k` : **8**
|
54 |
- `top_p` : **0.8**
|
55 |
-
- `repetition_penalty` : **1.
|
56 |
""")
|
57 |
|
58 |
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/llama-3.2-amharic-64k-1024"
|
6 |
|
7 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
8 |
model = AutoModelForCausalLM.from_pretrained(model_id)
|
|
|
24 |
"inputs": inputs["input_ids"],
|
25 |
"attention_mask": inputs["attention_mask"],
|
26 |
"max_new_tokens": max_new_tokens,
|
27 |
+
"temperature": 0.3,
|
28 |
"do_sample": True,
|
29 |
"top_k": 8,
|
30 |
"top_p": 0.8,
|
31 |
+
"repetition_penalty": 1.25,
|
32 |
"streamer": streamer,
|
33 |
"pad_token_id": tokenizer.pad_token_id,
|
34 |
"eos_token_id": tokenizer.eos_token_id
|
|
|
44 |
with gr.Blocks(css="#prompt_textbox textarea {color: blue}") as demo:
|
45 |
gr.Markdown("""
|
46 |
# Llama 3.2 Amharic
|
47 |
+
This is a demo for [llama-3.2-amharic](https://huggingface.co/rasyosef/llama-3.2-amharic-64k-1024), a smaller version of Meta's [Llama-3.2-1B](https://huggingface.co/meta-llama/Llama-3.2-1B) decoder transformer model pretrained for 3 days on `210 million` tokens of **Amharic** text. This model has `179 million` parameters and a context size of `1024` tokens. This is a base model and hasn't undergone any supervised finetuing yet.
|
48 |
|
49 |
Please **enter a prompt** and click the **Generate** button to generate completions for the prompt.
|
50 |
#### Text generation parameters:
|
51 |
+
- `temperature` : **0.3**
|
52 |
- `do_sample` : **True**
|
53 |
- `top_k` : **8**
|
54 |
- `top_p` : **0.8**
|
55 |
+
- `repetition_penalty` : **1.25**
|
56 |
""")
|
57 |
|
58 |
prompt = gr.Textbox(label="Prompt", placeholder="Enter prompt here", lines=4, interactive=True, elem_id="prompt_textbox")
|