Skip to content

mllite/keras2sql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deep Learning (Keras) Models Deployment using SQL databases

Are you curious to know if a SQL database can be used to deploy/evaluate a deep-learning model instead of the standard CPU/GPU/CUDA/OpenCL machinery ?

We use Sklearn2sql. Sklearn2sql provides a framework for translating scikit-learn predictive models into a SQL code for deployment purposes. Using this framework, for example, it is possible for a C, perl or java developper to deploy such a model simply by executing the generated SQL code. The system supports the major market databases (db2, firebird, hive, impala, monetdb, MS SQL Server, mysql, oracle, pgsql, sqlite and teradata).

The goal of this POC is to see if this framework can be applied to deep learning models (keras + scikit-learn wrapper).

In a first step, we investigate the SQL code generation for basic deep learning models (keras core layers and activation functions). A second step will investigate basic convolutional models (with convolutional and pooling layers).

We are aware that deep learning models tend to have a large number of parameters (layer weights) and hope that SQL deployment wil be usable for small and medium models.

An evaluation of database capabilities with respect to the model size is already a real-world assessment of this task.

An additional/optional path to explore is to evaluate SQL code generation for the family of recursive models (RNN , LSTM and GRU, etc) and more advanced keras features.

Your feedback is welcome.

Update (2018-07-17) :

  1. Sample Regression Model (KerasRegressor): https://github.com/antoinecarme/keras2sql/blob/master/doc/keras_boston.ipynb
  2. Sample Classification Model (KerasClassifier with Dense Layer) : https://github.com/antoinecarme/keras2sql/blob/master/doc/keras_iris.ipynb
  3. Sample Convolutional Model (KerasClassifier with Conv2D Layer and MaxPooling) : https://github.com/antoinecarme/keras2sql/blob/master/doc/keras_mnist.ipynb
  4. Recurrent Neural Network (SimpleRNN) : https://github.com/antoinecarme/keras2sql/blob/master/doc/recurrent/keras_boston-SimpleRNN.ipynb
  5. Recurrent Neural Network (LSTM) : https://github.com/antoinecarme/keras2sql/blob/master/doc/recurrent/keras_boston-LSTM.ipynb
  6. Recurrent Neural Network (GRU) : https://github.com/antoinecarme/keras2sql/blob/master/doc/recurrent/keras_boston-GRU.ipynb
  7. Does not depend (a lot ;) on the backend used : Iris example with tensorflow , theano and cntk .