Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge dev to master #2897

Merged
merged 136 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
10cab9a
post merge cleanup
vladmandic Feb 7, 2024
8e708e7
Deploying to master from @ vladmandic/automatic@fa7972ff59f2aa4e4cbf3…
vladmandic Feb 7, 2024
8d8815d
Lock tensordict to 0.2.1
Disty0 Feb 7, 2024
d5a4f43
post release jumbo update
vladmandic Feb 8, 2024
f3be294
add deep-cache support
vladmandic Feb 8, 2024
af4da02
update changelog
vladmandic Feb 8, 2024
748ed53
onnx tooltip, olive-ai check
lshqqytiger Feb 8, 2024
ebdabb1
Correction for Diffusers clip_skip math
Disty0 Feb 8, 2024
5b76fc3
update notes
vladmandic Feb 8, 2024
0923a98
Fix diffusers clip_skip math
Disty0 Feb 8, 2024
312f391
add theme cli arg
vladmandic Feb 8, 2024
251373a
Hijacking Compel to enable clip skip
AI-Casanova Feb 8, 2024
e883348
Fix offset
AI-Casanova Feb 8, 2024
f56d210
update clip-skip code
vladmandic Feb 9, 2024
2dbf674
update changelog
vladmandic Feb 9, 2024
c9444c8
cleanup
vladmandic Feb 9, 2024
9a1ce4d
Adjust clip skip to expected range
Disty0 Feb 9, 2024
d867e7a
Diffusers add Dynamic Attention Slicing
Disty0 Feb 9, 2024
96d262b
update img2img mask math
vladmandic Feb 9, 2024
5afd4b8
control unit reuse preview image, handle extensions installing confli…
vladmandic Feb 9, 2024
9150e9f
handle opencv conflict
vladmandic Feb 9, 2024
94a8f41
xyzgrid for ipadapter
vladmandic Feb 9, 2024
12e49ac
OpenVINO update to torch 2.2.0
Disty0 Feb 9, 2024
e8f025f
fix image lazy load
vladmandic Feb 9, 2024
6297a64
add sdxl vae load workaround
vladmandic Feb 9, 2024
5f6ec08
fix typo
vladmandic Feb 9, 2024
33c8285
Experimental clip skip interpolation
AI-Casanova Feb 9, 2024
a069a45
cast clipskip
vladmandic Feb 9, 2024
40feb79
add clip-skip notes
vladmandic Feb 9, 2024
cfb059c
fix onnx sdxl
lshqqytiger Feb 9, 2024
bf14e6e
fix mask missing options and system paths
vladmandic Feb 10, 2024
8ec457c
add allowed paths cli param
vladmandic Feb 10, 2024
19e5062
fix interrogate api
vladmandic Feb 10, 2024
71caa89
onnx fp16 vae
lshqqytiger Feb 10, 2024
43c5be7
Unite attention optimization settings
Disty0 Feb 9, 2024
304caf8
update cross-attention
vladmandic Feb 10, 2024
1c4293a
remove obsolete kohya lora code
vladmandic Feb 10, 2024
12675a0
cleanup repo
vladmandic Feb 10, 2024
3bb8082
Update changelog
Disty0 Feb 10, 2024
bb30a2d
Revert submodules
Disty0 Feb 10, 2024
b76d9ce
cleanup
Disty0 Feb 10, 2024
c528b4b
update todo
vladmandic Feb 10, 2024
0ac2dfb
Dyn Atten don't synchronize if not slicing
Disty0 Feb 10, 2024
ef909cd
HyperTile add swap size and depth options
Disty0 Feb 10, 2024
e731505
refactor ip adapters
vladmandic Feb 10, 2024
132cdb1
update readme
vladmandic Feb 10, 2024
2f73eb1
update changelog
vladmandic Feb 10, 2024
1ff909f
Add option to use HyperTile on only hires pass
Disty0 Feb 10, 2024
c61a92d
fix ipadapter none lookup
vladmandic Feb 10, 2024
fa833a5
Draft: XYZ only
AI-Casanova Feb 11, 2024
3f8da51
Set default atten for ROCm to SDP
Disty0 Feb 11, 2024
3c9a4d5
init values for ip
vladmandic Feb 11, 2024
c9e01b4
OpenVINO fix --device-id with single GPU
Disty0 Feb 11, 2024
a675347
Cleanup
Disty0 Feb 11, 2024
baf42fb
Fix dtype mismatch with vae decode
Disty0 Feb 12, 2024
7021ffb
Add UI controls
AI-Casanova Feb 12, 2024
fd28ec1
Merge branch 'dev' into ipadapter-end
AI-Casanova Feb 12, 2024
c24539b
Fix NNCF compatibility with model cpu offload
Disty0 Feb 12, 2024
d65067a
fix control processor images handling
vladmandic Feb 12, 2024
6c9d35a
new gradio hijacks
vladmandic Feb 12, 2024
52f3683
update changelog
vladmandic Feb 12, 2024
239e3f8
add masking debug
vladmandic Feb 12, 2024
c9fc135
failsafe mask region
vladmandic Feb 12, 2024
9532f89
Fix vae has no post_quant_conv
Disty0 Feb 12, 2024
db1e1cc
update token counter
vladmandic Feb 12, 2024
03094f8
Merge branch 'dev' into ipadapter-end
AI-Casanova Feb 13, 2024
3d9e546
Finish TODO fix script
AI-Casanova Feb 13, 2024
3190e85
OpenVINO fix quant not being applied
Disty0 Feb 13, 2024
75cbe4f
Merge branch 'dev' into ipadapter-end
vladmandic Feb 13, 2024
9e5ade6
Merge branch 'AI-Casanova-ipadapter-end' into dev
vladmandic Feb 13, 2024
943b1c1
fix prompts-from-file
vladmandic Feb 13, 2024
f5c1cb1
ipadapter merge cleanup and add metadata
vladmandic Feb 13, 2024
1bcaa77
error handling
vladmandic Feb 13, 2024
a72a0f4
error messages
vladmandic Feb 13, 2024
e65e841
fix ext updated info
vladmandic Feb 13, 2024
0beb5d5
update requirements
vladmandic Feb 13, 2024
86e8791
Update IPEX Optimize logging
Disty0 Feb 13, 2024
08567b2
refactor and fix embedding registration
AI-Casanova Feb 13, 2024
5fe82c4
Fix model archs with no VAE
Disty0 Feb 13, 2024
ccd6c86
Fix EN embedding refresh
AI-Casanova Feb 13, 2024
c16cd2e
handle dict as pipeline result
vladmandic Feb 13, 2024
935d7ef
new control outpaint
vladmandic Feb 14, 2024
635c071
fix ipadapter check
vladmandic Feb 14, 2024
7d25ba4
Wuerstchen fixes
Disty0 Feb 14, 2024
52efa90
Experimental Stable Cascade support
Disty0 Feb 14, 2024
ae10ae6
Cleanup
Disty0 Feb 14, 2024
0e91c46
cleanup stable cascade
vladmandic Feb 14, 2024
d27295a
fix masking
vladmandic Feb 14, 2024
ae4f7e6
regional prompting
vladmandic Feb 14, 2024
47199e5
update changelog
vladmandic Feb 14, 2024
a956be0
OpenVINO add disable memory cleanup option
Disty0 Feb 14, 2024
cc44386
Initial ZLUDA support.
lshqqytiger Feb 14, 2024
25c6527
for Windows only
lshqqytiger Feb 14, 2024
290bfc8
fix hijack and update script layout
vladmandic Feb 15, 2024
6f52425
update script headings
vladmandic Feb 15, 2024
1b3028b
minor update
vladmandic Feb 15, 2024
d0ceff7
update masking
vladmandic Feb 15, 2024
e631fd8
Stable Cascade previewer and fixes
Disty0 Feb 15, 2024
efbb940
avoid unnecessary mask double resize
vladmandic Feb 15, 2024
b28fd28
lora strict filename matching
vladmandic Feb 15, 2024
cc9d096
ZLUDA loosen attention settings
Disty0 Feb 15, 2024
d76136f
cleanup
vladmandic Feb 16, 2024
00e58c0
add control mask size and outpaint masked only
vladmandic Feb 16, 2024
02336fd
refactor txt2img/img2img api
vladmandic Feb 16, 2024
5ffc692
update theme cli param
vladmandic Feb 16, 2024
1b04494
cleanup theme
vladmandic Feb 16, 2024
8caa822
lint updates
vladmandic Feb 16, 2024
a01b5fc
modularize launch
vladmandic Feb 16, 2024
38c5beb
fix typo
vladmandic Feb 16, 2024
6e412d4
add zluda force sync
lshqqytiger Feb 17, 2024
8ae3b5b
remove zluda force sync
lshqqytiger Feb 17, 2024
2a10875
fix restore pipeline
vladmandic Feb 17, 2024
5f39f80
add callback tracing
vladmandic Feb 17, 2024
2785af1
zluda enable math sdp kernel
lshqqytiger Feb 17, 2024
38421e3
fix #2785
AI-Casanova Feb 18, 2024
bdce5c1
update
vladmandic Feb 18, 2024
50beb21
Diffusers subseeds
AI-Casanova Feb 17, 2024
be81d48
xadapter prototype and placeholder
vladmandic Feb 18, 2024
ee7517d
expose sdp options
vladmandic Feb 19, 2024
0e1fb9c
zluda force sdp_options to math
lshqqytiger Feb 19, 2024
4710688
Update ui_control.py
BinaryQuantumSoul Feb 19, 2024
456af9a
refactor compile out of processing
vladmandic Feb 19, 2024
cf3fbad
gracefully fail onnx imports
vladmandic Feb 19, 2024
0239435
add differential diffusion
vladmandic Feb 20, 2024
02b03d6
update changelog
vladmandic Feb 20, 2024
44dace8
change gradio textbox handler to submit+unfocus instead of keypress
vladmandic Feb 20, 2024
aec8f76
add differential-diffusion support for sd15
vladmandic Feb 20, 2024
cf7118b
refactor stable-cascade, fix taesd bf16, add skip-env cmd flag
vladmandic Feb 21, 2024
ee4413d
Improve scrollbar
MMP0 Feb 21, 2024
d5eb09c
provide more informative logs for zluda
lshqqytiger Feb 22, 2024
f3bf2c2
minor fixes
vladmandic Feb 22, 2024
3604213
legacy cleanups
vladmandic Feb 22, 2024
f7becfb
update changelog
vladmandic Feb 22, 2024
c2eaa04
update changelog
vladmandic Feb 22, 2024
0521f8c
minor updates
vladmandic Feb 22, 2024
9d1a827
Merge branch 'master' into dev
vladmandic Feb 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
path = modules/k-diffusion
url = https://github.com/crowsonkb/k-diffusion
ignore = dirty
[submodule "modules/lora"]
path = modules/lora
url = https://github.com/kohya-ss/sd-scripts
ignore = dirty
[submodule "extensions-builtin/sd-extension-system-info"]
path = extensions-builtin/sd-extension-system-info
url = https://github.com/vladmandic/sd-extension-system-info
Expand Down
5 changes: 3 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ extension-pkg-whitelist=
fail-on=
fail-under=10
ignore=CVS
ignore-paths=^repositories/.*$,
ignore-paths=/usr/lib/.*$,
^repositories/.*$,
^extensions/.*$,
^extensions-builtin/.*$,
/usr/lib/.*$,
^modules/dml/.*$,
^modules/models/diffusion/.*$,
^modules/xadapters/.*$,
ignore-patterns=
ignored-modules=
jobs=0
Expand Down
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"python.analysis.extraPaths": [
".",
"./modules",
"./modules/lora",
"./repositories/BLIP",
"./repositories/CodeFormer",
"./repositories/k-diffusion",
Expand Down
36 changes: 20 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ All individual features are not listed here, instead check [ChangeLog](CHANGELOG
- Enhanced *Lora*/*LoCon*/*Lyco* code supporting latest trends in training
- Built-in queue management
- Enterprise level logging and hardened API
- Modern localization and hints engine
- Broad compatibility with existing extensions ecosystem and new extensions manager
- Built in installer with automatic updates and dependency management
- Modernized UI with theme support and number of built-in themes *(dark and light)*

Expand All @@ -50,7 +48,7 @@ For screenshots and informations on other available themes, see [Themes Wiki](ht
**SD.Next** supports two main backends: *Diffusers* and *Original*:

- **Diffusers**: Based on new [Huggingface Diffusers](https://huggingface.co/docs/diffusers/index) implementation
Supports *original* SD models as well as *all* models listed below
Supports *all* models listed below
This backend is set as default for new installations
See [wiki article](https://github.com/vladmandic/automatic/wiki/Diffusers) for more information
- **Original**: Based on [LDM](https://github.com/Stability-AI/stablediffusion) reference implementation and significantly expanded on by [A1111](https://github.com/AUTOMATIC1111/stable-diffusion-webui)
Expand Down Expand Up @@ -101,6 +99,11 @@ Also supported are modifiers such as:
- **InstantID**, **FaceSwap**, **FaceID**, **PhotoMerge**
- **AnimateDiff** for SD 1.5

## Examples

*IP Adapters*:
![Screenshot-IPAdapter](html/screenshot-ipadapter.jpg)

*Color grading*:
![Screenshot-Color](html/screenshot-color.jpg)

Expand All @@ -111,7 +114,7 @@ Also supported are modifiers such as:
> [!IMPORTANT]
> - Loading any model other than standard SD 1.x / SD 2.x requires use of backend **Diffusers**
> - Loading any other models using **Original** backend is not supported
> - Loading manually download model `.safetensors` files is supported for SD 1.x / SD 2.x / SD-XL models only
> - Loading manually download model `.safetensors` files is supported for specified models only (typically SD 1.x / SD 2.x / SD-XL models only)
> - For all other model types, use backend **Diffusers** and use built in Model downloader or
select model from Networks -> Models -> Reference list in which case it will be auto-downloaded and loaded

Expand All @@ -136,7 +139,7 @@ Also supported are modifiers such as:
- If you can't run us locally, try our friends at [RunDuffusion!](https://rundiffusion.com?utm_source=github&utm_medium=referral&utm_campaign=SDNext)

> [!TIP]
> - Server can run without virtual environment,
> - Server can run with or without virtual environment,
Recommended to use `VENV` to avoid library version conflicts with other applications
> - **nVidia/CUDA** / **AMD/ROCm** / **Intel/OneAPI** are auto-detected if present and available,
For any other use case such as **DirectML**, **ONNX/Olive**, **OpenVINO** specify required parameter explicitly
Expand Down Expand Up @@ -164,7 +167,7 @@ Below is partial list of all available parameters, run `webui --help` for the fu
--listen Launch web server using public IP address, default: False
--auth AUTH Set access authentication like "user:pwd,user:pwd""
--autolaunch Open the UI URL in the system's default browser upon launch
--docs Mount Gradio docs at /docs, default: False
--docs Mount API docs, default: False
--no-hashing Disable hashing of checkpoints, default: False
--no-metadata Disable reading of metadata from models, default: False
--backend {original,diffusers} force model pipeline type
Expand Down Expand Up @@ -197,32 +200,33 @@ Below is partial list of all available parameters, run `webui --help` for the fu

SD.Next comes with several extensions pre-installed:

- [ControlNet](https://github.com/Mikubill/sd-webui-controlnet)
- [ControlNet](https://github.com/Mikubill/sd-webui-controlnet) (*active in backend: original only*)
- [Agent Scheduler](https://github.com/ArtVentureX/sd-webui-agent-scheduler)
- [Image Browser](https://github.com/AlUlkesh/stable-diffusion-webui-images-browser)

### **Collab**

- We'd love to have additional maintainers with full admin rights. If you're interested, ping us!
- In addition to general cross-platform code, desire is to have a lead for each of the main platforms.
This should be fully cross-platform, but we'd really love to have additional contributors and/or maintainers to join and help lead the efforts on different platforms.
- We'd love to have additional maintainers (with comes with full repo rights). If you're interested, ping us!
- In addition to general cross-platform code, desire is to have a lead for each of the main platforms
This should be fully cross-platform, but we'd really love to have additional contributors and/or maintainers to join and help lead the efforts on different platforms

### **Credits**

- Main credit goes to [Automatic1111 WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui)
- Additional credits are listed in [Credits](https://github.com/AUTOMATIC1111/stable-diffusion-webui/#credits)
- Licenses for modules are listed in [Licenses](html/licenses.html)
- Main credit goes to [Automatic1111 WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui) for original codebase
- Additional credits are listed in [Credits](https://github.com/AUTOMATIC1111/stable-diffusion-webui/#credits)
- Licenses for modules are listed in [Licenses](html/licenses.html)

### **Evolution**

<a href="https://star-history.com/#vladmandic/automatic&Date">
<picture>
<picture width=640>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=vladmandic/automatic&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=vladmandic/automatic&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=vladmandic/automatic&type=Date" />
<img src="https://api.star-history.com/svg?repos=vladmandic/automatic&type=Date" alt="starts" width="320">
</picture>
</a>

- [OSS Stats](https://ossinsight.io/analyze/vladmandic/automatic#overview)

### **Docs**

If you're unsure how to use a feature, best place to start is [Wiki](https://github.com/vladmandic/automatic/wiki) and if its not there,
Expand Down
14 changes: 9 additions & 5 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ Main ToDo list can be found at [GitHub projects](https://github.com/users/vladma

## Candidates for next release

- multi-ipadapter: <https://github.com/huggingface/diffusers/pull/6573>
- control second pass: <https://github.com/vladmandic/automatic/issues/2783>
- stable cascade
- init latents, variations, tiling
- lora sliders: <https://github.com/vladmandic/automatic/issues/2868>
- x-adapter: <https://github.com/showlab/X-Adapter>
- diffusers public callbacks
- image2video: pia and vgen pipelines
- video2video
- async lowvram: <https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/14855>

## Control missing features

- second pass: <https://github.com/vladmandic/automatic/issues/2783>
- control api
- masking api
- preprocess api
- remove kohya from submodules
- bind panZoom to control input
4 changes: 2 additions & 2 deletions cli/image-grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ def grid(images, labels = None, width = 0, height = 0, border = 0, square = Fals
h = round(height / rows)
size = tuple(size)
image = Image.new('RGB', size = size, color = 'black') # pylint: disable=redefined-outer-name
font = ImageFont.truetype('DejaVuSansMono', round(w / 20))
font = ImageFont.truetype('DejaVuSansMono', round(w / 40))
for i, img in enumerate(images): # pylint: disable=redefined-outer-name
x = (i % cols * w) + (i % cols * border)
y = (i // cols * h) + (i // cols * border)
img.thumbnail((w, h), Image.Resampling.HAMMING)
image.paste(img, box=(x, y))
image.paste(img, box=(x + int(border / 2), y + int(border / 2)))
if labels is not None and len(images) == len(labels):
ctx = ImageDraw.Draw(image)
label = wrap(labels[i], font, w)
Expand Down
4 changes: 2 additions & 2 deletions cli/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


class Result():
def __init__(self, typ: str, fn: str, tag: str = None, requested: list = []): # noqa: B006
def __init__(self, typ: str, fn: str, tag: str = None, requested: list = []):
self.type = typ
self.input = fn
self.output = ''
Expand Down Expand Up @@ -262,7 +262,7 @@ def save_image(res: Result, folder: str):
return res


def file(filename: str, folder: str, tag = None, requested = []): # noqa: B006
def file(filename: str, folder: str, tag = None, requested = []):
# initialize result dict
res = Result(fn = filename, typ='unknown', tag=tag, requested = requested)
# open image
Expand Down
5 changes: 3 additions & 2 deletions cli/run-benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ async def txt2img():
log.debug({ 'info': info })
if options['batch_size'] != len(data['images']):
log.error({ 'requested': options['batch_size'], 'received': len(data['images']) })
return 0
for i in range(len(data['images'])):
data['images'][i] = Image.open(io.BytesIO(base64.b64decode(data['images'][i].split(',',1)[0])))
if args.save:
Expand Down Expand Up @@ -97,7 +98,7 @@ async def main():
if i == 0:
log.info({ 'warmup': round(ts, 2) })
else:
peak = gpu['session']['peak'] if 'session' in gpu else 0
peak = gpu['system']['used'] # gpu['session']['peak'] if 'session' in gpu else 0
log.info({ 'batch': batch[i], 'its': round(options.steps / (ts / batch[i]), 2), 'img': round(ts / batch[i], 2), 'wall': round(ts, 2), 'peak': gb(peak), 'oom': oom > 0 })
else:
await asyncio.sleep(10)
Expand All @@ -113,7 +114,7 @@ async def main():
log.info({ 'run-benchmark' })
parser = argparse.ArgumentParser(description = 'run-benchmark')
parser.add_argument("--steps", type=int, default=50, required=False, help="steps")
parser.add_argument("--sampler", type=str, default='Euler a', required=False, help="max batch size")
parser.add_argument("--sampler", type=str, default='Euler a', required=False, help="Use specific sampler")
parser.add_argument("--prompt", type=str, default='photo of two dice on a table', required=False, help="prompt")
parser.add_argument("--negative", type=str, default='foggy, blurry', required=False, help="prompt")
parser.add_argument("--maxbatch", type=int, default=16, required=False, help="max batch size")
Expand Down
9 changes: 6 additions & 3 deletions cli/simple-img2img.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
log = logging.getLogger(__name__)
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

filename='/tmp/simple-img2img.jpg'
options = {
"save_images": False,
"send_images": True,
Expand Down Expand Up @@ -74,8 +73,11 @@ def generate(args): # pylint: disable=redefined-outer-name
b64 = data['images'][i].split(',',1)[0]
info = data['info']
image = Image.open(io.BytesIO(base64.b64decode(b64)))
image.save(filename)
log.info(f'received image: size={image.size} file={filename} time={t1-t0:.2f} info="{info}"')
log.info(f'received image: size={image.size} time={t1-t0:.2f} info="{info}"')
if args.output:
image.save(args.output)
log.info(f'image saved: size={image.size} filename={args.output}')

else:
log.warning(f'no images received: {data}')

Expand All @@ -89,6 +91,7 @@ def generate(args): # pylint: disable=redefined-outer-name
parser.add_argument('--steps', required=False, default=20, help='number of steps')
parser.add_argument('--seed', required=False, default=-1, help='initial seed')
parser.add_argument('--sampler', required=False, default='Euler a', help='sampler name')
parser.add_argument('--output', required=False, default=None, help='output image file')
parser.add_argument('--model', required=False, help='model name')
args = parser.parse_args()
log.info(f'img2img: {args}')
Expand Down
8 changes: 5 additions & 3 deletions cli/simple-txt2img.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
log = logging.getLogger(__name__)
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

filename='/tmp/simple-txt2img.jpg'
options = {
"save_images": False,
"send_images": True,
Expand Down Expand Up @@ -57,8 +56,10 @@ def generate(args): # pylint: disable=redefined-outer-name
b64 = data['images'][i].split(',',1)[0]
image = Image.open(io.BytesIO(base64.b64decode(b64)))
info = data['info']
image.save(filename)
log.info(f'received image: size={image.size} file={filename} time={t1-t0:.2f} info="{info}"')
log.info(f'image received: size={image.size} time={t1-t0:.2f} info="{info}"')
if args.output:
image.save(args.output)
log.info(f'image saved: size={image.size} filename={args.output}')
else:
log.warning(f'no images received: {data}')

Expand All @@ -72,6 +73,7 @@ def generate(args): # pylint: disable=redefined-outer-name
parser.add_argument('--steps', required=False, default=20, help='number of steps')
parser.add_argument('--seed', required=False, default=-1, help='initial seed')
parser.add_argument('--sampler', required=False, default='Euler a', help='sampler name')
parser.add_argument('--output', required=False, default=None, help='output image file')
parser.add_argument('--model', required=False, help='model name')
args = parser.parse_args()
log.info(f'txt2img: {args}')
Expand Down
9 changes: 4 additions & 5 deletions extensions-builtin/Lora/extra_networks_lora.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ def __init__(self):

def activate(self, p, params_list):
t0 = time.time()
additional = shared.opts.sd_lora
self.errors.clear()
if additional != "None" and additional in networks.available_networks and not any(x for x in params_list if x.items[0] == additional):
p.all_prompts = [x + f"<lora:{additional}:{shared.opts.extra_networks_default_multiplier}>" for x in p.all_prompts]
params_list.append(extra_networks.ExtraNetworkParams(items=[additional, shared.opts.extra_networks_default_multiplier]))
if len(params_list) > 0:
self.active = True
networks.originals.apply() # apply patches
Expand Down Expand Up @@ -71,7 +67,10 @@ def deactivate(self, p):
if 'CLIP' in shared.sd_model.text_encoder.__class__.__name__ and not (shared.compiled_model_state is not None and shared.compiled_model_state.is_compiled is True):
if shared.opts.lora_fuse_diffusers:
shared.sd_model.unfuse_lora()
shared.sd_model.unload_lora_weights()
try:
shared.sd_model.unload_lora_weights() # fails for non-CLIP models
except Exception:
pass
if not self.active and getattr(networks, "originals", None ) is not None:
networks.originals.undo() # remove patches
if networks.debug:
Expand Down
1 change: 0 additions & 1 deletion extensions-builtin/Lora/lora_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ def __init__(self):
if shared.backend == shared.Backend.ORIGINAL:
self.converter = self.original
self.is_sd2 = 'model_transformer_resblocks' in shared.sd_model.network_layer_mapping

else:
self.converter = self.diffusers
self.is_sdxl = True if shared.sd_model_type == "sdxl" else False
Expand Down
1 change: 0 additions & 1 deletion extensions-builtin/Lora/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from modules import sd_models, hashes, shared

NetworkWeights = namedtuple('NetworkWeights', ['network_key', 'sd_key', 'w', 'sd_module'])

metadata_tags_order = {"ss_sd_model_name": 1, "ss_resolution": 2, "ss_clip_skip": 3, "ss_num_train_images": 10, "ss_tag_frequency": 20}


Expand Down
1 change: 0 additions & 1 deletion extensions-builtin/Lora/network_lora.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import torch

import diffusers.models.lora as diffusers_lora
import lyco_helpers
import network
Expand Down
9 changes: 5 additions & 4 deletions extensions-builtin/Lora/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,12 +438,11 @@ def list_available_networks():
forbidden_network_aliases.clear()
available_network_hash_lookup.clear()
forbidden_network_aliases.update({"none": 1, "Addams": 1})
os.makedirs(shared.cmd_opts.lora_dir, exist_ok=True)
directories = []
if os.path.exists(shared.cmd_opts.lora_dir):
directories.append(shared.cmd_opts.lora_dir)
else:
shared.log.warning('LoRA directory not found: path="{shared.cmd_opts.lora_dir}"')
shared.log.warning(f'LoRA directory not found: path="{shared.cmd_opts.lora_dir}"')
if os.path.exists(shared.cmd_opts.lyco_dir) and shared.cmd_opts.lyco_dir != shared.cmd_opts.lora_dir:
directories.append(shared.cmd_opts.lyco_dir)

Expand All @@ -456,8 +455,10 @@ def add_network(filename):
available_networks[entry.name] = entry
if entry.alias in available_network_aliases:
forbidden_network_aliases[entry.alias.lower()] = 1
available_network_aliases[entry.name] = entry
available_network_aliases[entry.alias] = entry
if shared.opts.lora_preferred_name == 'filename':
available_network_aliases[entry.name] = entry
else:
available_network_aliases[entry.alias] = entry
if entry.shorthash:
available_network_hash_lookup[entry.shorthash] = entry
except OSError as e: # should catch FileNotFoundError and PermissionError etc.
Expand Down
1 change: 1 addition & 0 deletions html/locale_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{"id":"","label":"♻️","localized":"","hint":"Reuse previous seed"},
{"id":"","label":"🔄","localized":"","hint":"Reset values"},
{"id":"","label":"⬆️","localized":"","hint":"Upload image"},
{"id":"","label":"⬅️","localized":"","hint":"Reuse image"},
{"id":"","label":"⇅","localized":"","hint":"Swap values"},
{"id":"","label":"⇦","localized":"","hint":"Read parameters from last generated image"},
{"id":"","label":"⊗","localized":"","hint":"Clear prompt"},
Expand Down
Loading
Loading