简体   繁体   English

“TypeError: can't pickle _thread.RLock objects”,同时使用 pickle 保存 Facebook Prophet 模型

[英]"TypeError: can't pickle _thread.RLock objects" while saving Facebook Prophet model using pickle

I am training a model to predict energy consumption values using Facebook Prophet model.我正在训练一个模型来使用 Facebook Prophet 模型预测能源消耗值。 But while saving model using pickle I am getting this error:但是在使用 pickle 保存模型时,我收到此错误:

TypeError                                 Traceback (most recent call last)
<ipython-input-54-9ef2990419d8> in <module>
      1 with open('forecast_model.pckl', 'wb') as fout:
----> 2     pickle.dump(model, fout)

TypeError: can't pickle _thread.RLock objects

Code :代码 :

from fbprophet import Prophet
import pickle
model = Prophet()
model.fit(df)
with open('forecast_model.pkl', 'wb') as fout:   <== Error coming here
    pickle.dump(model, fout)

df.head() df.head()

                     ds   y
0   2018-12-19 15:00:02   250.0
1   2018-12-19 16:00:03   295.0
2   2018-12-19 18:00:02   288.0
3   2018-12-19 19:00:02   286.0
4   2018-12-19 20:00:02   229.0

[EDIT] Solution Link : https://github.com/facebook/prophet/issues/1361 : [编辑]解决方案链接: https : //github.com/facebook/prophet/issues/1361
Code given below worked for me下面给出的代码对我有用

model = Prophet()
model.stan_backend.logger = None

with open('test.pickle', 'wb') as f:
   pickle.dump(m, f)

I've got the same problem.我有同样的问题。 I reinstalled fbprophet version 0.5, like我重新安装了 fbprophet 0.5 版,比如

pip install -U fbprophet==0.5

if you don't need the latest version:0.6, you can try it.如果你不需要最新版本:0.6,你可以试试。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用pickle保存keras模型时面临“无法pickle _thread.rlock对象”错误 - Facing 'can't pickle _thread.rlock objects' error while saving keras model using pickle 类型错误:无法pickle _thread.RLock 对象 - TypeError: can't pickle _thread.RLock objects TypeError:无法在 python 3 中腌制 _thread.RLock 对象 - TypeError: can't pickle _thread.RLock objects in python 3 获取 TypeError:无法pickle _thread.RLock 对象 - Getting TypeError: can't pickle _thread.RLock objects TypeError: can&#39;t pickle _thread.RLock objects in pandas with multiprocessing - TypeError: can't pickle _thread.RLock objects in pandas with multiprocessing TypeError: can't pickle _thread.RLock objects (Deep Learning) - TypeError: can't pickle _thread.RLock objects ( Deep Learning) 使用Web服务时无法腌制_thread.RLock对象 - can't pickle _thread.RLock objects when using a webservice Keras模型上的递归特征消除(RFE)-TypeError:无法腌制_thread.RLock对象 - Recursive Feature Elimination (RFE) on Keras Model - TypeError: can't pickle _thread.RLock objects 如何使用 mlflow.pyfunc.log_model() 使用 Keras 步骤记录 sklearn 管道? 类型错误:无法pickle _thread.RLock 对象 - How to log a sklearn pipeline with a Keras step using mlflow.pyfunc.log_model()? TypeError: can't pickle _thread.RLock objects Tensflow Keras: TypeError: can't pickle _thread.RLock objects when using multiprocessing - Tensflow Keras: TypeError: can't pickle _thread.RLock objects when using multiprocessing
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM