DeepRank / deeprank2

An open-source deep learning framework for data mining of protein-protein interfaces or single-residue variants.
https://deeprank2.readthedocs.io/en/latest/?badge=latest
Apache License 2.0
32 stars 12 forks source link

fix: OSError when retrieving source code for lambda functions #606

Closed gcroci2 closed 3 months ago

gcroci2 commented 3 months ago

While training a big network I got: OSError: could not get source code from the _save_model() method of the Trainer class, in particular when we do str_expr = inspect.getsource(key["transform"]). The error indicates that the inspect module is unable to retrieve the source code for the lambda function stored in key["transform"].

coveralls commented 3 months ago

Coverage Status

coverage: 83.933% (-0.1%) from 84.071% when pulling 3183e417754620d472c359cc26261f45948b8db5 on fix_inspect_function_trainer_gcroci2 into e422fb387e2b65d910a3488fda193c5112d5223c on main.

gcroci2 commented 3 months ago
  • I fixed it by using dill to serialize and deserialize the functions, which appears to be more reliable.

It's not completely clear to me what this does, but if it works now, I'm happy to accept the change.

I hope it's clearer but in case we can have a chat about this :)

Given that we have much less time for this project now, maybe we can discuss fixing versions of many packages to avoid similar problems in the future? Also given that development of this package will slow down, at least for the moment, and current package versions work well with what we are currently doing, it may be less important to stay up to date with newest package versions. This would be a separate PR though.

Very good point, I opened issue #607 :)