Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,17 +3,21 @@ import gradio as gr
|
|
| 3 |
|
| 4 |
|
| 5 |
gpt2_tokenizer = AutoTokenizer.from_pretrained("gpt2")
|
| 6 |
-
gptj_tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6b")
|
| 7 |
gpt_neox_tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neox-20b")
|
| 8 |
llama_tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/llama-tokenizer")
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
def tokenize(input_text):
|
| 11 |
gpt2_tokens = gpt2_tokenizer(input_text)["input_ids"]
|
| 12 |
-
gptj_tokens = gptj_tokenizer(input_text)["input_ids"]
|
| 13 |
gpt_neox_tokens = gpt_neox_tokenizer(input_text)["input_ids"]
|
| 14 |
llama_tokens = llama_tokenizer(input_text)["input_ids"]
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
return f"GPT-2: {len(gpt2_tokens)}\nGPT-
|
| 17 |
|
| 18 |
iface = gr.Interface(fn=tokenize, inputs=gr.Textbox(lines=7), outputs="text")
|
| 19 |
iface.launch()
|
|
|
|
| 3 |
|
| 4 |
|
| 5 |
gpt2_tokenizer = AutoTokenizer.from_pretrained("gpt2")
|
|
|
|
| 6 |
gpt_neox_tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neox-20b")
|
| 7 |
llama_tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/llama-tokenizer")
|
| 8 |
+
yi_tokenizer = AutoTokenizer.from_pretrained("01-ai/Yi-34B")
|
| 9 |
+
yayi2_tokenizer = AutoTokenizer.from_pretrained("wenge-research/yayi2-30b")
|
| 10 |
+
phi2_tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-2")
|
| 11 |
|
| 12 |
def tokenize(input_text):
|
| 13 |
gpt2_tokens = gpt2_tokenizer(input_text)["input_ids"]
|
|
|
|
| 14 |
gpt_neox_tokens = gpt_neox_tokenizer(input_text)["input_ids"]
|
| 15 |
llama_tokens = llama_tokenizer(input_text)["input_ids"]
|
| 16 |
+
yi_tokens = llama_tokenizer(input_text)["input_ids"]
|
| 17 |
+
yayi2_tokens = yayi2_tokenizer(input_text)["input_ids"]
|
| 18 |
+
phi2_tokens = phi2_tokenizer(input_text)["input_ids"]
|
| 19 |
|
| 20 |
+
return f"GPT-2/GPT-J: {len(gpt2_tokens)}\nGPT-NeoX: {len(gpt_neox_tokens)}\nLLaMa: {len(llama_tokens)}\nYi: {len(yi_tokens)}\nYayi-2: {len(yayi2_tokens)}\nPhi-2: {len(phi2_tokens)}"
|
| 21 |
|
| 22 |
iface = gr.Interface(fn=tokenize, inputs=gr.Textbox(lines=7), outputs="text")
|
| 23 |
iface.launch()
|