ovito-org / ScoreBasedDenoising

This is a wrapper for OVITO around the "Score-based denoising for atomic structure identification" presented in this graphite repo. Further information and the official citation on arXiv.
Other
1 stars 1 forks source link

Compatibility for older python versions #1

Open jwjeffr opened 2 months ago

jwjeffr commented 2 months ago

Hello,

Would it be relatively easy to change the code to allow for compatibility with older python versions? From a quick glance it looks to me like the only problem with this is the match statements, which can be refactored to if/elif/else branches.

In my use case this is convenient because I am running on an HPC cluster with python 3.9, and installing a new python version without sudo is a bit of a pain, especially just for a single library

Thank you

nnn911 commented 2 months ago

Hi, The only limitation that comes to mind would be pytorch. I'm not sure whether they still support python 3.9. Apart from that, the code changes should be minimal. As a temporary workaround you can use ovitos or conda to get access to a newer python interpreter.

nnn911 commented 2 months ago

You may want to try the current version #4f337b4 and see if it works for you.

It should work with older python versions, however, I have some trouble installing the non-conda version on my local machine. So please let me know if it works for you.

jwjeffr commented 2 months ago

Hey Daniel,

There was still an issue with the importlib.resources call to grab the pretrained models. This doesn't seem to work on Python 3.9.12:

modelDir = impRes.files("graphite.pretrained_models.denoiser")

but this does, at least for my use case:

modelDir = impRes.files("graphite") / "pretrained_models" / "denoiser"

I don't know enough about the module to see why this fixes stuff. Maybe the dot syntax is relatively new?

I've opened a PR with the change here