docs/Image Generation Tutorial.md
This feature allows you to generate images using diffusers models like Tongyi-MAI/Z-Image-Turbo directly within the web UI.
git clone https://github.com/oobabooga/textgen
or download it from here and unzip it.
start_windows.bat./start_linux.sh./start_macos.shNote: Image generation does not work with the portable builds in .zip format in the Releases page. You need the "full" version of the web UI.
http://127.0.0.1:7860/.https://huggingface.co/Tongyi-MAI/Z-Image-Turbo and click "Download".Select the quantization option in the "Quantization" menu and click "Load".
The memory usage for Z-Image-Turbo for each option is:
| Quantization Method | VRAM Usage |
|---|---|
| None (FP16/BF16) | 25613 MiB |
| bnb-8bit | 16301 MiB |
| bnb-8bit + CPU Offload | 16235 MiB |
| bnb-4bit | 11533 MiB |
| bnb-4bit + CPU Offload | 7677 MiB |
The torchao options support torch.compile for faster image generation, with float8wo specifically providing native hardware acceleration for RTX 40-series and newer GPUs.
Note: The next time you launch the web UI, the model will get automatically loaded with your last settings when you try to generate an image. You do not need to go to the Model tab and click "Load" each time.
To use this feature, you need to load an LLM in the main "Model" page on the left.
If you have no idea what to use, do this to get started:
textgen/user_data/models folder.Then go back to the "Image AI" page and check "LLM Prompt Variations".
After that, your prompts will be automatically updated by the LLM each time you generate an image. If you use a "Sequential Count" value greater than 1, a new prompt will be created for each sequential batch.
The improvement in creativity is striking (prompt: Photo of a beautiful woman at night under moonlight):
It is possible to generate images using the project's API. Just make sure to start the server with --api, either by
--api flag to your start script, like ./start_linux.sh --api, or--api to your user_data/CMD_FLAGS.txt file and relaunching the web UI.Here is an API call example:
curl http://127.0.0.1:5000/v1/images/generations \
-H "Content-Type: application/json" \
-d '{
"prompt": "an orange tree",
"steps": 9,
"cfg_scale": 0,
"batch_size": 1,
"batch_count": 1
}'