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

ml2cpp step 12 : Keras #13

Closed
antoinecarme opened this issue Sep 21, 2020 · 5 comments
Closed

ml2cpp step 12 : Keras #13

antoinecarme opened this issue Sep 21, 2020 · 5 comments
Assignees

Comments

@antoinecarme
Copy link
Member

antoinecarme commented Sep 21, 2020

Keras

Follow the six steps described in #1

@antoinecarme
Copy link
Member Author

@antoinecarme
Copy link
Member Author

@antoinecarme antoinecarme changed the title ml2cpp step 12 : Keras / Pytorch ml2cpp step 12 : Keras Oct 1, 2020
@antoinecarme antoinecarme self-assigned this Oct 5, 2020
antoinecarme pushed a commit that referenced this issue Oct 22, 2020
Added a keras classifier. Keras object fails to pickle.
antoinecarme pushed a commit that referenced this issue Oct 22, 2020
Added a keras regressor. Keras object fails to pickle.
@antoinecarme
Copy link
Member Author

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


@antoinecarme
Copy link
Member Author

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

keras-team/keras#14194

@antoinecarme
Copy link
Member Author

antoinecarme commented Oct 22, 2020

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.

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

1 participant