reshav1 commited on
Commit
d6bf94d
·
verified ·
1 Parent(s): 9b1d780

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1,9 +1,10 @@
1
- import transformers
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)