Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
-
|
2 |
-
from transformers import GPT2LMHeadModel
|
3 |
-
model_id = "gpt2"
|
4 |
|
|
|
5 |
model = GPT2LMHeadModel.from_pretrained(model_id)
|
|
|
6 |
|
7 |
text = "Hello"
|
|
|
8 |
|
9 |
outputs = model(**encoded_text)
|
|
|
1 |
+
from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
|
|
|
|
2 |
|
3 |
+
model_id = "gpt2"
|
4 |
model = GPT2LMHeadModel.from_pretrained(model_id)
|
5 |
+
tokenizer = GPT2Tokenizer.from_pretrained(model_id)
|
6 |
|
7 |
text = "Hello"
|
8 |
+
encoded_text = tokenizer(text, return_tensors="pt")
|
9 |
|
10 |
outputs = model(**encoded_text)
|