zimage-ncnn-vulkan β Run Z-Image natively on Windows/Linux/macOS without CUDA or PyTorch
#145
by
nihui-szyl
- opened
Hi Z-Image community,
I'd like to share a project: https://github.com/nihui/zimage-ncnn-vulkan β a pure C++ implementation of Z-Image inference using https://github.com/Tencent/ncnn and Vulkan GPU acceleration.
What is it?
This is a standalone, cross-platform implementation of Z-Image image generation that runs entirely through ncnn + Vulkan, with no dependency on Python, PyTorch, or CUDA runtime.
Key Highlights
Cross-platform & Cross-vendor GPU support
- Runs on Windows, Linux, and macOS
- Supports Intel, AMD, NVIDIA, and Apple Silicon GPUs via Vulkan
- Also supports CPU-only mode (-g -1)
Zero runtime dependency
- Download the executable + model files, and you're ready to go
- No need to install Python, pip, PyTorch, CUDA toolkit, or any other environment
- Truly portable β just copy and run
Lightweight & efficient native implementation
- Written in C/C++, compiled to a single binary
- All dependencies (libwebp, libjpeg-turbo, libpng, etc.) are built-in
- Supports both z-image and z-image-turbo models
Low barrier to entry
- Minimum: 16GB system RAM + any Vulkan-capable GPU (Linux/macOS)
- On Windows: (half of system RAM) + GPU VRAM >= 16GB
- Recommended: 32GB RAM + 16GB VRAM GPU with tensor core support
Usage
# Basic usage
zimage-ncnn-vulkan -p "a wandering astronaut on mars, photo realistic, 8k" -o output.png
# Use turbo model with custom resolution
zimage-ncnn-vulkan -m z-image-turbo -p "your prompt" -W 1024 -H 1024 -o output.png
# Specify GPU device
zimage-ncnn-vulkan -p "your prompt" -g 0 -o output.png
Why this matters for Z-Image adoption
- Lowers the barrier β Users don't need to set up a Python ML environment. Download, place models, run.
- Broader hardware support β Not limited to NVIDIA CUDA. AMD, Intel, and Apple Silicon users can participate.
- Easier distribution β A single portable executable makes it simple to integrate into other applications or workflows.
- Demonstrates model portability β Shows that Z-Image's architecture can be efficiently deployed outside the PyTorch ecosystem.
Build from source
git clone https://github.com/nihui/zimage-ncnn-vulkan.git
cd zimage-ncnn-vulkan
git submodule update --init --recursive --depth 1
mkdir build && cd build
cmake ../src
cmake --build . -j 4
Model files are available on https://huggingface.co/nihui-szyl/z-image-ncnn/tree/main.
Links
- GitHub: https://github.com/nihui/zimage-ncnn-vulkan
- Models: https://huggingface.co/nihui-szyl/z-image-ncnn/tree/main
- ncnn framework: https://github.com/Tencent/ncnn
Feedback and contributions are welcome!