Update app.py
Browse files
app.py
CHANGED
@@ -6,8 +6,7 @@ import torch
|
|
6 |
# Load tokenizer
|
7 |
tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
|
8 |
tokenizer.pad_token = tokenizer.eos_token
|
9 |
-
|
10 |
-
model.eval()
|
11 |
|
12 |
# Load model
|
13 |
model = TransformerModel(
|
@@ -17,6 +16,8 @@ model = TransformerModel(
|
|
17 |
num_heads=16,
|
18 |
dropout=0.1
|
19 |
)
|
|
|
|
|
20 |
|
21 |
|
22 |
# Define generation function
|
|
|
6 |
# Load tokenizer
|
7 |
tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
|
8 |
tokenizer.pad_token = tokenizer.eos_token
|
9 |
+
|
|
|
10 |
|
11 |
# Load model
|
12 |
model = TransformerModel(
|
|
|
16 |
num_heads=16,
|
17 |
dropout=0.1
|
18 |
)
|
19 |
+
model.load_state_dict(torch.load("Conv_GPT.pth", map_location=torch.device('cpu')))
|
20 |
+
model.eval()
|
21 |
|
22 |
|
23 |
# Define generation function
|