Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Get Started with GridGain ML

A complete, working example of deploying and using a sentiment analysis model with the GridGain 9 machine learning engine.

This section provides a complete, working example of deploying and using a sentiment analysis model.

Prerequisites

GridGain ML uses Deep Java Library (DJL) as its inference runtime. To keep the GridGain package size small, the ML engine native libraries (PyTorch, TensorFlow, ONNX Runtime) are not bundled with the distribution and are automatically downloaded on the first inference. For air-gapped environments, you must make them available before the node starts, see the options below.

ONNX Runtime on Windows requires the Microsoft JDKs or JDKs where MSVC runtime's version above 14.38.33142.0. For more information, see the GitHub discussion.

Compatible native library versions

The following native library versions are compatible with the DJL 0.36.0 runtime embedded in GridGain ML:

Engine
Native version
DJL JNI artifact version

PyTorch

2.7.1

pytorch-jni:2.7.1-0.36.0

TensorFlow

2.16.1

n/a (single artifact)

ONNX Runtime

1.17.0

n/a (single artifact)

The official GridGain ML Docker image ships with all three engine native libraries pre-loaded. Pull and run it directly; no additional setup is required.

docker pull gridgain/gridgain9:<VERSION>-ml
docker run gridgain/gridgain9:<VERSION>-ml

This is the simplest path for both connected and air-gapped environments when you can transfer Docker images.

Option 2 – Pre-load native libraries before going air-gapped

In environments where internet access is available at setup time but not at runtime, pre-load the engine native libraries once while connected. DJL will cache them locally and reuse the cache on every subsequent start without any network access.

Run the following utility once on each node (or on a base image during build) while internet access is still available:

Option 3 – Install PyTorch or TensorFlow via pip

If your environment already has a Python runtime, you can install the framework libraries via pip and point DJL to them. This avoids any separate download step.

PyTorch

Install the version compatible with DJL 0.36.0:

Then set the following environment variables before starting GridGain:

DJL will load the native libraries from PYTORCH_LIBRARY_PATH instead of downloading them.

TensorFlow

No additional environment variables are needed; DJL auto-detects the TensorFlow installation when it is on the library path.

GPU builds require CUDA to be installed on the host. See the DJL PyTorch engine docs and TensorFlow engine docs for platform-specific GPU dependency details.

Configuration

Before using GridGain ML, it is recommended to configure the thread pool size in your GridGain configuration file for optimal performance.

Thread Pool Configuration

Edit your gridgain-config.conf file (located at $GRIDGAIN_HOME/etc/gridgain-config.conf) and add the following configuration:

Parameters:

  • threadPoolSize: Number of threads allocated for ML inference operations. Adjust based on your workload and available CPU cores.

Restart GridGain after modifying the configuration file for changes to take effect.

Step 1: Download a Pre-trained Model

Download a sentiment analysis model from DJL Model Zoo:

Step 2: Deploy Model to GridGain

Deploy the downloaded model to all nodes:

For more information about code deployment, see the Code Deployment article.

Step 3: Run Your First Prediction

Run the prediction using the downloaded model:

This page is: Copyright © 2026 MariaDB. All rights reserved.

Last updated

Was this helpful?