File size: 283 Bytes
a487402
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
import transformers
from transformers import GPT2LMHeadModel, GPT2Tokenizer
import torch


model_name_or_path = 'pages/models/gpt'
tokenizer = GPT2Tokenizer.from_pretrained('sberbank-ai/rugpt3small_based_on_gpt2')
model = GPT2LMHeadModel.from_pretrained(model_name_or_path).to('cpu')