Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions backend/python/diffusers/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,19 @@ def sc(self, clip_input, images): return images, [False for i in images]
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
Expand Down Expand Up @@ -169,8 +182,24 @@ def LoadModel(self, request, context):
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
Expand Down
13 changes: 13 additions & 0 deletions gallery/index.yaml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -2023,7 +2036,7 @@
- gemma3
- gemma-3
overrides:
#mmproj: gemma-3-27b-it-mmproj-f16.gguf

Check warning on line 2039 in gallery/index.yaml

View workflow job for this annotation

GitHub Actions / Yamllint

2039:6 [comments] missing starting space in comment
parameters:
model: gemma-3-27b-it-Q4_K_M.gguf
files:
Expand All @@ -2041,7 +2054,7 @@
description: |
google/gemma-3-12b-it is an open-source, state-of-the-art, lightweight, multimodal model built from the same research and technology used to create the Gemini models. It is capable of handling text and image input and generating text output. It has a large context window of 128K tokens and supports over 140 languages. The 12B variant has been fine-tuned using the instruction-tuning approach. Gemma 3 models are suitable for a variety of text generation and image understanding tasks, including question answering, summarization, and reasoning. Their relatively small size makes them deployable in environments with limited resources such as laptops, desktops, or your own cloud infrastructure.
overrides:
#mmproj: gemma-3-12b-it-mmproj-f16.gguf

Check warning on line 2057 in gallery/index.yaml

View workflow job for this annotation

GitHub Actions / Yamllint

2057:6 [comments] missing starting space in comment
parameters:
model: gemma-3-12b-it-Q4_K_M.gguf
files:
Expand All @@ -2059,7 +2072,7 @@
description: |
Gemma is a family of lightweight, state-of-the-art open models from Google, built from the same research and technology used to create the Gemini models. Gemma 3 models are multimodal, handling text and image input and generating text output, with open weights for both pre-trained variants and instruction-tuned variants. Gemma 3 has a large, 128K context window, multilingual support in over 140 languages, and is available in more sizes than previous versions. Gemma 3 models are well-suited for a variety of text generation and image understanding tasks, including question answering, summarization, and reasoning. Their relatively small size makes it possible to deploy them in environments with limited resources such as laptops, desktops or your own cloud infrastructure, democratizing access to state of the art AI models and helping foster innovation for everyone. Gemma-3-4b-it is a 4 billion parameter model.
overrides:
#mmproj: gemma-3-4b-it-mmproj-f16.gguf

Check warning on line 2075 in gallery/index.yaml

View workflow job for this annotation

GitHub Actions / Yamllint

2075:6 [comments] missing starting space in comment
parameters:
model: gemma-3-4b-it-Q4_K_M.gguf
files:
Expand Down Expand Up @@ -5525,7 +5538,7 @@
sha256: 2756551de7d8ff7093c2c5eec1cd00f1868bc128433af53f5a8d434091d4eb5a
uri: huggingface://Triangle104/Nano_Imp_1B-Q8_0-GGUF/nano_imp_1b-q8_0.gguf
- &qwen25
name: "qwen2.5-14b-instruct" ## Qwen2.5

Check warning on line 5541 in gallery/index.yaml

View workflow job for this annotation

GitHub Actions / Yamllint

5541:32 [comments] too few spaces before comment: expected 2
icon: https://avatars.githubusercontent.com/u/141221163
url: "github:mudler/LocalAI/gallery/chatml.yaml@master"
license: apache-2.0
Expand Down Expand Up @@ -7486,7 +7499,7 @@
sha256: 0fec82625f74a9a340837de7af287b1d9042e5aeb70cda2621426db99958b0af
uri: huggingface://bartowski/Chuluun-Qwen2.5-72B-v0.08-GGUF/Chuluun-Qwen2.5-72B-v0.08-Q4_K_M.gguf
- &smollm
url: "github:mudler/LocalAI/gallery/chatml.yaml@master" ## SmolLM

Check warning on line 7502 in gallery/index.yaml

View workflow job for this annotation

GitHub Actions / Yamllint

7502:59 [comments] too few spaces before comment: expected 2
name: "smollm-1.7b-instruct"
icon: https://huggingface.co/datasets/HuggingFaceTB/images/resolve/main/banner_smol.png
tags:
Expand Down
19 changes: 19 additions & 0 deletions gallery/qwen-image.yaml
Original file line number Diff line number Diff line change
@@ -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
Loading