Spaces:
Sleeping
Sleeping
change to tiny-gpt2
Browse files
app.py
CHANGED
@@ -10,10 +10,14 @@ import torch
|
|
10 |
#model = AutoModelForCausalLM.from_pretrained("openai-community/gpt2")
|
11 |
|
12 |
# distilgpt2 is only 80MB
|
13 |
-
tokenizer = AutoTokenizer.from_pretrained("distilgpt2")
|
14 |
-
model = AutoModelForCausalLM.from_pretrained("distilgpt2")
|
15 |
|
|
|
|
|
|
|
16 |
|
|
|
17 |
def text_to_emoji(text):
|
18 |
# remove special characters
|
19 |
text_cleaned = re.sub(r"[.,!?;:]", "", text)
|
|
|
10 |
#model = AutoModelForCausalLM.from_pretrained("openai-community/gpt2")
|
11 |
|
12 |
# distilgpt2 is only 80MB
|
13 |
+
#tokenizer = AutoTokenizer.from_pretrained("distilgpt2")
|
14 |
+
#model = AutoModelForCausalLM.from_pretrained("distilgpt2")
|
15 |
|
16 |
+
# tiny-gpt2 is only 20MB
|
17 |
+
tokenizer = AutoTokenizer.from_pretrained("sshleifer/tiny-gpt2")
|
18 |
+
model = AutoModelForCausalLM.from_pretrained("sshleifer/tiny-gpt2")
|
19 |
|
20 |
+
# conversion method
|
21 |
def text_to_emoji(text):
|
22 |
# remove special characters
|
23 |
text_cleaned = re.sub(r"[.,!?;:]", "", text)
|