Commit
·
f026dba
1
Parent(s):
a5e42e5
use GPT2 instead of T5
Browse files
app.py
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
from transformers import AutoTokenizer,
|
4 |
import numpy as np
|
5 |
|
6 |
|
7 |
-
MODEL_NAME = "
|
8 |
|
9 |
|
10 |
if __name__ == "__main__":
|
11 |
# Define your model and your tokenizer
|
12 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
|
13 |
-
model =
|
14 |
if tokenizer.pad_token_id is None:
|
15 |
tokenizer.pad_token_id = tokenizer.eos_token_id
|
16 |
model.config.pad_token_id = model.config.eos_token_id
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
4 |
import numpy as np
|
5 |
|
6 |
|
7 |
+
MODEL_NAME = "gpt2"
|
8 |
|
9 |
|
10 |
if __name__ == "__main__":
|
11 |
# Define your model and your tokenizer
|
12 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
|
13 |
+
model = AutoModelForCausalLM.from_pretrained(MODEL_NAME) # or AutoModelForCausalLM
|
14 |
if tokenizer.pad_token_id is None:
|
15 |
tokenizer.pad_token_id = tokenizer.eos_token_id
|
16 |
model.config.pad_token_id = model.config.eos_token_id
|