Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SD/API: Add missing A1111 APIs to Shark to support koboldcpp image ge…
…neration (#1924) * SD/API: Add missing a1111 API features for Koboldcpp * Refactors SD api functions into their own file * Adds the following apis implemented by a1111 as needed by koboldcpp: - adds /sdapi/v1/sd-models (lists available models) - adds /sdapi/v1/options (only the bare minimum needed) * Adds optional CORS support, use the '--api_accept_origin' command line argument to activate and configure. * Extends existing APIs to include optional sampler/scheduler selection * Extends /sdapi/v1/textimg to recognise the method used by koboldcpp to select the model. * Where possible take values not provided to the API in the request from the existing relevant command line parameters rather than hardcoding them. * return a 400 response when a request doesn't have required properties. * changed default schedulers and models for some apis to ones that actually seem to work. * Update api_test.py to include the new APIs. * Update api_test.py to include a '--verbose' command line option. * SD/API: Take more API values from args * Take LoRA from '--use_lora' command line arg if specified * Take device from '--device' command line arg if specified (substring match, so a short name such as 'vulkan://0' should work) * SD/API: add more endpoints and pydantic typing * Mount the whole of /sdapi from index.py as a FastAPI application, rather than each endpoint individually * Add the following additional API endpoints: * /sdapi/v1/samplers * /sdapi/v1/cmd-flags * Make scheduler/sampler selection checking and fallback much more robust. * Support aliasing some A1111 scheduler/sampler names to the diffusers ones we are using. * Expand response /sdapi/v1/options to add a few more things. * Split non-api functions and variables into their own utils.py file. * Support 'n_iter' request property and the return of multiple images from generation endpoints. Equivalent of '--batch_count', batch_size is stil hardcoded at 1 * Include (some) hires_fix request properties in txt2img endpoint * Rework endpoints using pydantic model classes for better request validation and so we get much improved swagger api docs at /sdapi/docs and redoc at /sdapi/redoc * SD/API Delete commented out code from index.py * Delete some code that is no longer needed by the SD API in index.py (and one line sdapi_v1.py) that I'd previously only commented out. * SD/UI: Add shark_sd_koboldcpp.md document * Add documentation on how to set up Koboldcpp with SHARK * Link this and the existing blender set up document from the main README.md * SD/API Improve stencil options in img2img endpoint In /sdapi/v1/img2img: * Add zoedepth to the controlnet use_stencil options * Require and use second image as stencil mask for controlnet scribble
- Loading branch information