Degiacomi-Lab / molearn

protein conformational spaces meet machine learning
https://degiacomi.org/software/molearn/
GNU General Public License v3.0
40 stars 11 forks source link

[JOSS] Examples #8

Closed RMeli closed 1 year ago

RMeli commented 1 year ago

Running analysis_example.py in the examples/ folder results in the following error:

FileNotFoundError: [Errno 2] No such file or directory: 'xbb_foldingnet_checkpoints\\checkpoint_no_optimizer_state_dict_epoch167_loss0.003259085263643.ckpt'

This happens similarly for the following paths: https://github.com/Degiacomi-Lab/molearn/blob/070520c52945427efef070b28c55805330c98f92/examples/analysis_example.py#L32-L33

I'd suggest to use os.path.join to concatenate paths.


https://github.com/openjournals/joss-reviews/issues/5523

RMeli commented 1 year ago

This is a bonus and not required at all for JOSS, but would it be possible to add a plotting output for the analysis script?

https://github.com/Degiacomi-Lab/molearn/blob/070520c52945427efef070b28c55805330c98f92/examples/analysis_example.py#L50-L58

The "generating error landscape" phase takes some time so the suspense runs high and it's a bit deceiving not to get any output. =)

RMeli commented 1 year ago

When running bb_example_subclassing_trainer.py I get the following error:

Traceback (most recent call last):
  File "/home/rmeli/git/molearn/examples/bb_example_subclassing_trainer.py", line 127, in <module>
    trainer.run(max_epochs = 32+trainer.epoch,**runkwargs)
  File "/home/rmeli/git/molearn/src/molearn/trainers/trainer.py", line 181, in run
    logs.update(self.valid_epoch(epoch))
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rmeli/git/molearn/examples/bb_example_subclassing_trainer.py", line 87, in valid_epoch
    results['valid_DOPE'] = dope[:,0].mean()
                            ~~~~^^^^^
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

Printing the shape of dope I get (8,).

SCMusson commented 1 year ago

I apologise for the delayed reply.

commit ceff082 should add os.sep to file names in analysis_example.py. This was simply a mistake on our part.

commit 9ccea59 should add some simple plots. I agree it's a bit disappointing to run the script and get nothing at the end.

commit 68f788c should fix bb_example_subclassing_trainer.py this is a simple bug due to the default behaviour of refine=True changing and this script not being updated to reflect that change. Previously the returned array would have been of shape [n, 2] where dope[:, 0] would be unrefined dope scores and dope[:, 1] would be refined dope scores. While the new behaviour returns an array of shape [n,] with only the refined structures. I have updated the script to use the old behaviour by passing refine = 'both'.

RMeli commented 1 year ago

Thank you @SCMusson for fixing the few issues and for adding some simple plots, everything seems to work well now.

To avoid this kind of problems in the future (example scripts not following the changes in the code base), it might be worth thinking of testing them in CI (maybe only a few training step with a reduced model and data set).