Skip to content

Commit ddcf9a3

Browse files
authored
Merge branch 'v2.3' into lstein/enhance/autoconvert-vaes
2 parents 23d9361 + 53f5dfb commit ddcf9a3

34 files changed

+569
-330
lines changed

.github/CODEOWNERS

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# continuous integration
2-
/.github/workflows/ @mauwii @lstein @blessedcoolant
2+
/.github/workflows/ @lstein @blessedcoolant
33

44
# documentation
5-
/docs/ @lstein @mauwii @blessedcoolant
6-
mkdocs.yml @mauwii @lstein
5+
/docs/ @lstein @blessedcoolant
6+
mkdocs.yml @lstein @ebr
77

88
# installation and configuration
9-
/pyproject.toml @mauwii @lstein @ebr
10-
/docker/ @mauwii
9+
/pyproject.toml @lstein @ebr
10+
/docker/ @lstein
1111
/scripts/ @ebr @lstein @blessedcoolant
1212
/installer/ @ebr @lstein
1313
ldm/invoke/config @lstein @ebr
@@ -21,13 +21,13 @@ invokeai/configs @lstein @ebr @blessedcoolant
2121

2222
# generation and model management
2323
/ldm/*.py @lstein @blessedcoolant
24-
/ldm/generate.py @lstein @keturn
24+
/ldm/generate.py @lstein @gregghelt2
2525
/ldm/invoke/args.py @lstein @blessedcoolant
2626
/ldm/invoke/ckpt* @lstein @blessedcoolant
2727
/ldm/invoke/ckpt_generator @lstein @blessedcoolant
2828
/ldm/invoke/CLI.py @lstein @blessedcoolant
29-
/ldm/invoke/config @lstein @ebr @mauwii @blessedcoolant
30-
/ldm/invoke/generator @keturn @damian0815
29+
/ldm/invoke/config @lstein @ebr @blessedcoolant
30+
/ldm/invoke/generator @gregghelt2 @damian0815
3131
/ldm/invoke/globals.py @lstein @blessedcoolant
3232
/ldm/invoke/merge_diffusers.py @lstein @blessedcoolant
3333
/ldm/invoke/model_manager.py @lstein @blessedcoolant
@@ -36,17 +36,17 @@ invokeai/configs @lstein @ebr @blessedcoolant
3636
/ldm/invoke/restoration @lstein @blessedcoolant
3737

3838
# attention, textual inversion, model configuration
39-
/ldm/models @damian0815 @keturn @blessedcoolant
39+
/ldm/models @damian0815 @gregghelt2 @blessedcoolant
4040
/ldm/modules/textual_inversion_manager.py @lstein @blessedcoolant
41-
/ldm/modules/attention.py @damian0815 @keturn
42-
/ldm/modules/diffusionmodules @damian0815 @keturn
43-
/ldm/modules/distributions @damian0815 @keturn
44-
/ldm/modules/ema.py @damian0815 @keturn
41+
/ldm/modules/attention.py @damian0815 @gregghelt2
42+
/ldm/modules/diffusionmodules @damian0815 @gregghelt2
43+
/ldm/modules/distributions @damian0815 @gregghelt2
44+
/ldm/modules/ema.py @damian0815 @gregghelt2
4545
/ldm/modules/embedding_manager.py @lstein
46-
/ldm/modules/encoders @damian0815 @keturn
47-
/ldm/modules/image_degradation @damian0815 @keturn
48-
/ldm/modules/losses @damian0815 @keturn
49-
/ldm/modules/x_transformer.py @damian0815 @keturn
46+
/ldm/modules/encoders @damian0815 @gregghelt2
47+
/ldm/modules/image_degradation @damian0815 @gregghelt2
48+
/ldm/modules/losses @damian0815 @gregghelt2
49+
/ldm/modules/x_transformer.py @damian0815 @gregghelt2
5050

5151
# Nodes
5252
apps/ @Kyle0654 @jpphoto

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,5 +233,3 @@ installer/install.sh
233233
installer/update.bat
234234
installer/update.sh
235235

236-
# no longer stored in source directory
237-
models

docs/features/LORAS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ Windows systems). If the `loras` folder does not already exist, just
4141
create it. The vast majority of LoRA models use the Kohya file format,
4242
which is a type of `.safetensors` file.
4343

44+
!!! warning "LoRA Naming Restrictions"
45+
46+
InvokeAI will only recognize LoRA files that contain the
47+
characters a-z, A-Z, 0-9 and the underscore character
48+
_. Other characters, including the hyphen, will cause the
49+
LoRA file not to load. These naming restrictions may be
50+
relaxed in the future, but for now you will need to rename
51+
files that contain hyphens, commas, brackets, and other
52+
non-word characters.
53+
4454
You may change where InvokeAI looks for the `loras` folder by passing the
4555
`--lora_directory` option to the `invoke.sh`/`invoke.bat` launcher, or
4656
by placing the option in `invokeai.init`. For example:

docs/features/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ title: Overview
3333
Restore mangled faces and make images larger with upscaling. Also see
3434
the [Embiggen Upscaling Guide](EMBIGGEN.md).
3535

36+
- The [Using LoRA Models](LORAS.md)
37+
38+
Add custom subjects and styles using HuggingFace's repository of
39+
embeddings.
40+
3641
- The [Concepts Library](CONCEPTS.md)
3742

3843
Add custom subjects and styles using HuggingFace's repository of

docs/installation/deprecated_documentation/INSTALL_LINUX.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ title: Manual Installation, Linux
7979
and obtaining an access token for downloading. It will then download and
8080
install the weights files for you.
8181

82-
Please look [here](../INSTALL_MANUAL.md) for a manual process for doing
82+
Please look [here](../020_INSTALL_MANUAL.md) for a manual process for doing
8383
the same thing.
8484

8585
7. Start generating images!

docs/installation/deprecated_documentation/INSTALL_WINDOWS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Note that you will need NVIDIA drivers, Python 3.10, and Git installed beforehan
7575
obtaining an access token for downloading. It will then download and install the
7676
weights files for you.
7777
78-
Please look [here](../INSTALL_MANUAL.md) for a manual process for doing the
78+
Please look [here](../020_INSTALL_MANUAL.md) for a manual process for doing the
7979
same thing.
8080
8181
8. Start generating images!

docs/requirements-mkdocs.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
mkdocs
2+
mkdocs-material>=8, <9
3+
mkdocs-git-revision-date-localized-plugin
4+
mkdocs-redirects==1.2.0
5+

installer/lib/installer.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,15 @@ def install_torch(self, extra_index_url=None, find_links=None):
243243

244244
# Note that we're installing pinned versions of torch and
245245
# torchvision here, which *should* correspond to what is
246-
# in pyproject.toml. This is to prevent torch 2.0 from
247-
# being installed and immediately uninstalled and replaced with 1.13
246+
# in pyproject.toml.
248247
pip = local[self.pip]
249248

250249
(
251250
pip[
252251
"install",
253252
"--require-virtualenv",
254-
"torch~=1.13.1",
255-
"torchvision~=0.14.1",
253+
"torch~=2.0.0",
254+
"torchvision>=0.14.1",
256255
"--force-reinstall",
257256
"--find-links" if find_links is not None else None,
258257
find_links,

invokeai/backend/invoke_ai_web_server.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,23 @@
2525
import invokeai.frontend.dist as frontend
2626
from ldm.generate import Generate
2727
from ldm.invoke.args import Args, APP_ID, APP_VERSION, calculate_init_img_hash
28-
from ldm.invoke.concepts_lib import HuggingFaceConceptsLibrary
28+
from ldm.invoke.concepts_lib import get_hf_concepts_lib
2929
from ldm.invoke.conditioning import (
3030
get_tokens_for_prompt_object,
3131
get_prompt_structure,
3232
split_weighted_subprompts,
33-
get_tokenizer,
3433
)
3534
from ldm.invoke.generator.diffusers_pipeline import PipelineIntermediateState
3635
from ldm.invoke.generator.inpaint import infill_methods
3736
from ldm.invoke.globals import (
3837
Globals,
3938
global_converted_ckpts_dir,
4039
global_models_dir,
41-
global_lora_models_dir,
4240
)
4341
from ldm.invoke.pngwriter import PngWriter, retrieve_metadata
4442
from compel.prompt_parser import Blend
4543
from ldm.invoke.merge_diffusers import merge_diffusion_models
44+
from ldm.modules.lora_manager import LoraManager
4645

4746
# Loading Arguments
4847
opt = Args()
@@ -524,20 +523,12 @@ def merge_diffusers_models(model_merge_info: dict):
524523
@socketio.on("getLoraModels")
525524
def get_lora_models():
526525
try:
527-
lora_path = global_lora_models_dir()
528-
loras = []
529-
for root, _, files in os.walk(lora_path):
530-
models = [
531-
Path(root, x)
532-
for x in files
533-
if Path(x).suffix in [".ckpt", ".pt", ".safetensors"]
534-
]
535-
loras = loras + models
536-
526+
model = self.generate.model
527+
lora_mgr = LoraManager(model)
528+
loras = lora_mgr.list_compatible_loras()
537529
found_loras = []
538-
for lora in sorted(loras, key=lambda s: s.stem.lower()):
539-
location = str(lora.resolve()).replace("\\", "/")
540-
found_loras.append({"name": lora.stem, "location": location})
530+
for lora in sorted(loras, key=str.casefold):
531+
found_loras.append({"name":lora,"location":str(loras[lora])})
541532
socketio.emit("foundLoras", found_loras)
542533
except Exception as e:
543534
self.handle_exceptions(e)
@@ -547,7 +538,7 @@ def get_ti_triggers():
547538
try:
548539
local_triggers = self.generate.model.textual_inversion_manager.get_all_trigger_strings()
549540
locals = [{'name': x} for x in sorted(local_triggers, key=str.casefold)]
550-
concepts = HuggingFaceConceptsLibrary().list_concepts(minimum_likes=5)
541+
concepts = get_hf_concepts_lib().list_concepts(minimum_likes=5)
551542
concepts = [{'name': f'<{x}>'} for x in sorted(concepts, key=str.casefold) if f'<{x}>' not in local_triggers]
552543
socketio.emit("foundTextualInversionTriggers", {'local_triggers': locals, 'huggingface_concepts': concepts})
553544
except Exception as e:
@@ -1314,7 +1305,7 @@ def image_done(image, seed, first_seed, attention_maps_image=None):
13141305
None
13151306
if type(parsed_prompt) is Blend
13161307
else get_tokens_for_prompt_object(
1317-
get_tokenizer(self.generate.model), parsed_prompt
1308+
self.generate.model.tokenizer, parsed_prompt
13181309
)
13191310
)
13201311
attention_maps_image_base64_url = (

invokeai/configs/INITIAL_MODELS.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ trinart-2.0:
8080
repo_id: stabilityai/sd-vae-ft-mse
8181
recommended: False
8282
waifu-diffusion-1.4:
83-
description: An SD-1.5 model trained on 680k anime/manga-style images (2.13 GB)
83+
description: An SD-2.1 model trained on 5.4M anime/manga-style images (4.27 GB)
84+
revision: main
8485
repo_id: hakurei/waifu-diffusion
8586
format: diffusers
8687
vae:

0 commit comments

Comments
 (0)