AlCorreia/GeFs

TypeError: can't pickle Node objects

Closed this issue · 2 comments

N950 commented

Is the model not pickle-able ?
Could you please suggest how to save the model, or give a hint what objects that aren't pickle-able maybe I can get around it ?
Thanks

Traceback (most recent call last):
File "model_gefs.py", line 166, in save
pickle.dump(model, open(f"{path}/{filename}", mode='wb'))
File "C:\Users\asus\anaconda3\envs\dsa2\lib\site-packages\cloudpickle\cloudpickle_fast.py", line 88, in dump
CloudPickler(file, protocol=protocol).dump(obj)
File "C:\Users\asus\anaconda3\envs\dsa2\lib\site-packages\cloudpickle\cloudpickle_fast.py", line 563, in dump
return Pickler.dump(self, obj)
File "C:\Users\asus\anaconda3\envs\dsa2\lib\pickle.py", line 409, in dump
self.save(obj)
File "C:\Users\asus\anaconda3\envs\dsa2\lib\pickle.py", line 521, in save
self.save_reduce(obj=obj, *rv)
File "C:\Users\asus\anaconda3\envs\dsa2\lib\pickle.py", line 634, in save_reduce
save(state)
File "C:\Users\asus\anaconda3\envs\dsa2\lib\pickle.py", line 476, in save
f(self, obj) # Call unbound method with explicit self
File "C:\Users\asus\anaconda3\envs\dsa2\lib\pickle.py", line 821, in save_dict
self._batch_setitems(obj.items())
File "C:\Users\asus\anaconda3\envs\dsa2\lib\pickle.py", line 847, in _batch_setitems
save(v)
File "C:\Users\asus\anaconda3\envs\dsa2\lib\pickle.py", line 521, in save
self.save_reduce(obj=obj, *rv)
File "C:\Users\asus\anaconda3\envs\dsa2\lib\pickle.py", line 634, in save_reduce
save(state)
File "C:\Users\asus\anaconda3\envs\dsa2\lib\pickle.py", line 476, in save
f(self, obj) # Call unbound method with explicit self
File "C:\Users\asus\anaconda3\envs\dsa2\lib\pickle.py", line 821, in save_dict
self._batch_setitems(obj.items())
File "C:\Users\asus\anaconda3\envs\dsa2\lib\pickle.py", line 847, in _batch_setitems
save(v)
File "C:\Users\asus\anaconda3\envs\dsa2\lib\pickle.py", line 496, in save
rv = reduce(self.proto)
TypeError: can't pickle Node objects

Unfortunately, as far as I know, numba jitclass is not pickable, as discussed here.

We have not implemented anything to save the models yet. If your explanatory variables X are continuous, my suggestion would be to learn a Random Forest with scikit-learn, and store that model only. Provided that you also store your training data, you can parse the Random Forest to a Generative Forest later on, as there is no randomness in this last step. You can check this notebook where we explain how to use the scikit-learn interface.

N950 commented

Ok Thank you,
Could you please explain what those warnings at the other issue are ?
I get 1000 lines of warnings