feat(models): add support to qwen-image (#5975)

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto
2025-08-06 10:36:53 +02:00
committed by GitHub
parent 7e2a522229
commit c092633cd7
3 changed files with 61 additions and 0 deletions

View File

@@ -65,6 +65,19 @@ from diffusers.schedulers import (
UniPCMultistepScheduler,
)
def is_float(s):
try:
float(s)
return True
except ValueError:
return False
def is_int(s):
try:
int(s)
return True
except ValueError:
return False
# The scheduler list mapping was taken from here: https://github.com/neggles/animatediff-cli/blob/6f336f5f4b5e38e85d7f06f1744ef42d0a45f2a7/src/animatediff/schedulers.py#L39
# Credits to https://github.com/neggles
@@ -169,8 +182,24 @@ class BackendServicer(backend_pb2_grpc.BackendServicer):
if ":" not in opt:
continue
key, value = opt.split(":")
# if value is a number, convert it to the appropriate type
if is_float(value):
value = float(value)
elif is_int(value):
value = int(value)
self.options[key] = value
# From options, extract if present "torch_dtype" and set it to the appropriate type
if "torch_dtype" in self.options:
if self.options["torch_dtype"] == "fp16":
torchType = torch.float16
elif self.options["torch_dtype"] == "bf16":
torchType = torch.bfloat16
elif self.options["torch_dtype"] == "fp32":
torchType = torch.float32
# remove it from options
del self.options["torch_dtype"]
print(f"Options: {self.options}", file=sys.stderr)
local = False

View File

@@ -1,4 +1,17 @@
---
- &qwenimage
name: "qwen-image"
url: "github:mudler/LocalAI/gallery/qwen-image.yaml@master"
urls:
- https://huggingface.co/Qwen/Qwen-Image
icon: https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/qwen_image_logo.png
license: apache-2.0
tags:
- qwen-image
- gpu
- text-to-image
description: |
We are thrilled to release Qwen-Image, an image generation foundation model in the Qwen series that achieves significant advances in complex text rendering and precise image editing. Experiments show strong general capabilities in both image generation and editing, with exceptional performance in text rendering, especially for Chinese.
- &gptoss
name: "gpt-oss-20b"
url: "github:mudler/LocalAI/gallery/harmony.yaml@master"

19
gallery/qwen-image.yaml Normal file
View File

@@ -0,0 +1,19 @@
---
name: "flux"
config_file: |
backend: diffusers
cfg_scale: 0
diffusers:
cuda: true
enable_parameters: num_inference_steps
pipeline_type: DiffusionPipeline
f16: true
low_vram: true
name: qwen-image
parameters:
model: Qwen/Qwen-Image
step: 50
options:
- true_cfg_scale:4.0
- torch_dtype:bf16