Browse by type
Agile Diffusers Inference (ADI) is a C++ library with CLI tool. Purpose to leverage the acceleration capabilities of ONNXRuntime and the high compatibility of the .onnx model format to provide a convenient solution for the engineering deployment of Stable Diffusion, with suitable package size & high performance.
Open Source: ONNXRuntime is an open-source project, allowing users to freely use and modify it to suit different application scenarios.
Scalability: It supports custom operators and optimizations, allowing for extensions and optimizations based on specific needs.
High Performance: ONNXRuntime is highly optimized to provide fast inference speeds, suitable for real-time applications.
Strong Compatibility: It supports model conversion from multiple deep learning frameworks (such as PyTorch, TensorFlow), making integration and deployment convenient.
Cross-Platform Support: ONNXRuntime supports multiple hardware platforms, including CPU, GPU, TPU, etc., enabling efficient execution on various devices.
Community and Enterprise Support: Developed and maintained by Microsoft, it has an active community and enterprise support, providing continuous updates and maintenance.
by simply executing script auto_build.sh:
# if you do not pass the BUILD_TYPE parameter, the script will use the default Debug build type.
# and, if you not enable certain ORTProvider by [options]], script will choose default ORTProvider by platform
bash ./auto_build.sh
# Example-MacOS:
bash ./auto_build.sh --platform macos --build-type debug
# Example-Windows:
bash ./auto_build.sh --platform windows --build-type debug
# Example-Linux(Ubuntu):
bash ./auto_build.sh --platform linux --build-type debug
# Example-Android:
bash ./auto_build.sh --platform android \
--build-type debug \
--android-ndk /Volumes/AL-Data-W04/WorkingEnv/Android/sdk/ndk/26.1.10909125 \
--android-ver 27
# Example(with Extra Options) as below, build release with CUDA=ON TensorRT=ON, and custom compiler configs
bash ./auto_build.sh [params] \
--cmake /opt/homebrew/Cellar/cmake/3.29.5/bin/cmake \
--ninja /usr/local/bin/ninja \
--arch-abi x86_64 \
--jobs 8 \
--options "-DORT_ENABLE_CUDA=ON -DORT_ENABLE_TENSOR_RT=ON"
currently, this project provide below [Options]:
option(ORT_COMPILED_ONLINE "adi: using online onnxruntime(ort), otherwise local build" ${SD_ORT_ONLINE_AVAIL})
option(ORT_COMPILED_HEAVY "adi: using HEAVY compile, ${Red}only for debug, default OFF${ColourReset}" OFF)
option(ORT_BUILD_COMMAND_LINE "adi: build command line tools" ${SD_STANDALONE})
option(ORT_BUILD_COMBINE_BASE "adi: build combine code together to build a single output lib" OFF)
option(ORT_BUILD_SHARED_ADI "adi: build ADI project shared libs" OFF)
option(ORT_BUILD_SHARED_ORT "adi: build ORT in shared libs" OFF)
option(ORT_ENABLE_TENSOR_RT "adi: using TensorRT provider to accelerate inference" ${DEFAULT_TRT_STATE})
option(ORT_ENABLE_CUDA "adi: using CUDA provider to accelerate inference" ${DEFAULT_CUDA_STATE})
option(ORT_ENABLE_COREML "adi: using CoreML provider to accelerate inference" ${DEFAULT_COREML_STATE})
option(ORT_ENABLE_NNAPI "adi: using NNAPI provider to accelerate inference" ${DEFAULT_NNAPI_STATE})
enable if you have to (ONLY FOR YOU TRULY NEEDS, UNRECOMMENDED).
doing 1-step img2img inference, like:
# cd to ./[cmake_output]/bin/ ,like:
cd ./cmake-build-debug/bin/
# and here is an example of using this tool:
# sd-turbo, img2img, positive, inference_steps=1, guide=1.0, euler_a(for 1-step purpose)
./adi -p "A cat in the water at sunset" -m img2img -i ../../sd/io-test/input-test.png -o ../../sd/io-test/output.png -w 512 -h 512 -c 3 --seed 15.0 --dims 1024 --clip ../../sd/sd-base-model/onnx-sd-turbo/text_encoder/model.onnx --unet ../../sd/sd-base-model/onnx-sd-turbo/unet/model.onnx --vae-encoder ../../sd/sd-base-model/onnx-sd-turbo/vae_encoder/model.onnx --vae-decoder ../../sd/sd-base-model/onnx-sd-turbo/vae_decoder/model.onnx --dict ../../sd/sd-dictionary/vocab.txt --beta-start 0.00085 --beta-end 0.012 --beta scaled_linear --alpha cos --scheduler euler_a --predictor epsilon --tokenizer bpe --train-steps 1000 --token-idx-num 49408 --token-length 77 --token-border 1.0 --gain 1.1 --decoding 0.18215 --guidance 1.0 --steps 1 -v

And now, you can have a try~ (0w0 )
Manually Prepare Inference Engine, see at: Engine's README.md
Manually Prepare ONNX-Format Converter & SD-Models, see at: SD_ORT's README.md
Basic Pipeline Functionalities (Major) - [x] [SD_v1] Stable-Diffusion (v1.0 ~ v1.5, turbo) (after 2024/06/04 tested) - v1.0 (HuggingFace): Initial version ✅ - v1.1 (HuggingFace): Improved image quality and generation speed ✅ - v1.2 (HuggingFace): Further optimized generation effects ✅ - v1.3 (HuggingFace): Added more training data ✅ - v1.4 (HuggingFace): Enhanced image generation diversity ✅ - v1.5 (HuggingFace): Final optimized version ✅ - turbo (HuggingFace): Community-driven optimized version, faster and efficiency ✅
[ ] [SD_v2] Stable-Diffusion (v2.0, v2.1)
[ ] [SD_v3] Stable-Diffusion (v3.0)
[ ] [SDXL] Stable-Diffusion-XL
[ ] [SVD] Stable-Video-Diffusion
Scheduler Abilities - [ ] Strategy - [x] Discrete/Method Default (discrete) (after 2024/05/22) - [ ] Karras (karras)
Tokenizer Type - [x] Byte-Pair Encoding (bpe) (after 2024/07/03 ✅tested) - [x] Word Piece Encoding (wp) (after 2024/05/27 ✅tested) - [ ] Sentence Piece Encoding (sp) [if necessary]
$ claude mcp add ADI-Stable-Diffusion \
-- python -m otcore.mcp_server <graph>