Browse by type
Adlik [ædlik] is an end-to-end optimizing framework for deep learning models. The goal of Adlik is to accelerate deep learning inference process both on cloud and embedded environment.

With Adlik framework, different deep learning models can be deployed to different platforms with high performance in a much flexible and easy way.

In cloud environment, the compiled model and Adlik Inference Engine should be built as a docker image, and deployed as a container.
In edge environment, Adlik Inference Engine should be deployed as a container. The compiled model should be transferred to edge environment, and the Adlik Inference Engine should automatically update and load model.
In device environment, Adlik Inference Engine and the compiled model should be compiled into a binary file (so or lib). Users who want to run model inference on device should link user defined AI function and Adlik binary file to the execution file, and run directly.
We test the inference performance of Adlik on the same CPU or GPU using the simple CNN model (MNIST model), the ResNet50 model, and InceptionV3 with different serving engines. The test performance data of Adlik on different models are as follows:
Model optimizer focuses on specific hardware and runs on it to achieve acceleration. The proposed framework mainly consists of two categories of algorithm components, i.e. pruner and quantizer.
Model compiler supports several optimizing technologies like pruning, quantization and structural compression, which can be easily used for models developed with TensorFlow, Keras, PyTorch, etc.
Serving Engine provides deep learning models with optimized runtime based on the deployment environment. Put simply, based on a deep learning model, the users of Adlik can optimize it with model compiler and then deploy it to a certain platform with Adlik serving platform.
All Adlik compiler images and serving images are stored in Alibaba Cloud. These images can be downloaded and used directly, users do not need to build the Adlik on Ubuntu. Users can use the compiler images to compile model from H5, CheckPoint, FrozenGraph, ONNX and SavedModel to Openvino, TensorFlow, TensorFlow Lite, TensorRT. Users also can use the serving images for model inference.
Docker pull command:
shell script
docker pull docker_image_name:tag
The compiler docker images can be used in CPU and GPU. In the CPU, you can compile the model from source type to TensorFlow model, OpenVino model and TensorFlow Lite model. And in the CPU, you can compile the model from source type to TensorFlow model, and TensorRT model. The name and label of compiler mirror are shown below, and the first half of label represents the version of TensorRT, the latter part of label represents the version of CUDA:
registry.cn-beijing.aliyuncs.com/adlik/model-compiler:v1.0
shell script
docker run -it --rm -v source_model:/mnt/model
registry.cn-beijing.aliyuncs.com/adlik/model-compiler:v1.0 bash
The config_schema.json describle the json file field information, and for the example, you can reference compiler_json_example.json. For the environment variable field description, see env_field.txt, for the example, reference compiler_env_example.txt.
Note: The checkpoint model must be given the input and output op names of the model when compiling, and other models can be compiled without the input and output op names of the model.
Compilation instructions (json file mode):
shell script
python3 "-c" "import json; import model_compiler as compiler; file=open('/mnt/model/serving_model.json','r');
request = json.load(file);compiler.compile_model(request); file.close()"
Compilation instructions (environment variable mode):
shell script
python3 "-c" "import model_compiler.compiler as compiler;compiler.compile_from_env()"
The serving docker images contains CPU and GPU mirrors. The label of openvino image represents the version of OpenVINO. And for the TensorRT image the first half of label represents the version of TensorRT, the latter part of label represents the version of CUDA. The names and labels of serving mirrors are as follows:
CPU:
registry.cn-beijing.aliyuncs.com/adlik/serving-tflite-cpu:v1.0
registry.cn-beijing.aliyuncs.com/adlik/serving-tensorflow-cpu:v1.0
registry.cn-beijing.aliyuncs.com/adlik/serving-openvino:v1.0
registry.cn-beijing.aliyuncs.com/adlik/serving-libtorch-cpu:v1.0
GPU:
registry.cn-beijing.aliyuncs.com/adlik/serving-tftrt-gpu:v1.0
registry.cn-beijing.aliyuncs.com/adlik/serving-tensorrt:v1.0
registry.cn-beijing.aliyuncs.com/adlik/serving-libtorch-gpu:v1.0
shell script
docker run -it --rm -p 8500:8500 -v compiled_model:/model
registry.cn-beijing.aliyuncs.com/adlik/serving-openvino:v1.0 bash
shell script
adlik-serving --grpc_port=8500 --http_port=8501 --model_base_path=/model
Note: If the service port is not mapped when you run the mirror, you need install the adlik serving package or adlik serving gpu package in the container. Then execute the inference code, and perform inference in the container.
This guide is for building Adlik on Ubuntu systems.
Then, clone Adlik and change the working directory into the source directory:
sh
git clone https://github.com/Adlik/Adlik.git
cd Adlik
python3-setuptoolspython3-wheelsh
bazel build //adlik_serving/clients/python:build_pip_package -c opt
sh
mkdir /tmp/pip-packages && bazel-bin/adlik_serving/clients/python/build_pip_package /tmp/pip-packages
First, install the following packages:
automakelibtbb2libtoolmakepython3-sixopenvino-<VERSION> package from
OpenVINO./opt/intel/openvino_VERSION, run the following command:sh
export INTEL_CVSDK_DIR=/opt/intel/openvino_2022
export InferenceEngine_DIR=$INTEL_CVSDK_DIR/runtime/cmake
bazel build //adlik_serving \
--config=openvino \
-c opt
sh
bazel build //adlik_serving \
--config=tensorflow-cpu \
-c opt
Assume building with CUDA version 11.6.
cuda-nvprune-11-6
cuda-nvtx-11-6cuda-cupti-dev-11-6libcublas-dev-11-6libcudnn8=*+cuda11.6libcudnn8-dev=*+cuda11.6libcufft-dev-11-6libcurand-dev-11-6libcusolver-dev-11-6libcusparse-dev-11-6libnvinfer8=8.4.*+cuda11.6libnvinfer-dev=8.4.*+cuda11.6libnvinfer-plugin7=8.4.*+cuda11.6libnvinfer-plugin-dev=8.4.*+cuda11.6
Run the following command:
sh
env TF_CUDA_VERSION=11.6 TF_NEED_TENSORRT=1 \
bazel build //adlik_serving \
--config=tensorflow-gpu \
-c opt \
--incompatible_use_specific_tool_files=false
sh
bazel build //adlik_serving \
--config=tensorflow-lite-cpu \
-c opt
Assume building with CUDA version 11.0.
cuda-cupti-dev-11-6
cuda-nvml-dev-11-6cuda-nvrtc-11-6libcublas-dev-11-6libcudnn8=*+cuda11.6libcudnn8-dev=*+cuda11.6libcufft-dev-11-0libcurand-dev-11-0libcusolver-dev-11-6libcusparse-dev-11-6libnvinfer8=8.4.*+cuda11.6libnvinfer-dev=8.4.*+cuda11.6libnvonnxparsers8=8.4.*+cuda11.6libnvonnxparsers-dev=8.4.*+cuda11.6sh
env TF_CUDA_VERSION=11.6 \
bazel build //adlik_serving \
--config=TensorRT \
-c opt \
--action_env=LIBRARY_PATH=/usr/local/cuda-11.0/lib64/stubs \
--incompatible_use_specific_tool_files=false
Assume building with CUDA version 11.0.
cuda-cupti-dev-11-6
libcublas-dev-11-6libcudnn8=*+cuda11.6libcudnn8-dev=*+cuda11.6libcufft-dev-11-6libcurand-dev-11-6libcusolver-dev-11-6libcusparse-dev-11-6libnvinfer8=8.4.*+cuda11.6libnvinfer-dev=8.4.*+cuda11.6libnvinfer-plugin8=8.4.*+cuda11.6libnvinfer-plugin-dev=8.4.*+cuda11.6
Run the following command:
sh
env TF_CUDA_VERSION=11.6 TF_NEED_TENSORRT=1 \
bazel build //adlik_serving \
--config=tensorflow-tensorrt \
-c opt \
--incompatible_use_specific_tool_files=false
Install the following packages:
build-essential
cmaketvm
Run the following command:
sh
bazel build //adlik_serving \
--config=tvm \
-c opt
The ci/docker/build.sh file can be used to build a Docker images that contains all the requirements for building
Adlik. You can build Adlik with the Docker image.
Note: If you build the runtime with GPU in a Docker image, you need to add the CUDA environment variables in the Dockerfile, such as:
dockerfile ENV NVIDIA_VISIBLE_DEVICES all ENV NVIDIA_DRIVER_CAPABILITIES compute, utility
The version of the service engine Adlik supports.
| | Enflame 2.0 | TensorFlow 2.10.1 | OpenVINO 2022.3.0
$ claude mcp add Adlik \
-- python -m otcore.mcp_server <graph>