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

seg fault when predicting local uncertainty with trained sgp calculator #379

Open
aaronchen0316 opened this issue Sep 28, 2023 · 4 comments

Comments

@aaronchen0316
Copy link
Contributor

aaronchen0316 commented Sep 28, 2023

Describe the bug
I tried to predict the forces on a structure for testing purpose using an already trained sgp calculator/model. However, it threw a segmentation fault. I identified the seg fault happened at predict_local_uncertainties function in the sparse_gp.cpp.

My workflow is:

calculator, kernel = sgp_calculator.from_file('path-to-flare.json')
atoms = ASE.Atoms(species, positions, cells, pbc) # I also tried FLARE_Atoms.from_ase_atoms()
atoms.calc = calculator
atoms.calc.reset() # reset() because I saw this command frequently in otf.py; same seg fault without reset() 
force_pred = atoms.get_forces()

I tried to make a flare_pp.Structure object and predict_on_structure_descriptor() directly but it also threw a seg fault. Is the issue with "local" uncertainty estimate or there is a more efficient way to run a test set evaluation on existing sgp calculator/model? For example, should I supply a series of dft trajectories to OTF(trajectory) and use FakeMD to only predict properties

Thank you so much for your help!

NOTE: updated with better syntax

@YuuuXie
Copy link
Collaborator

YuuuXie commented Sep 28, 2023

Hi @aaronchen0316 , did you use this line to load the sgp model

calculator, kernels = sgp_calculator.from_file('path-to-flare.json')

Basically, make sure you have the "kernels" returned (even if not used) in the current work space.

If you just want to get the local uncertainties on a set of test structures, yes you can use FakeMD with a very large threshold and a warm start (by loading the SGP from file)

@aaronchen0316
Copy link
Contributor Author

Hi @YuuuXie thank you for your suggestion as always!

Yes I used the correct line to load the sgp model: calculator, kernels = sgp_calculator.from_file() I corrected the syntax in the original issue.

Yes, I was able to get around with seg fault by using OTF() with FakeMD and either large min_steps_with_model or a large threshold.

Thank you for confirming that, but the seg fault persists. Is there a problem with my workflow or difficult to load a sgp calculator and predict on a few isolated atomic structures?

Thank you!

@YuuuXie
Copy link
Collaborator

YuuuXie commented Jan 5, 2024

Just realized I forgot to reply to this thread. The seg fault can happen in different places, we encountered in the kernel, the structure etc. which might need to debug in specific case

@Tinrry
Copy link

Tinrry commented Jun 11, 2024

when i run otf_train.yaml,gnu compiler
image
this code cause segmentation fault, or run endless time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants