mllite/ml2cpp

ml2cpp step 12 : Keras

Closed this issue · 5 comments

Keras

Follow the six steps described in #1

Keras models fail to pickle (keras.version == '2.4.3')

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-7-59b94fe31a3c> in <module>
     14 
     15 
---> 16 lCPPCode = generate_cpp_for_model(clf);

<ipython-input-7-59b94fe31a3c> in generate_cpp_for_model(model)
      1 def generate_cpp_for_model(model):
      2     import pickle, json, requests, base64
----> 3     b64_data = base64.b64encode(pickle.dumps(model)).decode('utf-8')
      4     # send the model th the web service
      5     json_data={"Name":"model_cpp_sample", 

TypeError: cannot pickle '_thread.RLock' object


There is already a keras issue filed for this same problem :

keras-team/keras#14194

Same issue filed d by sklearn2sql_heroku two years ago !!!

mllite/sklearn2sql_heroku#3 (comment)

keras-team/keras#10475

Anyway, as long as pytorch C++ code generation is working, we can get rid of keras.

Closing.