Commit 2cedd442 authored by Your Name's avatar Your Name

Revert: Keep sd.cpp fallback available for all models when diffusers fails

- Removed the GGUF-only restriction on sd.cpp fallback
- Some HF models may be GGUF even without 'gguf' in the name
- Let sd.cpp attempt loading and fail gracefully if incompatible
- This allows sd.cpp to work as a proper fallback for any model type
parent f5b9d812
......@@ -534,17 +534,11 @@ async def create_image_generation(request: ImageGenerationRequest, http_request:
print(f"Traceback: {traceback.format_exc()}")
print(f"Trying stable-diffusion-cpp-python...")
# Try stable-diffusion-cpp-python (sd.cpp) as fallback - ONLY for GGUF models
# sd.cpp only works with GGUF models, not diffusers models
is_potential_gguf_model = (model_to_use.endswith('.gguf') or 'gguf' in model_to_use.lower() or
(model_to_use.startswith('http') and '.gguf' in model_to_use) or
(not model_to_use.startswith('http') and '/' in model_to_use)) # HF model IDs might be GGUF
if not is_potential_gguf_model:
print(f"Model '{model_to_use}' is not a GGUF model (sd.cpp only supports GGUF), skipping sd.cpp fallback")
sd_model = None
else:
# Try stable-diffusion-cpp-python (sd.cpp) as fallback for GGUF models
# Try stable-diffusion-cpp-python (sd.cpp) as fallback when diffusers fails
# sd.cpp works with GGUF models, but some HF models may be GGUF even without "gguf" in name
# Let sd.cpp attempt loading and fail gracefully if it's not compatible
# Try stable-diffusion-cpp-python (sd.cpp) as fallback
# First, check all available image models to find one loaded via sd.cpp
# Always check for cached models - allows dynamically loaded models to be reused across requests
sd_model = None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment