Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
coderai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
coderai
Commits
71aa70a0
Commit
71aa70a0
authored
Mar 10, 2026
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use diffusion_model_path for sd.cpp and look for additional model files
parent
3c682962
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
2 deletions
+60
-2
coderai
coderai
+60
-2
No files found.
coderai
View file @
71aa70a0
...
@@ -4600,7 +4600,36 @@ def main():
...
@@ -4600,7 +4600,36 @@ def main():
from
stable_diffusion_cpp
import
StableDiffusion
from
stable_diffusion_cpp
import
StableDiffusion
print
(
f
"Loading with sd.cpp: {model_path}"
)
print
(
f
"Loading with sd.cpp: {model_path}"
)
sd_model
=
StableDiffusion
(
model_path
=
model_path
)
#
For
models
like
Z
-
Image
-
Turbo
/
Flux
,
use
diffusion_model_path
#
Look
for
additional
model
files
in
same
directory
import
os
model_dir
=
os
.
path
.
dirname
(
model_path
)
model_name
=
os
.
path
.
basename
(
model_path
)
#
Try
to
find
additional
model
files
clip_l_path
=
None
t5xxl_path
=
None
vae_path
=
None
#
Look
for
common
file
patterns
for
f
in
os
.
listdir
(
model_dir
)
if
os
.
path
.
exists
(
model_dir
)
else
[]:
if
'clip_l'
in
f
.
lower
()
and
f
.
endswith
((
'.safetensors'
,
'.bin'
)):
clip_l_path
=
os
.
path
.
join
(
model_dir
,
f
)
elif
't5xxl'
in
f
.
lower
()
and
f
.
endswith
((
'.safetensors'
,
'.bin'
)):
t5xxl_path
=
os
.
path
.
join
(
model_dir
,
f
)
elif
f
.
endswith
(
'.safetensors'
)
and
'ae'
in
f
.
lower
():
vae_path
=
os
.
path
.
join
(
model_dir
,
f
)
#
Build
kwargs
based
on
available
files
sd_kwargs
=
{
'diffusion_model_path'
:
model_path
}
if
clip_l_path
:
sd_kwargs
[
'clip_l_path'
]
=
clip_l_path
if
t5xxl_path
:
sd_kwargs
[
't5xxl_path'
]
=
t5xxl_path
if
vae_path
:
sd_kwargs
[
'vae_path'
]
=
vae_path
sd_model
=
StableDiffusion
(**
sd_kwargs
)
multi_model_manager
.
add_model
(
model_key
,
sd_model
)
multi_model_manager
.
add_model
(
model_key
,
sd_model
)
print
(
f
"Image model loaded successfully via sd.cpp: {original_model_name}"
)
print
(
f
"Image model loaded successfully via sd.cpp: {original_model_name}"
)
except
ImportError
as
sd_error
:
except
ImportError
as
sd_error
:
...
@@ -5012,7 +5041,36 @@ def main():
...
@@ -5012,7 +5041,36 @@ def main():
from stable_diffusion_cpp import StableDiffusion
from stable_diffusion_cpp import StableDiffusion
print(f"Loading with sd.cpp: {model_path}")
print(f"Loading with sd.cpp: {model_path}")
sd_model = StableDiffusion(model_path=model_path)
# For models like Z-Image-Turbo/Flux, use diffusion_model_path
# Look for additional model files in same directory
import os
model_dir = os.path.dirname(model_path)
model_name = os.path.basename(model_path)
# Try to find additional model files
clip_l_path = None
t5xxl_path = None
vae_path = None
# Look for common file patterns
for f in os.listdir(model_dir) if os.path.exists(model_dir) else []:
if '
clip_l
' in f.lower() and f.endswith(('
.
safetensors
', '
.
bin
')):
clip_l_path = os.path.join(model_dir, f)
elif '
t5xxl
' in f.lower() and f.endswith(('
.
safetensors
', '
.
bin
')):
t5xxl_path = os.path.join(model_dir, f)
elif f.endswith('
.
safetensors
') and '
ae
' in f.lower():
vae_path = os.path.join(model_dir, f)
# Build kwargs based on available files
sd_kwargs = {'
diffusion_model_path
': model_path}
if clip_l_path:
sd_kwargs['
clip_l_path
'] = clip_l_path
if t5xxl_path:
sd_kwargs['
t5xxl_path
'] = t5xxl_path
if vae_path:
sd_kwargs['
vae_path
'] = vae_path
sd_model = StableDiffusion(**sd_kwargs)
multi_model_manager.add_model(model_key, sd_model)
multi_model_manager.add_model(model_key, sd_model)
print(f"Image model loaded successfully via sd.cpp: {original_model_name}")
print(f"Image model loaded successfully via sd.cpp: {original_model_name}")
except ImportError as sd_error:
except ImportError as sd_error:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment