jiaor17 / DiffCSP

[NeurIPS 2023] The implementation for the paper "Crystal Structure Prediction by Joint Equivariant Diffusion"
MIT License
59 stars 18 forks source link

Evaluation does not work #1

Open RomanovIgnat opened 8 months ago

RomanovIgnat commented 8 months ago

Hello! I am trying to reproduce your results, but command

python scripts/evaluate.py --model_path <model_path>

fails with error

TypeError: The classmethod `CrystGNN_Supervise.load_from_checkpoint` cannot be called on an instance. Please call it on the class type and make sure the return value is used.

Any advice would be much appreciated!

jiaor17 commented 8 months ago

Hi RomanovIgnat! It appears that you might use the property prediction model in prop_models directly for structure prediction. To resolve this issue, you should first train the CSP model by running the following command:

python diffcsp/run.py data=<dataset> expname=<expname>

After training the CSP model, you should be able to evaluate it without encountering the TypeError. Hope this could help you!

RomanovIgnat commented 8 months ago

Thanks a lot! But I still get an error

[2023-11-23 19:57:34,780][hydra.utils][INFO] - Instantiating <diffcsp.pl_modules.diffusion.CSPDiffusion>
[2023-11-23 19:57:35,421][torch.distributed.nn.jit.instantiator][INFO] - Created a temporary directory at /tmp/tmprttu07pg
[2023-11-23 19:57:35,423][torch.distributed.nn.jit.instantiator][INFO] - Writing /tmp/tmprttu07pg/_remote_module_non_scriptable.py
Error executing job with overrides: ['data=perov_5', 'expname=test_exp']
Error in call to target 'diffcsp.pl_modules.diffusion.CSPDiffusion':
InstantiationException("Error locating target 'diffcsp.pl_modules.cspnet.CSPNet', set env var HYDRA_FULL_ERROR=1 to see chained exception.\nfull_key: decoder")
full_key: model

I must be doing something wrong again?

jiaor17 commented 8 months ago

Sorry we haven't encountered this error before. To get a clearer understanding of the error, you can set the environment variable HYDRA_FULL_ERROR=1 to see the full traceback and more detailed information. You can set the environment variable by adding the following line to your .env file or executing it in your terminal before running the script:

export HYDRA_FULL_ERROR=1

After setting the environment variable, run your script again. This time, you should see more detailed error information, which will help us diagnose the issue further. If you're still having trouble, please share the additional error details, and we'll be happy to help you resolve the problem.

RomanovIgnat commented 7 months ago

Okay, I completely reinstalled all the dependencies and did exactly the same setup and now I get

pytorch_lightning.utilities.exceptions.MisconfigurationException: You requested GPUs: [0]
But your machine only has: []

So the question is, is it possible to use, for example, some kind of checkpoint to run on a local machine? If so, I would be very grateful!

jiaor17 commented 7 months ago

Hi, it appears that your local machine doesn't have a GPU, which is causing the MisconfigurationException. To address your question about using checkpoints: we provide pre-trained checkpoints for inference, which you can find here. However, please note that running on a CPU, rather than a GPU, can result in significantly longer inference times.

RomanovIgnat commented 7 months ago

Thank you very much!