mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
d335f51e5f
prompt token sequences begin with a "beginning-of-sequence" marker <bos> and end with a repeated "end-of-sequence" marker <eos> - to make a default prompt length of <bos> + 75 prompt tokens + <eos>. the .swap() code was failing to take the column for <bos> at index 0 into account. the changes here do that, and also add extra handling for a single <eos> (which may be redundant but which is included for completeness). based on my understanding and some assumptions about how this all works, the reason .swap() nevertheless seemed to do the right thing, to some extent, is because over multiple steps the conditioning process in Stable Diffusion operates as a feedback loop. a change to token n-1 has flow-on effects to how the [1x4x64x64] latent tensor is modified by all the tokens after it, - and as the next step is processed, all the tokens before it as well. intuitively, a token's conditioning effects "echo" throughout the whole length of the prompt. so even though the token at n-1 was being edited when what the user actually wanted was to edit the token at n, it nevertheless still had some non-negligible effect, in roughly the right direction, often enough that it seemed like it was working properly. |
||
---|---|---|
.. | ||
generator | ||
restoration | ||
__init__.py | ||
args.py | ||
CLI.py | ||
concepts_lib.py | ||
conditioning.py | ||
devices.py | ||
globals.py | ||
image_util.py | ||
log.py | ||
model_cache.py | ||
pngwriter.py | ||
prompt_parser.py | ||
readline.py | ||
seamless.py | ||
server_legacy.py | ||
server.py | ||
txt2mask.py |