Skip to content

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jModel: Simplifying TensorFlow Model Deployment

Python NumPy TensorFlow

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.

Features:

  • 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.

Getting Started:

  1. Installation: Begin by cloning the jModel repository to your local machine:

    git clone https://github.com/jemmyfebryan/jModel.git
    
  2. 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.

  3. 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.

Usage:

  1. 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
  2. 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.

Compatibility

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.

  1. 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
  2. Activation Function:

    • linear, relu, sigmoid, softmax, tanh, constrained_softmax

License:

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.

About the Author:

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.

About

jModel is a Python script designed to facilitate the conversion of TensorFlow models into deployment-ready models. These deployment models are optimized solely for feeding input tensors, omitting features related to training or fine-tuning.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages