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

yaml failed in constructing numpy object from checkpoint #4639

Closed
unkcpz opened this issue Dec 17, 2020 · 2 comments
Closed

yaml failed in constructing numpy object from checkpoint #4639

unkcpz opened this issue Dec 17, 2020 · 2 comments

Comments

@unkcpz
Copy link
Member

unkcpz commented Dec 17, 2020

I get the following exception after restarting the daemon:

....
               File "/data/CONDA_ENV/aiida-production/lib/python3.7/site-packages/yaml/constructor.py", line 570, in make_python_instance
                 node.start_mark)                                                      
             yaml.constructor.ConstructorError: while constructing a Python instance                                                                                          
             expected a class, but found <class 'builtin_function_or_method'>
               in "<unicode string>", line 10, column 30:
                   lowest_highest_eigenvalue: !!python/object/apply:numpy.core ...

In my workchain I set the self.ctx.lowest_highest_eigenvalue=np.amin(bands[:, -1]) and yaml refuse to load a function specified in the YAML(yaml/pyyaml#286). I guess this be also related to the switch to safe YAML loading(#3709)? @sphuber @greschd

My point is whether this can be fixed by in the workchain instead of registering ctx.lowest_highest_eigenvalue as a numpy function, get the value first and set it in the ctx, like:

v = np.amin(bands[:, -1])
self.ctx.lowest_highest_eigenvalue = v
@greschd
Copy link
Member

greschd commented Dec 17, 2020

This feels like a duplicate of #3709. Can you try applying the unsafe workaround mentioned there to confirm that it has the same root cause?

Given that it's now come up a few times, maybe we should increase the priority of that issue.

@unkcpz
Copy link
Member Author

unkcpz commented Dec 21, 2020

This feels like a duplicate of #3709. Can you try applying the unsafe workaround mentioned there to confirm that it has the same root cause?

Yes, that's the same issue. I'd better close this issue at the moment.

@unkcpz unkcpz closed this as completed Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants