wengong-jin / hgraph2graph

Hierarchical Generation of Molecular Graphs using Structural Motifs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

size mismatch when load chembl-pretrained ckpt

wuyongyi opened this issue · comments

can not load pretrained ckpt, and set strict = False does not help.

python generate.py --vocab vocab.txt --model ckpt/chembl-pretrained/model.ckpt --nsample 1000
/root/miniconda3/lib/python3.7/site-packages/torch/nn/_reduction.py:44: UserWarning: size_average and reduce args will be deprecated, please use reduction='sum' instead.
warnings.warn(warning.format(ret))
Traceback (most recent call last):
File "generate.py", line 44, in
model.load_state_dict(torch.load(args.model)[0] , strict = False)
File "/root/miniconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1045, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for HierVAE:
size mismatch for encoder.E_c.0.weight: copying a param with shape torch.Size([1578, 250]) from checkpoint, the shape in current model is torch.Size([1576, 250]).
size mismatch for encoder.E_i.0.weight: copying a param with shape torch.Size([5623, 250]) from checkpoint, the shape in current model is torch.Size([5625, 250]).
size mismatch for decoder.hmpn.E_c.0.weight: copying a param with shape torch.Size([1578, 250]) from checkpoint, the shape in current model is torch.Size([1576, 250]).
size mismatch for decoder.hmpn.E_i.0.weight: copying a param with shape torch.Size([5623, 250]) from checkpoint, the shape in current model is torch.Size([5625, 250]).
size mismatch for decoder.E_assm.0.weight: copying a param with shape torch.Size([5623, 250]) from checkpoint, the shape in current model is torch.Size([5625, 250]).
size mismatch for decoder.clsNN.3.weight: copying a param with shape torch.Size([1578, 250]) from checkpoint, the shape in current model is torch.Size([1576, 250]).
size mismatch for decoder.clsNN.3.bias: copying a param with shape torch.Size([1578]) from checkpoint, the shape in current model is torch.Size([1576]).
size mismatch for decoder.iclsNN.3.weight: copying a param with shape torch.Size([5623, 250]) from checkpoint, the shape in current model is torch.Size([5625, 250]).
size mismatch for decoder.iclsNN.3.bias: copying a param with shape torch.Size([5623]) from checkpoint, the shape in current model is torch.Size([5625]).