From 2653dd812e321e5458713a260e26d8c4e7c9440f Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sat, 16 Dec 2023 15:27:43 -0600 Subject: [PATCH] feat(api): allow embeddings as a synonym for TI token --- api/onnx_web/diffusers/utils.py | 2 +- docs/user-guide.md | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/api/onnx_web/diffusers/utils.py b/api/onnx_web/diffusers/utils.py index c54f853b..860c70cb 100644 --- a/api/onnx_web/diffusers/utils.py +++ b/api/onnx_web/diffusers/utils.py @@ -18,7 +18,7 @@ MAX_TOKENS_PER_GROUP = 77 ANY_TOKEN = compile(r"\<([^\>]*)\>") CLIP_TOKEN = compile(r"\") -INVERSION_TOKEN = compile(r"\]+):(-?[\.|\d]+)\>") +INVERSION_TOKEN = compile(r"\<(embeddings|inversion):([^:\>]+):(-?[\.|\d]+)\>") LORA_TOKEN = compile(r"\]+):(-?[\.|\d]+)\>") REGION_TOKEN = compile( r"\]+)\>" diff --git a/docs/user-guide.md b/docs/user-guide.md index 3812c87c..3a75dd59 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -31,7 +31,7 @@ Please see [the server admin guide](server-admin.md) for details on how to confi - [Useful keywords](#useful-keywords) - [Prompt tokens](#prompt-tokens) - [LoRA and LyCORIS tokens](#lora-and-lycoris-tokens) - - [Textual Inversion tokens](#textual-inversion-tokens) + - [Embedding (Textual Inversion) tokens](#embedding-textual-inversion-tokens) - [Prompt stages](#prompt-stages) - [Region tokens](#region-tokens) - [Reseed tokens (region seeds)](#reseed-tokens-region-seeds) @@ -371,16 +371,20 @@ the `` token _and_ the keywords to activate the LoRA. Check out [the `kohya-ss/sd-scripts` repository](https://github.com/kohya-ss/sd-scripts) for more details. -#### Textual Inversion tokens +#### Embedding (Textual Inversion) tokens You can blend one or more [Textual Inversions](https://textual-inversion.github.io/) with the ONNX diffusion model -using the `inversion` token: +using the `embeddings` token _and_ one or more layer token: ```none - + autumn, ... + autumn, ... ``` -Textual Inversion embeddings must be placed in the `models/inversion` directory and may be any supported tensor format. +The `` token is a synonym for `` and operates exactly the same way. + +Textual Inversion embeddings must be placed in the `models/inversion` directory regardless of which token you use, and +may be any supported tensor format. The type of network, name, and weight must be separated by colons. The Textual Inversion name must be alphanumeric and must not contain any special characters other than `-` and `_`.