Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,7 @@ gpt_neox_tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-neox-20b")
|
|
| 7 |
llama_tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/llama-tokenizer")
|
| 8 |
falcon_tokenizer = AutoTokenizer.from_pretrained("tiiuae/falcon-7b")
|
| 9 |
phi2_tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-2")
|
|
|
|
| 10 |
|
| 11 |
def tokenize(input_text):
|
| 12 |
gpt2_tokens = gpt2_tokenizer(input_text, add_special_tokens=True)["input_ids"]
|
|
@@ -14,8 +15,9 @@ def tokenize(input_text):
|
|
| 14 |
llama_tokens = llama_tokenizer(input_text, add_special_tokens=True)["input_ids"]
|
| 15 |
falcon_tokens = falcon_tokenizer(input_text, add_special_tokens=True)["input_ids"]
|
| 16 |
phi2_tokens = phi2_tokenizer(input_text, add_special_tokens=True)["input_ids"]
|
|
|
|
| 17 |
|
| 18 |
-
return f"GPT-2/GPT-J: {len(gpt2_tokens)}\nGPT-NeoX: {len(gpt_neox_tokens)}\nLLaMa: {len(llama_tokens)}\nFalcon: {len(falcon_tokens)}\nPhi-2: {len(phi2_tokens)}"
|
| 19 |
|
| 20 |
iface = gr.Interface(fn=tokenize, inputs=gr.Textbox(lines=7), outputs="text")
|
| 21 |
iface.launch()
|
|
|
|
| 7 |
llama_tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/llama-tokenizer")
|
| 8 |
falcon_tokenizer = AutoTokenizer.from_pretrained("tiiuae/falcon-7b")
|
| 9 |
phi2_tokenizer = AutoTokenizer.from_pretrained("microsoft/phi-2")
|
| 10 |
+
t5_tokenizer = AutoTokenizer.from_pretrained("google/flan-t5-xxl")
|
| 11 |
|
| 12 |
def tokenize(input_text):
|
| 13 |
gpt2_tokens = gpt2_tokenizer(input_text, add_special_tokens=True)["input_ids"]
|
|
|
|
| 15 |
llama_tokens = llama_tokenizer(input_text, add_special_tokens=True)["input_ids"]
|
| 16 |
falcon_tokens = falcon_tokenizer(input_text, add_special_tokens=True)["input_ids"]
|
| 17 |
phi2_tokens = phi2_tokenizer(input_text, add_special_tokens=True)["input_ids"]
|
| 18 |
+
t5_tokens = t5_tokenizer(input_text, add_special_tokens=True)["input_ids"]
|
| 19 |
|
| 20 |
+
return f"GPT-2/GPT-J: {len(gpt2_tokens)}\nGPT-NeoX: {len(gpt_neox_tokens)}\nLLaMa: {len(llama_tokens)}\nFalcon: {len(falcon_tokens)}\nPhi-2: {len(phi2_tokens)}\nT5: {len(t5_tokens)}"
|
| 21 |
|
| 22 |
iface = gr.Interface(fn=tokenize, inputs=gr.Textbox(lines=7), outputs="text")
|
| 23 |
iface.launch()
|