horsepurve / DeepRTplus

Deep (Transfer) Learning for Peptide Retention Time Prediction
MIT License
50 stars 22 forks source link

RuntimeError: size mismatch for digit_capsules.route_weights #3

Open markmipt opened 5 years ago

markmipt commented 5 years ago

Hi!

I would like to try your software and started with simplest thing from tutorial: "5. Make prediction using the trained models".

My running command is: python3 prediction_emb_cpu.py 30 param_cpu/dia_all_epo20_dim24_conv10/dia_all_epo20_dim24_conv10_filled.pt 10 ~/DeepRT_test/test.txt , where test.txt contains only headers (sequence and RT) and single raw (PEPTIDE and 0). All separated by tab.

But I've got an error: Traceback (most recent call last): File "prediction_emb_cpu.py", line 83, in <module> obse,pred1=pred_from_model(conv1,conv1,round1model,RTtest,15) File "prediction_emb_cpu.py", line 17, in pred_from_model model.load_state_dict(torch.load(param_path)) File "/home/mark/virtualenv_deepRT/lib/python3.7/site-packages/torch/nn/modules/module.py", line 719, in load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for CapsuleNet: size mismatch for digit_capsules.route_weights: copying a param of torch.Size([1, 736, 8, 16]) from checkpoint, where the shape is torch.Size([1, 1248, 8, 16]) in current model.

What I'm doing wrong here?

Regards, Mark

horsepurve commented 5 years ago

Hello Mark,

This is due to the inconsistency between the maximum lengths of DIA data and your test data, so please (1) modify max_length to be 66 in config.py, (2) include at least two peptides in test.txt. Sorry for any inconvenience.

Best, Chunwei