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

AttributeError: Can't pickle local object 'preprocess_dataset.<locals>.<lambda>' #3

Closed
Zbless opened this issue Feb 21, 2023 · 2 comments

Comments

@Zbless
Copy link

Zbless commented Feb 21, 2023

hi,Please ask me a question. I really run your code on the Windows platform. When I download the data and process it, the following problems occur. How can I solve them? You know, I look forward to your reply.
Pre-processing data...
INFO:root:Processed: 0 / 133885...
Traceback (most recent call last):
File "D:/py_project/cG-SchNet/gschnet_cond_script.py", line 976, in
main(args)
File "D:/py_project/cG-SchNet/gschnet_cond_script.py", line 861, in main
load_additionally=load_additionally)
File "D:\py_project\cG-SchNet\qm9_data.py", line 109, in init
units=self.units, download=download)
File "D:\software\Anaconda3\envs\cgschnet\lib\site-packages\schnetpack\datasets_init_.py", line 56, in init
self.download()
File "D:\software\Anaconda3\envs\cgschnet\lib\site-packages\schnetpack\datasets_init_.py", line 72, in download
self._download()
File "D:\py_project\cG-SchNet\qm9_data.py", line 225, in _download
works = works and self._preprocess_qm9()
File "D:\py_project\cG-SchNet\qm9_data.py", line 336, in _preprocess_qm9
invalid_list=invalid_list)
File "D:\py_project\cG-SchNet\preprocess_dataset.py", line 425, in preprocess_dataset
threads[-1].start()
File "D:\software\Anaconda3\envs\cgschnet\lib\multiprocessing\process.py", line 112, in start
self._popen = self._Popen(self)
File "D:\software\Anaconda3\envs\cgschnet\lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "D:\software\Anaconda3\envs\cgschnet\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "D:\software\Anaconda3\envs\cgschnet\lib\multiprocessing\popen_spawn_win32.py", line 89, in init
reduction.dump(process_obj, to_child)
File "D:\software\Anaconda3\envs\cgschnet\lib\multiprocessing\reduction.py", line 62, in dump
ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'preprocess_dataset..'

@NiklasGebauer
Copy link
Collaborator

Hi,
it seems as if the multi-threading in the pre-processing does not work on your machine (not sure if it is a problem of packages or Windows in general as I only tested the code on Linux systems).
You can deactivate the multi-threading by setting n_threads=0 in line 310 of qm9_data.py:

n_threads=8, n_mols_per_thread=125, logging_print=True,

Pre-processing will take a bit longer but this should prevent the error.

@Zbless
Copy link
Author

Zbless commented Feb 22, 2023

Thank you very much. It works

@Zbless Zbless closed this as completed Feb 22, 2023
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

2 participants