Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errror running example job #75

Closed
irleader opened this issue Sep 9, 2022 · 6 comments · Fixed by #68
Closed

Errror running example job #75

irleader opened this issue Sep 9, 2022 · 6 comments · Fixed by #68
Labels
bug Something isn't working

Comments

@irleader
Copy link

irleader commented Sep 9, 2022

When running the provided following command:
casanovo --mode=denovo --model=22-07-02_weights/pretrained_excl_mouse.ckpt --peak_path=sample_data/sample_preprocessed_spectra.mgf --config=casanovo/config.yaml

This error shows:
File "D:\miniconda3\lib\site-packages\torch\nn\modules\module.py", line 1497, in load_state_dict
raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Spec2Pep:
size mismatch for decoder.aa_encoder.weight: copying a param with shape torch.Size([25, 512]) from checkpoint, the shape in current model is torch.Size([29, 512]).
size mismatch for decoder.final.weight: copying a param with shape torch.Size([25, 512]) from checkpoint, the shape in current model is torch.Size([29, 512]).
size mismatch for decoder.final.bias: copying a param with shape torch.Size([25]) from checkpoint, the shape in current model is torch.Size([29]).

Did you recently updated depthcharge-ms, the pretrained weights, the sample .mgf file or config.yaml?
Shall I try any older version of any of these files? Thanks!

@bittremieux
Copy link
Collaborator

bittremieux commented Sep 9, 2022

The latest version of the code is no longer compatible with the pretrained weights because we did indeed recently change some things there. Rather than installing from the latest commit, if you install from a release and use weights provided there everything should be consistent.

Apologies for this confusion. A new and better version is coming soon, but in the mean time, some things are a bit in flux.

@bittremieux bittremieux added the bug Something isn't working label Sep 9, 2022
@irleader
Copy link
Author

Hi,
I have been trying to run the latest release version 3.0.0 with new codes and new model weights provided (casanovo_massivekb.ckpt).

I tried different peak files provided as well:

casanovo --mode=denovo --model=2022-10-10_weights/casanovo_massivekb.ckpt --peak_path=Casanovo_preprocessed_data/preproc.high.mouse.PXD004948.mgf --config=casanovo/config.yaml
casanovo --mode=denovo --model=2022-10-10_weights/casanovo_massivekb.ckpt --peak_path=sample_data/sample_preprocessed_spectra.mgf --config=casanovo/config.yaml

I encounter same error every time as follows:

Traceback (most recent call last):
File "D:\miniconda3\Scripts\casanovo-script.py", line 33, in
sys.exit(load_entry_point('casanovo==0.0.0', 'console_scripts', 'casanovo')())
File "D:\miniconda3\lib\site-packages\click\core.py", line 1128, in call
return self.main(*args, **kwargs)
File "D:\miniconda3\lib\site-packages\click\core.py", line 1053, in main
rv = self.invoke(ctx)
File "D:\miniconda3\lib\site-packages\click\core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "D:\miniconda3\lib\site-packages\click\core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "D:\miniconda3\lib\site-packages\casanovo-0.0.0-py3.9.egg\casanovo\casanovo.py", line 191, in main
model_runner.predict(peak_path, model, config, writer)
File "D:\miniconda3\lib\site-packages\casanovo-0.0.0-py3.9.egg\casanovo\denovo\model_runner.py", line 43, in predict
_execute_existing(peak_path, model_filename, config, False, out_writer)
File "D:\miniconda3\lib\site-packages\casanovo-0.0.0-py3.9.egg\casanovo\denovo\model_runner.py", line 134, in _execute_existing
index = SpectrumIdx(
TypeError: init() got an unexpected keyword argument 'valid_charge'

Please kindly indicate which step I might did wrong. Thanks!

@VarunAnanth2003
Copy link
Contributor

Hi! I have encountered this bug before, and have found that uninstalling and then reinstalling the PyPI package depthcharge-ms fixes the problem. You can do this by typing into the terminal pip uninstall depthcharge-ms and then pip install depthcharge-ms. If this does not work, then repeat the steps but also uninstall and reinstall casanovo. Hope this helps!

@irleader
Copy link
Author

Thanks a lot! It works for me. By the way, would you please provide more information on "casanovo_massivekb.ckpt"? How it this trained, on which datasets?

@melihyilmaz
Copy link
Collaborator

melihyilmaz commented Oct 25, 2022

Hi,
The model was trained on a subset of MassIVE-KB dataset. This subset consists of ~30M high quality human PSMs.

@irleader
Copy link
Author

Thanks for your information! I will close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants