Spaces:
Sleeping
Sleeping
Update pages/gpt.py
Browse files- pages/gpt.py +7 -9
pages/gpt.py
CHANGED
@@ -1,15 +1,13 @@
|
|
1 |
from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
2 |
|
3 |
-
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
|
4 |
-
model = GPT2LMHeadModel.from_pretrained('model.ph')
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
|
14 |
|
15 |
import torch
|
|
|
1 |
from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
2 |
|
|
|
|
|
3 |
|
4 |
+
model = GPT2LMHeadModel.from_pretrained(
|
5 |
+
'sberbank-ai/rugpt3small_based_on_gpt2',
|
6 |
+
output_attentions = False,
|
7 |
+
output_hidden_states = False,
|
8 |
+
)
|
9 |
+
# Вешаем сохраненные веса на нашу модель
|
10 |
+
model.load_state_dict(torch.load('model.pt'))
|
11 |
|
12 |
|
13 |
import torch
|