[Docs] Add basic usage examples for diffusion (#222)

Signed-off-by: samithuang <285365963@qq.com>
Signed-off-by: Samit <285365963@qq.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
SamitandHongsheng Liu authored and GitHub committed 2025-12-08 00:00:25 -08:00
1 parent 45dc189d8d
commit 4ac3e6e7d0
4 files changed
+26 -5

No files matched your search

+13 -1
View File
@@ -16,7 +16,19 @@ Please refer to [installation](installation/README.md)
## Offline Inference
Please refer to [offline inference](../user_guide/examples/offline_inference/qwen2_5_omni.md)
Text-to-image generation quickstart with vLLM-Omni:
```python
from vllm_omni.entrypoints.omni import Omni
if __name__ == "__main__":
omni = Omni(model="Tongyi-MAI/Z-Image-Turbo")
prompt = "a cup of coffee on the table"
images = omni.generate(prompt)
images[0].save("coffee.png")
```
For more usages, please refer to [offline inference](../user_guide/examples/offline_inference/qwen2_5_omni.md)
## Online Serving with OpenAI-Completions API
@@ -1,10 +1,21 @@
# Qwen-Image Offline Inference
This folder provides two simple entrypoints for experimenting with `Qwen/Qwen-Image` using vLLM-Omni:
This folder provides several entrypoints for experimenting with `Qwen/Qwen-Image` using vLLM-Omni:
- `text_to_image.py`: command-line script for single image generation.
- `text_to_image.py`: command-line script for single image generation with advanced options.
- `web_demo.py`: lightweight Gradio UI for interactive prompt/seed/CFG exploration.
## Basic Usage
```python
from vllm_omni.entrypoints.omni import Omni
if __name__ == "__main__":
omni = Omni(model="Qwen/Qwen-Image")
prompt = "a cup of coffee on the table"
images = omni.generate(prompt)
images[0].save("coffee.png")
```
## Local CLI Usage
@@ -105,7 +105,6 @@ def build_demo(args: argparse.Namespace) -> gr.Blocks:
generator=generator,
true_cfg_scale=float(cfg_scale_value),
num_inference_steps=num_steps,
num_images_per_prompt=num_images,
num_outputs_per_prompt=num_images,
)
return [img for img in images[:num_images]]
@@ -65,7 +65,6 @@ def main():
generator=generator,
true_cfg_scale=args.cfg_scale,
num_inference_steps=args.num_inference_steps,
num_images_per_prompt=args.num_images_per_prompt,
num_outputs_per_prompt=args.num_images_per_prompt,
)