jModel is a lightweight yet powerful Python script crafted to streamline the process of converting TensorFlow models into deployment-ready formats. It serves as a crucial tool for machine learning engineers and developers looking to seamlessly transition their trained models into production environments.
-
Effortless Conversion: With jModel, the conversion of TensorFlow models into deployment-ready formats becomes a breeze. Say goodbye to complex configurations and tedious manual processes.
-
Optimized Deployment Models: The output generated by jModel is specifically tailored for deployment scenarios, focusing solely on the essential task of feeding input tensors only using
NumPy. This optimization eliminates any overhead related to training or fine-tuning, resulting in enhanced efficiency during deployment and prediction up to 30 times faster on small batch size and competitive on big batch size with Tensorflow model. -
Flexibility and Customization: Despite its simplicity, jModel offers flexibility and customization options to meet diverse deployment requirements. Users can easily adjust parameters and settings to fine-tune the deployment models according to their specific use cases.
-
Installation: Begin by cloning the jModel repository to your local machine:
git clone https://github.com/jemmyfebryan/jModel.git
-
Usage: Follow the instructions provided in the documentation to integrate jModel into your TensorFlow workflow. Utilize the script to convert your trained models into deployment-ready formats effortlessly.
-
Customization: Explore the customization options available within jModel to tailor the deployment models according to your unique requirements. Experiment with different configurations to achieve optimal performance in your deployment environment.
-
Convert TensorFlow model to jModel:
from tf2jModel.converter import Converter import tensorFlow as tf # Load your TensorFlow model model = tf.keras.models.load_model('your_model.keras') # Convert your TensorFlow model to jModel jModel_converter = Converter() jModel_converter.adapt(model) jModel_converter.convert("your_model.jmodel") # Now you can use your jModel for deployment and jModel.py file for runtime
-
Use jModel to predict:
import jModel # Load your jModel model = jModel.model() model.load_model('your_model.jmodel') # Use jModel to predict your input array model.predict(input_array) # The model will feedforward your given input as long as the shape is valid
Note: You still need TensorFlow installed in your environment when converting to jModel, but only need jModel.py when predicting with jModel.
jModel is developed using Python==3.11.3, NumPy==1.26.4, TensorFlow==2.16.1 and currently support TensorFlow model with specific layer and hyperparameters.
-
TensorFlow Layer:
- AveragePooling2D: pool_size, strides, padding
- BatchNormalization: axis, momentum, epsilon, center, scale
- Conv2D: filters, kernel_size, strides, padding, activation, use_bias
- Dense: units, activation, use_bias
- Dropout
- Flatten
- GlobalAveragePooling2D
- GlobalMaxPooling2D
- InputLayer
- LSTM: units, activation, use_bias, return_sequences
- MaxPooling2D: pool_size, strides, padding
- Reshape
- SimpleRNN: units, activation, use_bias, return_sequences
-
Activation Function:
- linear, relu, sigmoid, softmax, tanh, constrained_softmax
jModel is licensed under the MIT License, granting users the freedom to use, modify, and distribute the software according to their needs. For more details, refer to the license file included in the repository.
jModel is developed and maintained by Jemmy Febryan, a passionate machine learning enthusiast dedicated to simplifying the deployment of TensorFlow models for the broader community. Connect with us on LinkedIn for updates and discussions related to jModel and other machine learning projects.