Open maxin9966 opened 1 month ago
Hi @maxin9966
Can you take a look at:
https://github.com/mix1009/sdwebuiapi
AND
https://github.com/mix1009/sdwebuiapi?tab=readme-ov-file#tips-for-using-flux-david-martin-rius
This project is a wrapper for the Forge API, and you can use it.
I hope it is useful.
How are you getting any Successful response from /sdapi/v1/txt2img
?
I disabled all my extensions, go to http://127.0.0.1:7860/docs
, expand /sdapi/v1/txt2img
and click Try it now with default values and get this error:
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 396, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 70, in __call__
return await self.app(scope, receive, send)
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\fastapi\applications.py", line 1106, in __call__
await super().__call__(scope, receive, send)
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\starlette\applications.py", line 122, in __call__
await self.middleware_stack(scope, receive, send)
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\starlette\middleware\errors.py", line 184, in __call__
raise exc
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\starlette\middleware\errors.py", line 162, in __call__
await self.app(scope, receive, _send)
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\gradio\route_utils.py", line 730, in __call__
await self.simple_response(scope, receive, send, request_headers=headers)
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\gradio\route_utils.py", line 746, in simple_response await self.app(scope, receive, send)
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__
raise exc
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__
await self.app(scope, receive, sender)
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 20, in __call__
raise e
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 17, in __call__
await self.app(scope, receive, send)
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\starlette\routing.py", line 718, in __call__
await route.handle(scope, receive, send)
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\starlette\routing.py", line 276, in handle
await self.app(scope, receive, send)
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\starlette\routing.py", line 66, in app
response = await func(request)
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\fastapi\routing.py", line 274, in app
raw_response = await run_endpoint_function(
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\fastapi\routing.py", line 193, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\starlette\concurrency.py", line 41, in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "C:\0_SD\stable-diffusion-webui-forge\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
result = context.run(func, *args)
File "C:\0_SD\stable-diffusion-webui-forge\modules\api\api.py", line 434, in text2imgapi
self.apply_infotext(txt2imgreq, "txt2img", script_runner=script_runner, mentioned_script_args=infotext_script_args)
File "C:\0_SD\stable-diffusion-webui-forge\modules\api\api.py", line 419, in apply_infotext
value = get_field_value(field, params)
File "C:\0_SD\stable-diffusion-webui-forge\modules\api\api.py", line 380, in get_field_value
target_type = request.__fields__[field.api].type_
AttributeError: 'FieldInfo' object has no attribute 'type_'
- git pull origin main
- pip install -r requirements_versions.txt Could you execute this commands and try it again?
Thanks, I’ll give this a try later when I am able.
Some notes:
I cloned the repo about 1-2 weeks ago, and have been pulling regularly. The API was working at first, but stopped soon after due to some commit. The only warning I’ve received in CMD was a few days ago, to reinstall xformers which I did. Nonetheless, I use the disable xformers flag when launching with api.
@davidmartinrius
git pull origin main
already up to date
Before running pip install -r requirements_versions.txt
I activated the venv, cd back to root dir and then executed it.
For the entire list: requirement already satisfied
These were my previous launch flags: --disable-xformers --pin-shared-memory --cuda-stream --api --listen --api-server-stop
I tried now with the same, as well as simply --api
Same error.
AttributeError: 'FieldInfo' object has no attribute 'type_'
I've tried with both an XL model loaded, and with the recommended Flux model loaded, same error.
I'm going to try reinstalling the whole thing.
Until I saw @maxin9966 recent post here, I was under the impression that the API was known to be completely bugged
I am executing the UI like this: ./webui.sh --always-offload-from-vram --api --medvram --api --cuda-malloc --cuda-stream
Fresh install... all I did was copy epicrealismXL_v7FinalDestination.safetensors
in, and add --api
to cmd flags.
I loaded the model and generated an image, then went to http://127.0.0.1:7860/docs#/default/text2imgapi_sdapi_v1_txt2img_post
and used alll the defaults and got the same error.
This API is definitely broken right now. If you are using 3rd party tools to hijack / monkey patch the API, then I recommend making that bit very clear when posting here so other users do not get confused into thinking the native API is functioning (which it is not).
Ok, in the meantime I think you can do something like git checkout
And you will be able to work with forge again. You can do git log to search for old commits, you could search for a commit from the previous month.
On the other hand, you could try to work with Flux from now onwards... sdxl and sd is going to be obsolete as Flux is much better. I am currently working with the API + Flux and it works well with the last commit
I am currently working with the API + Flux and it works well with the last commit
Please confirm: You are not using "sdwebuiapi project" ?
The API call is /sdapi/v1/txt2img, with the following parameters being passed. The returned image seems to have issues, appearing notably coarser compared to images generated through the web interface. For instance, the texture of the hair is particularly noticeable. Could you identify which parameter was input incorrectly? Could you provide a typical set of parameters for this API call?