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
27527de3
Commit
27527de3
authored
Mar 15, 2026
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CUDA detection for sd.cpp image generation backend
parent
b8e81009
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
6 deletions
+28
-6
coderai
coderai
+28
-6
No files found.
coderai
View file @
27527de3
...
@@ -3665,12 +3665,34 @@ async def create_image_generation(request: ImageGenerationRequest):
...
@@ -3665,12 +3665,34 @@ async def create_image_generation(request: ImageGenerationRequest):
sd_cpp_error = "Could not resolve model path"
sd_cpp_error = "Could not resolve model path"
else:
else:
# Load sd.cpp model
# Load sd.cpp model
sd_model = StableDiffusion(
# Determine backend to use
model_path=model_path,
backend = getattr(global_args, '
backend
', '
auto
')
vae_path=None,
image_backend = getattr(global_args, '
image_backend
', '
auto
')
n_threads=4,
n_gpu_layers=-1, # All layers to GPU
# Use CUDA if available, otherwise Vulkan
)
use_cuda = False
try:
import torch
use_cuda = torch.cuda.is_available()
except ImportError:
pass
if use_cuda:
print(f"Using CUDA backend for sd.cpp image generation")
sd_model = StableDiffusion(
model_path=model_path,
vae_path=None,
n_threads=4,
n_gpu_layers=-1, # All layers to GPU
)
else:
print(f"Using Vulkan backend for sd.cpp image generation")
sd_model = StableDiffusion(
model_path=model_path,
vae_path=None,
n_threads=4,
n_gpu_layers=-1, # All layers to GPU
)
print(f"Using stable-diffusion-cpp-python for image generation")
print(f"Using stable-diffusion-cpp-python for image generation")
...
...
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