add kandinsky5

Signed-off-by: vladmandic <mandic00@live.com>
This commit is contained in:
vladmandic
2025-12-09 09:47:22 +01:00
parent f91af19094
commit acca58f50c
5 changed files with 67 additions and 1 deletions
+17 -1
View File
@@ -770,7 +770,7 @@
"size": 5.15,
"date": "2023 July"
},
"Kandinsky 3": {
"Kandinsky 3.0": {
"path": "kandinsky-community/kandinsky-3",
"desc": "Kandinsky 3.0 is an open-source text-to-image diffusion model built upon the Kandinsky2-x model family. In comparison to its predecessors, Kandinsky 3.0 incorporates more data and specifically related to Russian culture, which allows to generate pictures related to Russin culture. Furthermore, enhancements have been made to the text understanding and visual quality of the model, achieved by increasing the size of the text encoder and Diffusion U-Net models, respectively.",
"preview": "kandinsky-community--kandinsky-3.jpg",
@@ -779,6 +779,22 @@
"size": 27.72,
"date": "2023 November"
},
"Kandinsky 5.0 T2I Lite": {
"path": "kandinskylab/Kandinsky-5.0-T2I-Lite-sft-Diffusers",
"desc": "Kandinsky 5.0 Image Lite is a 6B image generation models 1K resulution, high visual quality and strong text-writing",
"preview": "kandinskylab--Kandinsky-5.0-T2I-Lite-sft-Diffusers.jpg",
"skip": true,
"size": 33.20,
"date": "2025 November"
},
"Kandinsky 5.0 I2I Lite": {
"path": "kandinskylab/Kandinsky-5.0-I2I-Lite-sft-Diffusers",
"desc": "Kandinsky 5.0 Image Lite is a 6B image editing models 1K resulution, high visual quality and strong text-writing",
"preview": "kandinskylab--Kandinsky-5.0-I2I-Lite-sft-Diffusers.jpg",
"skip": true,
"size": 33.20,
"date": "2025 November"
},
"Playground v1": {
"path": "playgroundai/playground-v1",
+3
View File
@@ -29,6 +29,8 @@ force_models_diffusers = [ # forced always
# 'sd3',
'sc',
'h1',
'kandinsky5',
'kandinsky3',
'kandinsky',
'hunyuandit',
'hunyuanimage',
@@ -43,6 +45,7 @@ force_models_diffusers = [ # forced always
'f2',
# video models
'hunyuanvideo',
'hunyuanvideo15'
'cogvideo',
'wanai',
'chrono',
+6
View File
@@ -22,6 +22,10 @@ def get_model_type(pipe):
model_type = 'sd' # instaflow is compatible with sd
elif "AnimateDiffPipeline" in name:
model_type = 'sd' # animatediff is compatible with sd
elif "Kandinsky5" in name:
model_type = 'kandinsky5'
elif "Kandinsky3" in name:
model_type = 'kandinsky3'
elif "Kandinsky" in name:
model_type = 'kandinsky'
elif "HunyuanDiT" in name:
@@ -75,6 +79,8 @@ def get_model_type(pipe):
# video models
elif "CogVideo" in name:
model_type = 'cogvideo'
elif 'HunyuanVideo15':
model_type = 'hunyuanvideo15'
elif 'HunyuanVideoPipeline' in name or 'HunyuanSkyreels' in name:
model_type = 'hunyuanvideo'
elif 'LTX' in name:
+4
View File
@@ -422,6 +422,10 @@ def load_diffuser_force(detected_model_type, checkpoint_info, diffusers_load_con
from pipelines.model_kandinsky import load_kandinsky3
sd_model = load_kandinsky3(checkpoint_info, diffusers_load_config)
allow_post_quant = False
elif model_type in ['Kandinsky 5.0']:
from pipelines.model_kandinsky import load_kandinsky5
sd_model = load_kandinsky5(checkpoint_info, diffusers_load_config)
allow_post_quant = False
elif model_type in ['NextStep']:
from pipelines.model_nextstep import load_nextstep
sd_model = load_nextstep(checkpoint_info, diffusers_load_config) # pylint: disable=assignment-from-none
+37
View File
@@ -71,3 +71,40 @@ def load_kandinsky3(checkpoint_info, diffusers_load_config=None):
devices.torch_gc(force=True, reason='load')
return pipe
def load_kandinsky5(checkpoint_info, diffusers_load_config=None):
if diffusers_load_config is None:
diffusers_load_config = {}
repo_id = sd_models.path_to_repo(checkpoint_info)
sd_models.hf_auth_check(checkpoint_info)
load_args, _quant_args = model_quant.get_dit_args(diffusers_load_config)
shared.log.debug(f'Load model: type=Kandinsky50 repo="{repo_id}" config={diffusers_load_config} offload={shared.opts.diffusers_offload_mode} dtype={devices.dtype} args={load_args}')
transformer = generic.load_transformer(repo_id, cls_name=diffusers.Kandinsky5Transformer3DModel, load_config=diffusers_load_config)
text_encoder = generic.load_text_encoder(repo_id, cls_name=transformers.Qwen2_5_VLForConditionalGeneration, load_config=diffusers_load_config)
if 'I2I' in repo_id:
cls = diffusers.Kandinsky5I2IPipeline
else:
cls = diffusers.Kandinsky5T2IPipeline
pipe = cls.from_pretrained(
repo_id,
transformer=transformer,
text_encoder=text_encoder,
cache_dir=shared.opts.diffusers_dir,
**load_args,
)
pipe.task_args = {
'output_type': 'np',
}
del text_encoder
del transformer
sd_hijack_te.init_hijack(pipe)
sd_hijack_vae.init_hijack(pipe)
devices.torch_gc(force=True, reason='load')
return pipe