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 #3503

Merged
merged 269 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
269 commits
Select commit Hold shift + click to select a range
cfa9f05
cleanup
vladmandic Sep 18, 2024
8bd944d
add move-te
vladmandic Sep 18, 2024
cfb201c
add vit-l and vit-g references
vladmandic Sep 18, 2024
6f7a446
add reference note
vladmandic Sep 18, 2024
3eb9e1d
add cogvideox image2video
vladmandic Sep 18, 2024
51e97b3
clear embeds cache on te change
vladmandic Sep 19, 2024
2be087b
embeds addiotional checks
vladmandic Sep 19, 2024
2698ede
flux controlnet img2img and inpaint
vladmandic Sep 19, 2024
f2bf7e8
fix setting t5 model
Fundaris Sep 19, 2024
271b493
Merge pull request #3447 from Fundaris/dev
vladmandic Sep 19, 2024
4acf3c0
persist control units state on restarts
vladmandic Sep 20, 2024
6f7fe5e
fix directml generator.
lshqqytiger Sep 20, 2024
bdbd24e
expermental t5 gguf support
vladmandic Sep 20, 2024
c20ba34
invalidate ui selection on load fail
vladmandic Sep 20, 2024
f028628
zluda downgrade torch on gcn cards
lshqqytiger Sep 21, 2024
f18e659
fix xyz global prompt
vladmandic Sep 21, 2024
419f342
add gradio_skip_video setting
vladmandic Sep 21, 2024
0b665fe
add reprocess image
vladmandic Sep 21, 2024
8457d45
fix alphavllm-lumina
vladmandic Sep 21, 2024
ae221f8
conditional token counter
vladmandic Sep 21, 2024
f059313
auto-set upcast if first decode fails, fix flux
vladmandic Sep 21, 2024
114df73
xyz grid multi-resolution
vladmandic Sep 21, 2024
a3b3553
optimize xyz grid
vladmandic Sep 21, 2024
6919ca3
lint updates
vladmandic Sep 21, 2024
5d70297
fix skip
vladmandic Sep 21, 2024
2ccf2a0
enable flux vae reprocess
vladmandic Sep 21, 2024
b9e230c
update logging
vladmandic Sep 22, 2024
74a70a8
lora unpatch when not needed
vladmandic Sep 22, 2024
fdb2ea8
always keep lora on gpu
vladmandic Sep 22, 2024
2d0ad9a
update vae upscale logic
vladmandic Sep 22, 2024
3ceb998
display lora tag in networks and do not filter
vladmandic Sep 22, 2024
f74187c
Bundled Embeddings quick fix
AI-Casanova Sep 22, 2024
ddefb38
cleanup lora detect
vladmandic Sep 22, 2024
92f2a29
improve profiling
vladmandic Sep 23, 2024
b8877d3
add free-u check
vladmandic Sep 23, 2024
31b66cf
IPEX fix FreeU
Disty0 Sep 23, 2024
4de0480
Upcast bf16 fftn to fp32
Disty0 Sep 23, 2024
718cfe4
zluda hijack fft
lshqqytiger Sep 24, 2024
e246e55
rocm install flash-attn if needed
lshqqytiger Sep 24, 2024
1395f5b
add triton backend flash-attn (experimental)
lshqqytiger Sep 24, 2024
4136983
add reprocess plus major processing refactor
vladmandic Sep 25, 2024
c00bcde
update changelog
vladmandic Sep 25, 2024
fb3b7fa
UI Tweak
ZeldaMaster501 Sep 25, 2024
3198a19
Merge pull request #3454 from ZeldaMaster501/dev
vladmandic Sep 25, 2024
e7e79c4
add lora_load_gpu setting
vladmandic Sep 25, 2024
938a858
fix vae upcast condition
vladmandic Sep 25, 2024
2c990b7
update changelog
vladmandic Sep 25, 2024
3d38f6e
update xyz grid
vladmandic Sep 25, 2024
82ce34c
zluda device id experiment
lshqqytiger Sep 26, 2024
6af1524
zluda device id #1
lshqqytiger Sep 26, 2024
bdcef26
zluda device id #2
lshqqytiger Sep 26, 2024
993a3d7
zluda device id #3
lshqqytiger Sep 26, 2024
220878c
zluda device id #4
lshqqytiger Sep 26, 2024
9ba7f4b
rocm fix none error
lshqqytiger Sep 26, 2024
96922d7
rocm&zluda handle apu
lshqqytiger Sep 26, 2024
7b3f4d4
rocm skip if flash-attn is installed
lshqqytiger Sep 26, 2024
bfd8e70
remove unnecessary line
lshqqytiger Sep 26, 2024
1fff99f
fix xyz grid seed labels broke after renaming options
Fundaris Sep 26, 2024
0391577
Merge pull request #3455 from Fundaris/dev
vladmandic Sep 26, 2024
b8055d1
fix xyz grid
vladmandic Sep 26, 2024
d9b594e
improve lora detection, logging and error handling
vladmandic Sep 26, 2024
b77bb9f
Add JasperAI Flux Controlnets
EnragedAntelope Sep 26, 2024
d125d69
Merge pull request #3457 from EnragedAntelope/patch-1
vladmandic Sep 26, 2024
bcb704a
update changelog
vladmandic Sep 26, 2024
314e333
Flux-LoRa first commit
AI-Casanova Sep 27, 2024
b74af75
add more known devices
lshqqytiger Sep 27, 2024
707c59a
some rewrites
lshqqytiger Sep 27, 2024
3d9f2c5
Bugfix: Unused token
Symbiomatrix Sep 27, 2024
470ea10
fix hipinfo
lshqqytiger Sep 27, 2024
157f581
fix filename seq
vladmandic Sep 27, 2024
1a37215
fix upcast
vladmandic Sep 27, 2024
27afd84
Merge pull request #3458 from Symbiomatrix/Token
vladmandic Sep 27, 2024
1993713
fix upcsast
vladmandic Sep 27, 2024
d51a695
update changelog
vladmandic Sep 27, 2024
c8c9c37
Flux-LoRa kohya key matching
AI-Casanova Sep 27, 2024
c6e4aee
fix vdm
vladmandic Sep 28, 2024
a8d31d0
Load works, unload infinite recursion
AI-Casanova Sep 28, 2024
6a49db4
Fix offload/backup
AI-Casanova Sep 29, 2024
2e3a3a3
add ctrl+x
vladmandic Sep 29, 2024
174add0
restore dtype after upcast complete
vladmandic Sep 29, 2024
be7f86f
Merge branch 'dev' into flux-lora
AI-Casanova Sep 29, 2024
fe94edf
set default cuda dtype to auto
vladmandic Sep 29, 2024
bd5ac8e
Add option, fix diffusers keys
AI-Casanova Sep 29, 2024
47755dc
refactor devices
vladmandic Sep 30, 2024
b31d02b
cleanup
vladmandic Sep 30, 2024
d0f9450
logging
vladmandic Sep 30, 2024
c21a10b
add bf16 override for directml
vladmandic Sep 30, 2024
d7264ed
upgrade torch for directml backend
lshqqytiger Sep 30, 2024
15e16e4
allow ctrlx with hires
vladmandic Sep 30, 2024
aa7f745
update changelog
vladmandic Sep 30, 2024
ddf56f0
update requirements
vladmandic Sep 30, 2024
492ee38
update requirements
vladmandic Sep 30, 2024
fce431b
Merge branch 'dev' into flux-lora
vladmandic Sep 30, 2024
e6ff17d
Merge pull request #3461 from AI-Casanova/flux-lora
vladmandic Sep 30, 2024
ac58b21
update flux lora code
vladmandic Sep 30, 2024
214b9a2
cleanup
vladmandic Sep 30, 2024
2a85f89
update changelog
vladmandic Sep 30, 2024
684263c
downgrade transformers
vladmandic Sep 30, 2024
046d588
add fix-te
vladmandic Oct 1, 2024
f9b5a83
cleanup
vladmandic Oct 1, 2024
9a46d38
cleanups
vladmandic Oct 2, 2024
bcc9ba1
handle torchao
vladmandic Oct 2, 2024
bd6e689
fix te meta
vladmandic Oct 2, 2024
aba3979
lock cogflorence revision
vladmandic Oct 2, 2024
e8e05b7
change clip load order
vladmandic Oct 2, 2024
176c5c5
sampler options rewrite
vladmandic Oct 3, 2024
3de3c44
update changelog
vladmandic Oct 3, 2024
8ee33cc
update modernui
vladmandic Oct 3, 2024
3b4120d
update changelog
vladmandic Oct 3, 2024
2a99654
cleanup
vladmandic Oct 3, 2024
2521e67
update vqa
vladmandic Oct 3, 2024
20d28ac
update modernui
vladmandic Oct 3, 2024
462e9f5
handle torchao
vladmandic Oct 4, 2024
b787d5f
support manually downloaded hf models
vladmandic Oct 4, 2024
1848847
add apg
vladmandic Oct 4, 2024
f60c2b4
add note
vladmandic Oct 4, 2024
ecfb1bb
add notes
vladmandic Oct 4, 2024
317db4b
add lint exceptions
vladmandic Oct 4, 2024
f62dddf
Add Cascade APG
Disty0 Oct 4, 2024
5f7bef8
apg add sd15
vladmandic Oct 4, 2024
18162e3
update changelog
vladmandic Oct 4, 2024
3cd584b
fix en height
vladmandic Oct 4, 2024
7e81f1f
lock down adetailer
vladmandic Oct 5, 2024
209c199
lock down extensions
vladmandic Oct 5, 2024
b210942
fix xyz apply
vladmandic Oct 6, 2024
c13b8d2
installer fixes
vladmandic Oct 6, 2024
04a5071
face-hires -> detailer refactor
vladmandic Oct 6, 2024
3bbcc33
add detailer
vladmandic Oct 7, 2024
255255d
update changelog
vladmandic Oct 7, 2024
e1a5228
update modernui for detailer
vladmandic Oct 7, 2024
d1582aa
update changelog
vladmandic Oct 7, 2024
e0d702a
add gfx autodetect options
vladmandic Oct 7, 2024
072a837
save detailer settings
vladmandic Oct 7, 2024
a3a1772
history prototype
vladmandic Oct 7, 2024
2e08a26
add latent history
vladmandic Oct 8, 2024
0ced5d4
update hsa message
vladmandic Oct 8, 2024
7d7a6bf
fix controlnet
vladmandic Oct 8, 2024
57ebdf0
fix control size metadata
vladmandic Oct 8, 2024
ab32b8a
update modernui
vladmandic Oct 8, 2024
a722ed3
fix face restore dependend extensions
vladmandic Oct 8, 2024
d9e0af0
fix xyz grid restore
vladmandic Oct 8, 2024
f5ad8e5
cleanup
vladmandic Oct 8, 2024
f17fbe0
fix corner-case model load on startup
vladmandic Oct 9, 2024
723ce74
add linfusion
vladmandic Oct 9, 2024
8f8f0d6
update
vladmandic Oct 9, 2024
bc47e49
fix reprocess from history
vladmandic Oct 9, 2024
69d3a95
fix adetailer
vladmandic Oct 10, 2024
d075edb
update
vladmandic Oct 10, 2024
0d02a2e
fix codeformer
vladmandic Oct 11, 2024
c2ff8a5
add flux unet gguf support
vladmandic Oct 11, 2024
f5253da
update gguf notes and lint
vladmandic Oct 11, 2024
e2d5cd5
Flux Lycoris Keymapping
AI-Casanova Oct 12, 2024
ea0dfeb
better handle any quant lib requirements
vladmandic Oct 12, 2024
2e2cb43
Make SDPA hijacks chainable and add Sage Attention
Disty0 Oct 12, 2024
3e6f785
cleanup config
vladmandic Oct 12, 2024
c89d94e
patch gradio iframeresizer
vladmandic Oct 12, 2024
73bd081
interruptible upscale ops
vladmandic Oct 12, 2024
0c54c23
add sageattention
vladmandic Oct 12, 2024
84f8ab4
Fix IPEX
Disty0 Oct 13, 2024
011d9c3
Move device backed initialization to shared.py
Disty0 Oct 13, 2024
9c05124
Add devices.has_xpu()
Disty0 Oct 13, 2024
9de22eb
ensure lora is not first to use quans
vladmandic Oct 13, 2024
8d0609c
fix gguf install order
vladmandic Oct 13, 2024
e55b687
Lora check "optimum.quanto" intead of "quanto"
Disty0 Oct 13, 2024
aeddd6c
cleanup
vladmandic Oct 13, 2024
a2c5893
fix xyz apply unet
vladmandic Oct 13, 2024
c2ab0b1
check te device
vladmandic Oct 14, 2024
31510cf
fix xyz apply prompt
vladmandic Oct 14, 2024
b14e8f9
Don't assume Cuda on devices.same_device()
Disty0 Oct 14, 2024
cdcca50
add model analyzer
vladmandic Oct 14, 2024
e80e8c8
granular model move
vladmandic Oct 14, 2024
6bb688c
add set_accelerate
vladmandic Oct 14, 2024
8047090
cast solver order
vladmandic Oct 14, 2024
bbedeaf
Set has_accelerate with get_signature_keys
Disty0 Oct 14, 2024
62d7431
Use _internal_dict.keys instead of _get_signature_keys
Disty0 Oct 14, 2024
be7449c
fix loading of some non-primary models
vladmandic Oct 15, 2024
da0510b
add support for cogview 3plus
vladmandic Oct 15, 2024
d15f666
add support for torch expandable segments
vladmandic Oct 15, 2024
0a32d80
add models table
vladmandic Oct 15, 2024
66744f5
update changelog
vladmandic Oct 15, 2024
18c0ab7
update wiki
vladmandic Oct 15, 2024
e746871
flux extra controlnets and differential diffusion
vladmandic Oct 16, 2024
ec7544e
update changelog and readme
vladmandic Oct 16, 2024
db3e03c
add meissonic (unstable)
vladmandic Oct 16, 2024
7a5e623
Fix UnboundLocalError on pipeline loading
Fundaris Oct 16, 2024
dba69ac
refactor load-model
vladmandic Oct 16, 2024
1427a4f
add conditional
vladmandic Oct 16, 2024
899c896
cleanup
Disty0 Oct 16, 2024
9c7eba1
Merge pull request #3490 from Fundaris/dev
vladmandic Oct 16, 2024
6705e60
fix unapply lora
vladmandic Oct 17, 2024
cbc52fe
update changelog and cleanup lora
vladmandic Oct 17, 2024
01953b9
add lora ui callback
vladmandic Oct 17, 2024
959e8ac
add cli load state dict example
vladmandic Oct 17, 2024
6c11002
PyTorch 2.5 XPU support
Disty0 Oct 17, 2024
1a7b88a
Update the default ROCm version
Disty0 Oct 17, 2024
065155f
IPEX fixes
Disty0 Oct 17, 2024
6ae82cb
Cascade fix default scheduler
Disty0 Oct 17, 2024
51f184d
update changelog
vladmandic Oct 18, 2024
a5e92e2
Update webui.py
brknsoul Oct 18, 2024
918174e
Update shared.py
brknsoul Oct 18, 2024
b6d50a9
brackets
brknsoul Oct 18, 2024
702846c
Intel fix Triton
Disty0 Oct 18, 2024
f7ebc81
Merge pull request #3493 from brknsoul/dev
vladmandic Oct 18, 2024
1d51ae3
Intel fix torch.compile
Disty0 Oct 18, 2024
ae4591a
reimplement torchao quantization
vladmandic Oct 18, 2024
7f23fd3
disable cudnn on torch 2.5.0 with sdp
vladmandic Oct 18, 2024
688ab23
Lock ROCm to PytTorch 2.4.1
Disty0 Oct 18, 2024
62ff472
lock torch on cuda
vladmandic Oct 18, 2024
52046ca
update
vladmandic Oct 19, 2024
9e024a1
add one more parse prompts
vladmandic Oct 19, 2024
2744269
WIP Lora Extract
AI-Casanova Oct 19, 2024
13a2e6c
update torch requirements
vladmandic Oct 19, 2024
3ed48ec
Merge branch 'dev' into lora-extract
AI-Casanova Oct 20, 2024
6a9b7bc
finish Lora Extract
AI-Casanova Oct 20, 2024
cc28c5c
Merge pull request #3495 from AI-Casanova/lora-extract
vladmandic Oct 20, 2024
2570d87
typing, linting
vladmandic Oct 20, 2024
64f3632
messages,stats,save
vladmandic Oct 20, 2024
a518592
metadata
vladmandic Oct 20, 2024
229cf67
locking,progressbar
vladmandic Oct 20, 2024
a13f1ee
cleanup
vladmandic Oct 20, 2024
ad98f91
Merge pull request #3496 from vladmandic/lora-extract
vladmandic Oct 20, 2024
2c1658d
changelog for extract lora
vladmandic Oct 20, 2024
f656fbe
cleanup
vladmandic Oct 20, 2024
ec1a57f
Fix LoRA unload logic
AI-Casanova Oct 20, 2024
8e579ad
update changelog
vladmandic Oct 20, 2024
494db8e
Grammar
a4hryou Oct 21, 2024
77f7ce6
Merge pull request #3497 from a4hryou/patch-1
vladmandic Oct 21, 2024
56ec09f
add detailer multi-class support
vladmandic Oct 21, 2024
09a4320
specify cuXXX and cpu
Yoinky3000 Oct 21, 2024
26ae378
only change cuda and openvino torch command
Yoinky3000 Oct 21, 2024
cc4f481
Merge pull request #3499 from Yoinky3000/dev
vladmandic Oct 21, 2024
cf9fe20
omnigen!
vladmandic Oct 22, 2024
b37c611
fix sd3 loader
vladmandic Oct 22, 2024
7d7b2fc
add sd3.5
vladmandic Oct 22, 2024
8eca1b1
update diffusers
vladmandic Oct 22, 2024
c2e4810
update wiki
vladmandic Oct 22, 2024
63bedde
update readme
vladmandic Oct 22, 2024
f191134
support bnb quantization during load
vladmandic Oct 22, 2024
b28b840
update changelog
vladmandic Oct 22, 2024
1b329a6
cleanup
vladmandic Oct 22, 2024
e09423b
update settings
vladmandic Oct 22, 2024
4e4079e
update changelog
vladmandic Oct 22, 2024
142fddf
cleanup
vladmandic Oct 23, 2024
10dbb59
update change
vladmandic Oct 23, 2024
a95a394
fix styles migration
vladmandic Oct 23, 2024
bf6f130
update omnigen
vladmandic Oct 23, 2024
0587f0b
gc logging
vladmandic Oct 23, 2024
5efcae1
update changelog
vladmandic Oct 23, 2024
3cc78bd
Merge branch 'master' into dev
vladmandic Oct 23, 2024
6d4f2df
linting
vladmandic Oct 23, 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
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"venv",
"panzoom.js",
"split.js",
"exifr.js"
"exifr.js",
"iframeResizer.min.js"
]
}
12 changes: 10 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ fail-on=
fail-under=10
ignore=CVS
ignore-paths=/usr/lib/.*$,
modules/apg,
modules/control/proc,
modules/control/units,
modules/ctrlx,
modules/dcsolver,
modules/dml,
modules/ggml,
modules/hidiffusion,
modules/hijack,
modules/intel/ipex,
Expand All @@ -18,14 +22,16 @@ ignore-paths=/usr/lib/.*$,
modules/ldsr,
modules/onnx_impl,
modules/pag,
modules/prompt_parser_xhinker.py,
modules/rife,
modules/taesd,
modules/todo,
modules/unipc,
modules/vdm,
modules/xadapter,
modules/dcsolver,
modules/meissonic,
modules/omnigen,
repositories,
modules/prompt_parser_xhinker.py,
extensions-builtin/sd-webui-agent-scheduler,
extensions-builtin/sd-extension-chainner/nodes,
extensions-builtin/sdnext-modernui/node_modules,
Expand Down Expand Up @@ -163,12 +169,14 @@ disable=bad-inline-option,
too-many-locals,
too-many-nested-blocks,
too-many-statements,
too-many-positional-arguments,
unidiomatic-typecheck,
unnecessary-dict-index-lookup,
unnecessary-dunder-call,
unnecessary-lambda,
use-dict-literal,
use-symbolic-message-instead,
unknown-option-value,
useless-suppression,
wrong-import-position,
enable=c-extension-no-member
Expand Down
22 changes: 14 additions & 8 deletions .ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,29 @@ exclude = [
".git",
".ruff_cache",
".vscode",
"modules/apg",
"modules/control/proc",
"modules/control/units",
"modules/dcsolver",
"modules/ggml",
"modules/hidiffusion",
"modules/hijack",
"modules/intel/ipex",
"modules/intel/openvino",
"modules/k-diffusion",
"modules/ldsr",
"modules/pag",
"modules/postprocess/aurasr_arch.py",
"modules/prompt_parser_xhinker.py",
"modules/rife",
"modules/segmoe",
"modules/taesd",
"modules/todo",
"modules/unipc",
"modules/vdm",
"modules/xadapter",
"modules/dcsolver",
"modules/intel/openvino",
"modules/intel/ipex",
"modules/segmoe",
"modules/control/proc",
"modules/control/units",
"modules/prompt_parser_xhinker.py",
"modules/postprocess/aurasr_arch.py",
"modules/meissonic",
"modules/omnigen",
"repositories",
"extensions-builtin/sd-extension-chainner/nodes",
"extensions-builtin/sd-webui-agent-scheduler",
Expand Down Expand Up @@ -65,6 +70,7 @@ ignore = [
"E731", # Do not assign a `lambda` expression, use a `def`
"E741", # Ambiguous variable name
"F401", # Imported by unused
"NPY002", # replace legacy random
"RUF005", # Consider iterable unpacking
"RUF010", # Use explicit conversion flag
"RUF012", # Mutable class attributes
Expand Down
313 changes: 313 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ All individual features are not listed here, instead check [ChangeLog](CHANGELOG
- Multiple UIs!
▹ **Standard | Modern**
- Multiple diffusion models!
▹ **Stable Diffusion 1.5/2.1/XL/3.0 | LCM | Lightning | Segmind | Kandinsky | Pixart-α | Pixart-Σ | Stable Cascade | FLUX.1 | AuraFlow | Würstchen | Lumina | Kolors | aMUSEd | DeepFloyd IF | UniDiffusion | SD-Distilled | BLiP Diffusion | KOALA | SDXS | Hyper-SD | HunyuanDiT | etc.**
▹ **Stable Diffusion 1.5/2.1/XL/3.0/3.5 | LCM | Lightning | Segmind | Kandinsky | Pixart-α | Pixart-Σ | Stable Cascade | FLUX.1 | AuraFlow | Würstchen | Alpha Lumina | Kwai Kolors | aMUSEd | DeepFloyd IF | UniDiffusion | SD-Distilled | BLiP Diffusion | KOALA | SDXS | Hyper-SD | HunyuanDiT | CogView | OmniGen | Meissonic | etc.**
- Built-in Control for Text, Image, Batch and video processing!
▹ **ControlNet | ControlNet XS | Control LLLite | T2I Adapters | IP Adapters**
- Multiplatform!
Expand Down Expand Up @@ -68,27 +68,31 @@ Additional models will be added as they become available and there is public int
- [RunwayML Stable Diffusion](https://github.com/Stability-AI/stablediffusion/) 1.x and 2.x *(all variants)*
- [StabilityAI Stable Diffusion XL](https://github.com/Stability-AI/generative-models)
- [StabilityAI Stable Diffusion 3 Medium](https://stability.ai/news/stable-diffusion-3-medium)
- [Stable Diffusion 3.5 Large](https://huggingface.co/stabilityai/stable-diffusion-3.5-large)
- [StabilityAI Stable Video Diffusion](https://huggingface.co/stabilityai/stable-video-diffusion-img2vid) Base, XT 1.0, XT 1.1
- [LCM: Latent Consistency Models](https://github.com/openai/consistency_models)
- [StabilityAI Stable Cascade](https://github.com/Stability-AI/StableCascade) *Full* and *Lite*
- [Black Forest Labs FLUX.1](https://blackforestlabs.ai/announcing-black-forest-labs/) Dev, Schnell
- [AuraFlow](https://huggingface.co/fal/AuraFlow)
- [AlphaVLLM Lumina-Next-SFT](https://huggingface.co/Alpha-VLLM/Lumina-Next-SFT-diffusers)
- [Playground AI](https://huggingface.co/playgroundai/playground-v2-256px-base) *v1, v2 256, v2 512, v2 1024 and latest v2.5*
- [Tencent HunyuanDiT](https://github.com/Tencent/HunyuanDiT)
- [OmniGen](https://arxiv.org/pdf/2409.11340)
- [Meissonic](https://github.com/viiika/Meissonic)
- [Kwai Kolors](https://huggingface.co/Kwai-Kolors/Kolors)
- [Playground](https://huggingface.co/playgroundai/playground-v2-256px-base) *v1, v2 256, v2 512, v2 1024 and latest v2.5*
- [Stable Cascade](https://github.com/Stability-AI/StableCascade) *Full* and *Lite*
- [aMUSEd 256](https://huggingface.co/amused/amused-256) 256 and 512
- [CogView 3+](https://huggingface.co/THUDM/CogView3-Plus-3B)
- [LCM: Latent Consistency Models](https://github.com/openai/consistency_models)
- [aMUSEd](https://huggingface.co/amused/amused-256) 256 and 512
- [Segmind Vega](https://huggingface.co/segmind/Segmind-Vega)
- [Segmind SSD-1B](https://huggingface.co/segmind/SSD-1B)
- [Segmind SegMoE](https://github.com/segmind/segmoe) *SD and SD-XL*
- [Segmind SD Distilled](https://huggingface.co/blog/sd_distillation) *(all variants)*
- [Kandinsky](https://github.com/ai-forever/Kandinsky-2) *2.1 and 2.2 and latest 3.0*
- [PixArt-α XL 2](https://github.com/PixArt-alpha/PixArt-alpha) *Medium and Large*
- [PixArt-Σ](https://github.com/PixArt-alpha/PixArt-sigma)
- [Warp Wuerstchen](https://huggingface.co/blog/wuertschen)
- [Tencent HunyuanDiT](https://github.com/Tencent/HunyuanDiT)
- [Tsinghua UniDiffusion](https://github.com/thu-ml/unidiffuser)
- [DeepFloyd IF](https://github.com/deep-floyd/IF) *Medium and Large*
- [ModelScope T2V](https://huggingface.co/damo-vilab/text-to-video-ms-1.7b)
- [Segmind SD Distilled](https://huggingface.co/blog/sd_distillation) *(all variants)*
- [BLIP-Diffusion](https://dxli94.github.io/BLIP-Diffusion-website/)
- [KOALA 700M](https://github.com/youngwanLEE/sdxl-koala)
- [VGen](https://huggingface.co/ali-vilab/i2vgen-xl)
Expand Down
4 changes: 2 additions & 2 deletions cli/api-txt2img.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def generate(args): # pylint: disable=redefined-outer-name
options['width'] = int(args.width)
options['height'] = int(args.height)
if args.faces:
options['restore_faces'] = args.faces
options['detailer'] = args.detailer
options['denoising_strength'] = 0.5
options['hr_sampler_name'] = args.sampler
data = post('/sdapi/v1/txt2img', options)
Expand All @@ -75,7 +75,7 @@ def generate(args): # pylint: disable=redefined-outer-name
parser.add_argument('--height', required=False, default=512, help='image height')
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('--faces', action='store_true', help='restore faces')
parser.add_argument('--detailer', action='store_true', help='run detailer')
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')
Expand Down
2 changes: 1 addition & 1 deletion cli/create-previews.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
# generate params
'generate': {
'restore_faces': True,
'detailer': True,
'prompt': '',
'negative_prompt': 'foggy, blurry, blurred, duplicate, ugly, mutilated, mutation, mutated, out of frame, bad anatomy, disfigured, deformed, censored, low res, low resolution, watermark, text, poorly drawn face, poorly drawn hands, signature',
'steps': 20,
Expand Down
2 changes: 1 addition & 1 deletion cli/generate.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"generate":
{
"restore_faces": true,
"detailer": true,
"prompt": "dynamic",
"negative_prompt": "foggy, blurry, blurred, duplicate, ugly, mutilated, mutation, mutated, out of frame, bad anatomy, disfigured, deformed, censored, low res, watermark, text, poorly drawn face, signature",
"steps": 30,
Expand Down
6 changes: 3 additions & 3 deletions cli/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def args(): # parse cmd arguments
parser.add_argument('--style', type = str, default = 'random', required = False, help = 'image style, used to guide dynamic prompt when prompt is not provided')
parser.add_argument('--suffix', type = str, default = 'random', required = False, help = 'style suffix, used to guide dynamic prompt when prompt is not provided')
parser.add_argument('--place', type = str, default = 'random', required = False, help = 'place locator, used to guide dynamic prompt when prompt is not provided')
parser.add_argument('--faces', default = False, action='store_true', help = 'restore faces during upscaling')
parser.add_argument('--detailer', default = False, action='store_true', help = 'run detailer')
parser.add_argument('--steps', type = int, default = 0, required = False, help = 'number of steps')
parser.add_argument('--batch', type = int, default = 0, required = False, help = 'batch size, limited by gpu vram')
parser.add_argument('--n', type = int, default = 0, required = False, help = 'number of iterations')
Expand Down Expand Up @@ -299,7 +299,7 @@ def args(): # parse cmd arguments
_dynamic = prompt(params)

sd.paths.root = params.path if params.path != '' else sd.paths.root
sd.generate.restore_faces = params.faces if params.faces is not None else sd.generate.restore_faces
sd.generate.detailer = params.detailer if params.detailer is not None else sd.generate.detailer
sd.generate.seed = params.seed if params.seed > 0 else sd.generate.seed
sd.generate.sampler_name = params.sampler if params.sampler != 'random' else sd.generate.sampler_name
sd.generate.batch_size = params.batch if params.batch > 0 else sd.generate.batch_size
Expand All @@ -309,7 +309,7 @@ def args(): # parse cmd arguments
sd.generate.height = params.height if params.height > 0 else sd.generate.height
sd.generate.steps = params.steps if params.steps > 0 else sd.generate.steps
sd.upscale.upscaling_resize = params.upscale if params.upscale > 0 else sd.upscale.upscaling_resize
sd.upscale.codeformer_visibility = 1 if params.faces else sd.upscale.codeformer_visibility
sd.upscale.codeformer_visibility = 1 if params.detailer else sd.upscale.codeformer_visibility
sd.options.sd_vae = params.vae if params.vae != '' else sd.options.sd_vae
sd.options.sd_model_checkpoint = params.model if params.model != '' else sd.options.sd_model_checkpoint
sd.upscale.upscaler_1 = 'SwinIR_4x' if params.upscale > 1 else sd.upscale.upscaler_1
Expand Down
2 changes: 2 additions & 0 deletions cli/image-exif.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,5 @@ def read_exif(filename: str):
for root, _dirs, files in os.walk(fn):
for file in files:
read_exif(os.path.join(root, file))
else:
print('file not found: ', fn)
89 changes: 89 additions & 0 deletions cli/load_unet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import torch
import diffusers


class StateDictStats():
cls: str = None
device: torch.device = None
params: int = 0
weights: dict = {}
dtypes: dict = {}
config: dict = None

def __repr__(self):
return f'cls={self.cls} params={self.params} weights={self.weights} device={self.device} dtypes={self.dtypes} config={self.config is not None}'


def set_module_tensor(
module: torch.nn.Module,
name: str,
value: torch.Tensor,
stats: StateDictStats,
device: torch.device = None,
dtype: torch.dtype = None,
):
if "." in name:
splits = name.split(".")
for split in splits[:-1]:
module = getattr(module, split)
name = splits[-1]
old_value = getattr(module, name)
with torch.no_grad():
if value.dtype not in stats.dtypes:
stats.dtypes[value.dtype] = 0
stats.dtypes[value.dtype] += 1
if name in module._buffers: # pylint: disable=protected-access
module._buffers[name] = value.to(device=device, dtype=dtype, non_blocking=True) # pylint: disable=protected-access
if 'buffers' not in stats.weights:
stats.weights['buffers'] = 0
stats.weights['buffers'] += 1
elif value is not None:
param_cls = type(module._parameters[name]) # pylint: disable=protected-access
module._parameters[name] = param_cls(value, requires_grad=old_value.requires_grad).to(device, dtype=dtype, non_blocking=True) # pylint: disable=protected-access
if 'parameters' not in stats.weights:
stats.weights['parameters'] = 0
stats.weights['parameters'] += 1


def load_unet(config_file: str, state_dict: dict, device: torch.device = None, dtype: torch.dtype = None):
# same can be done for other modules or even for entire model by loading model config and then walking through its modules
from accelerate import init_empty_weights
with init_empty_weights():
stats = StateDictStats()
stats.device = device
stats.config = diffusers.UNet2DConditionModel.load_config(config_file)
unet = diffusers.UNet2DConditionModel.from_config(stats.config)
stats.cls = unet.__class__.__name__
expected_state_dict_keys = list(unet.state_dict().keys())
stats.weights['expected'] = len(expected_state_dict_keys)
for param_name, param in state_dict.items():
if param_name not in expected_state_dict_keys:
if 'unknown' not in stats.weights:
stats.weights['unknown'] = 0
stats.weights['unknown'] += 1
continue
set_module_tensor(unet, name=param_name, value=param, device=device, dtype=dtype, stats=stats)
state_dict[param_name] = None # unload as we initialize the model so we dont consume double the memory
stats.params = sum(p.numel() for p in unet.parameters(recurse=True))
return unet, stats


def load_safetensors(fn: str):
import safetensors.torch
state_dict = safetensors.torch.load_file(fn, device='cpu') # state dict should always be loaded to cpu
return state_dict


if __name__ == "__main__":
# need pipe already present to load unet state_dict into or we could load unet first and then manually create pipe with params
pipe = diffusers.StableDiffusionXLPipeline.from_single_file('/mnt/models/stable-diffusion/sdxl/TempestV0.1-Artistic.safetensors', cache_dir='/mnt/models/huggingface')
# this could be kept in memory so we dont have to reload it
dct = load_safetensors('/mnt/models/UNET/dpo-sdxl-text2image.safetensors')
pipe.unet, s = load_unet(
config_file = 'configs/sdxl/unet/config.json', # can also point to online hf model with subfolder
state_dict = dct,
device = torch.device('cpu'), # can leave out to use default device
dtype = torch.bfloat16, # can leave out to use default dtype, especially for mixed precision modules
)
from rich import print as rprint
rprint(f'Stats: {s}')
35 changes: 20 additions & 15 deletions cli/model-metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,27 @@

def read_metadata(fn):
res = {}
if not fn.lower().endswith(".safetensors"):
return
with open(fn, mode="rb") as f:
metadata_len = f.read(8)
metadata_len = int.from_bytes(metadata_len, "little")
json_start = f.read(2)
if metadata_len <= 2 or json_start not in (b'{"', b"{'"):
print(f"Not a valid safetensors file: {fn}")
json_data = json_start + f.read(metadata_len-2)
json_obj = json.loads(json_data)
for k, v in json_obj.get("__metadata__", {}).items():
res[k] = v
if isinstance(v, str) and v[0:1] == '{':
try:
res[k] = json.loads(v)
except Exception:
pass
print(f"{fn}: {json.dumps(res, indent=4)}")
try:
metadata_len = f.read(8)
metadata_len = int.from_bytes(metadata_len, "little")
json_start = f.read(2)
if metadata_len <= 2 or json_start not in (b'{"', b"{'"):
print(f"Not a valid safetensors file: {fn}")
json_data = json_start + f.read(metadata_len-2)
json_obj = json.loads(json_data)
for k, v in json_obj.get("__metadata__", {}).items():
res[k] = v
if isinstance(v, str) and v[0:1] == '{':
try:
res[k] = json.loads(v)
except Exception:
pass
print(f"{fn}: {json.dumps(res, indent=4)}")
except Exception:
print(f"{fn}: cannot read metadata")


def main():
Expand Down
Loading