Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stable diffusion api error 404 #4482

Closed
4 tasks done
olivielvs opened this issue May 17, 2024 · 6 comments
Closed
4 tasks done

stable diffusion api error 404 #4482

olivielvs opened this issue May 17, 2024 · 6 comments
Labels
🐞 bug Something isn't working

Comments

@olivielvs
Copy link

olivielvs commented May 17, 2024

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.8

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

connect your stable diffusion instance and tried to generate an image, I get a 404 error
log stable diff server v1.9.3 :
API 2024-05-17 10:56:48.558694 200 http/1.1 GET /sdapi/v1/sd-models xxx.xxx.xxx 0.0017
API 2024-05-17 10:56:48.743417 200 http/1.1 POST /sdapi/v1/options xxx.xxx.xxx 0.0012
API 2024-05-17 10:51:49.979496 404 http/1.1 POST /sdapi/v1/txt2img xxx.xxx.xxx 0.0043
log dify server:
{
"prompt": "a dog",
"model": "DreamShaperXL_Turbo_v2_1",
"lora": "",
"steps": 5,
"width": 50,
"height": 50,
"negative_prompt": "bad art, ugly, deformed, watermark, duplicated, discontinuous lines"
}

{
"text": "Failed to generate image\n",
"files": []
}

✔️ Expected Behavior

image generation

❌ Actual Behavior

error 404

Copy link

dosubot bot commented May 17, 2024

The 404 error you're encountering when trying to generate an image with the /sdapi/v1/txt2img endpoint is likely due to a misconfiguration or an issue with the model name or path in your Dify Stable Diffusion setup. Here's how you can address this:

  1. Check Configuration: Ensure your base_url and model are correctly set. The base_url should accurately point to your Stable Diffusion API, and the model name must exactly match the model you're trying to use.

  2. Model Availability: Verify that the model you're attempting to use exists on your server. This can be done by checking the model's name or using a function to validate the model's existence.

  3. API Endpoint Accuracy: Confirm that you're making the request to the correct API endpoint. For text-to-image generation, the endpoint should indeed be /sdapi/v1/txt2img.

  4. Error Handling: Implement proper error handling to catch and diagnose the specific reason for the failure. This can help in identifying whether the issue is with the model setting or another configuration aspect.

  5. Parameter Validation: Make sure that the parameters for the image generation (prompt, width, height, steps, etc.) are correctly set according to the requirements of your model and the Stable Diffusion documentation.

By following these steps, you should be able to resolve the 404 error and successfully generate images with your self-hosted Dify setup using the Stable Diffusion API.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@dosubot dosubot bot added the 🐞 bug Something isn't working label May 17, 2024
@olivielvs
Copy link
Author

Thx chat gpt but my post request creates a generation without problem from my dify server. The problem comes from the use of the stable diffusion API by dify. @dosu

Copy link

dosubot bot commented May 17, 2024

It appears the issue with the 404 error when using the /sdapi/v1/txt2img endpoint might be related to how Dify is constructing the request or how the Stable Diffusion API is handling it, especially since other endpoints are working as expected. The problem could be specific to the request payload or the way the endpoint is being called.

To further diagnose and potentially resolve this issue, it would be helpful to have more details about the error message or response from the Stable Diffusion API when the 404 occurs. This information could provide insights into whether the issue lies with the request's construction, the model's availability, or another aspect of the API interaction.

If you have access to more detailed logs or error messages from the Stable Diffusion API that occur at the time of the 404 error, sharing those could be crucial in pinpointing the exact cause and finding a solution.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@Scenx
Copy link

Scenx commented May 18, 2024

我也遇到了同样的错误

@GiftLee
Copy link

GiftLee commented May 20, 2024

in code 'sampler_index': 'DPM++ SDE Karras', is default
but webui api not found DPM++ SDE Karras
404 is sampler is not found

@olivielvs
Copy link
Author

GG nice

modif "/dify/api/core/tools/provider/builtin/stablediffusion/tools/stable_diffusion.py" in your docker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants