diff --git a/README.md b/README.md index c57d2c07..ddf4dd1b 100644 --- a/README.md +++ b/README.md @@ -328,7 +328,7 @@ Make a copy of the `api/extras.json` file and edit it to include the models you ``` Models based on Stable Diffusion typically need to be in the `diffusion` category, including the Stable Diffusion -upscaling model. You can provide a local path, starting with `./`, or a repository on https://huggingface.co. +upscaling model. For more details, please [see the user guide](./docs/user-guide.md#adding-your-own-models). Set the `ONNX_WEB_EXTRA_MODELS` environment variable to the path to your new `extras.json` file before running the launch script: @@ -346,7 +346,7 @@ launch script: ### Test the models You should verify that all of the steps up to this point have worked correctly by attempting to run the -`api/test-setup.py` script, which is a slight variation on the original txt2img script. +`api/test-diffusers.py` script, which is a slight variation on the original txt2img script. If the script works, there will be an image of an astronaut in `outputs/test.png`. diff --git a/docs/chain-pipelines.md b/docs/chain-pipelines.md index b26a250d..23a8c7ae 100644 --- a/docs/chain-pipelines.md +++ b/docs/chain-pipelines.md @@ -15,6 +15,7 @@ are run on each tile, then the results are recombined and passed on to the next - [Blend: Img2img](#blend-img2img) - [Blend: Inpaint](#blend-inpaint) - [Correction Stages](#correction-stages) + - [Correct: CodeFormer](#correct-codeformer) - [Correct: GFPGAN](#correct-gfpgan) - [Persistence Stages](#persistence-stages) - [Persist: Disk](#persist-disk) @@ -85,6 +86,8 @@ in [`common/pipelines`](../common/pipelines). ### Correction Stages +#### Correct: CodeFormer + #### Correct: GFPGAN ### Persistence Stages diff --git a/docs/guide-civitai.png b/docs/guide-civitai.png new file mode 100644 index 00000000..5703fd84 --- /dev/null +++ b/docs/guide-civitai.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:09d3e5e7e1f817fc1e95a059022d0b405189c605d78c2e623b8a7840ba109439 +size 31604 diff --git a/docs/user-guide.md b/docs/user-guide.md index d9cd3c43..ff4ea431 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -26,9 +26,10 @@ Please see [the server admin guide](server-admin.md) for details on how to confi - [Image history](#image-history) - [Scheduler comparison](#scheduler-comparison) - [Models](#models) + - [Model names](#model-names) - [Adding your own models](#adding-your-own-models) - - [Model Names](#model-names) - - [Model sources](#model-sources) + - [Model sources](#model-sources) + - [Downloading models from Civitai](#downloading-models-from-civitai) - [Tabs](#tabs) - [Txt2img tab](#txt2img-tab) - [Scheduler parameter](#scheduler-parameter) @@ -153,6 +154,17 @@ The models used by ONNX web are split up into three groups: There are many other models available and specialized variations for anime, TV shows, and all sorts of other styles. +### Model names + +The `name` of each model dictates which category it will appear in on the client. + +- `diffusion-*` or `stable-diffusion-*` for diffusion models +- `upscaling-*` for upscaling models +- `correction-*` for correction models + +Models that do not match one of the prefixes will not be shown, so if you cannot find a model that you have converted, +make sure it is named correctly. + ### Adding your own models You can convert and use your own models without making any code changes by copying @@ -191,6 +203,10 @@ You can convert and use your own models without making any code changes by copyi } ``` +Models can be added from the directories used by `diffusers` as well as SafeTensor and Pickle checkpoints. Be careful +loading PickleTensors, as they may contain unsafe code which can be executed on your machine, and use SafeTensor instead +whenever possible. + Set the `ONNX_WEB_EXTRA_MODELS` environment variable to the path to your file. For example: ```shell @@ -204,20 +220,10 @@ Set the `ONNX_WEB_EXTRA_MODELS` environment variable to the path to your file. F Extras using the older file format with nested arrays (`"diffusion": [[]]`) can be mixed with the newer format. You only need to convert them into the newer format if you need to use keys other than `name`, `source`, and `scale`. -#### Model Names +### Model sources -The `name` of each model dictates which category it will appear in on the client. - -- `diffusion-*` or `stable-diffusion-*` for diffusion models -- `upscaling-*` for upscaling models -- `correction-*` for correction models - -Models that do not match one of the prefixes will not be shown, so if you cannot find a model that you have converted, -make sure it is named correctly. - -#### Model sources - -You can provide an absolute or relative path to a local model, an HTTPS URL, or use one of the pre-defined sources: +You can either provide the path to a local model that you have already downloaded or provide a URL to be +automatically downloaded, using HTTPS or one of the pre-defined sources: - `huggingface://` - https://huggingface.co/models?other=stable-diffusion @@ -230,12 +236,25 @@ You can provide an absolute or relative path to a local model, an HTTPS URL, or - `https://` - any other HTTPS source - `../models/.cache/your-model.safetensors` - - relative or absolute paths + - relative paths +- `/home/ssube/onnx-web/models/.cache` or `C:\Users\ssube\onnx-web\models\.cache` + - absolute paths If the model is a single file and the `source` does not include a file extension like `.safetensors` or `.ckpt`, make sure to indicate the file format using the `format` key. You do not need to provide the `format` for directories and models from the HuggingFace hub. +#### Downloading models from Civitai + +When downloading models from Civitai, the ID shown in the browser URL bar _may not be_ the ID of the model itself. +Since models can have multiple versions, make sure you use the correct ID. Use the model ID from the download link, +which you can see and copy from the right-click menu: + +![Chrome context menu with Copy link address highlighted](guide-civitai.png) + +You want the Pruned SafeTensor, if one is available. Be careful downloading PickleTensors, they may contain unsafe +code. The original, non-pruned models are much larger but are better for training. + ## Tabs ### Txt2img tab