Skip to content

Set backend for DDUF#809

Merged
ilopezluna merged 1 commit intomainfrom
set-backend-for-dduf
Mar 30, 2026
Merged

Set backend for DDUF#809
ilopezluna merged 1 commit intomainfrom
set-backend-for-dduf

Conversation

@ilopezluna
Copy link
Copy Markdown
Contributor

@ilopezluna ilopezluna commented Mar 30, 2026

Follow up of #793 This pull request enhances the backend selection logic in the inference scheduler to add support for DDUF/diffusers model formats.

curl http://localhost:13434/v1/images/generations \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "model": "stable-diffusion",
    "prompt": "a dragon wearing a business suit",
    "negative_prompt": "blurry, low quality, distorted, watermark",
    "size": "768x512",
    "n": 2,
    "num_inference_steps": 50,
    "guidance_scale": 7.5,
    "seed": 40,
    "response_format": "b64_json"
  }'| jq -r '.data[0].b64_json' | base64 -d > dragon.png

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for the diffusers backend, allowing the scheduler to handle models in DDUF and legacy diffusers formats. The backend selection logic has been refactored into a switch statement, and corresponding platform support checks and unit tests have been added. A critical issue was identified regarding a potential nil pointer dereference when logging warnings for incompatible backends, as the backend object could be nil in certain scenarios.

@ilopezluna ilopezluna force-pushed the set-backend-for-dduf branch from e4dafab to 4b24cd9 Compare March 30, 2026 10:24
@ilopezluna ilopezluna marked this pull request as ready for review March 30, 2026 10:24
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The selectBackendForModel branches for safetensors and DDUF/diffusers duplicate the pattern of computing backendName and logging a warning; consider extracting this into a small helper to keep the function shorter and reduce repetition.
  • In select_backend_test.go, the tests hardcode the "llamacpp" string for backend keys and expected backend names; using llamacpp.Name instead would avoid drift if the backend name ever changes.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `selectBackendForModel` branches for safetensors and DDUF/diffusers duplicate the pattern of computing `backendName` and logging a warning; consider extracting this into a small helper to keep the function shorter and reduce repetition.
- In `select_backend_test.go`, the tests hardcode the "llamacpp" string for backend keys and expected backend names; using `llamacpp.Name` instead would avoid drift if the backend name ever changes.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ilopezluna ilopezluna requested a review from a team March 30, 2026 10:29
@ilopezluna ilopezluna merged commit 722ec52 into main Mar 30, 2026
15 of 17 checks passed
@ilopezluna ilopezluna deleted the set-backend-for-dduf branch March 30, 2026 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants