error line 200, in from_pretrained assert len(keys) == len(sd)
Sandy4321 opened this issue · comments
Python 3.10.11
code
import torch
from transformers import GPT2Tokenizer, GPT2LMHeadModel
from mingpt.model import GPT
from mingpt.utils import set_seed
from mingpt.bpe import BPETokenizer
set_seed(3407)
use_mingpt = True # use minGPT or huggingface/transformers model?
model_type = 'gpt2-xl'
device = 'cuda'
if use_mingpt:
model = GPT.from_pretrained(model_type)
else:
model = GPT2LMHeadModel.from_pretrained(model_type)
model.config.pad_token_id = model.config.eos_token_id # suppress a warning
ship model to device and set to eval mode
model.to(device)
model.eval();
q = 0
mingpt-master\mingpt-master\s_mingpt_jan21.py", line 15, in
model = GPT.from_pretrained(model_type)
File "c:\mingpt-master\mingpt-master\mingpt\model.py", line 200, in from_pretrained
assert len(keys) == len(sd)
builtins.AssertionError
I have the same issue.
is it fixed?
It was fixed in here #120 and also the reason of the error.