From 3f0b0f3250fb909779334880346f4fd3c2c3e0be Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Thu, 2 Mar 2023 13:28:17 -0500 Subject: [PATCH] almost all of backend migrated; restoration next --- .gitignore | 5 ---- installer/create_installer.sh | 4 +-- invokeai/backend/__init__.py | 1 + invokeai/backend/{ldm => }/devices.py | 0 invokeai/backend/generator/__init__.py | 1 - invokeai/backend/generator/base.py | 4 +-- invokeai/backend/generator/img2img.py | 6 ++-- invokeai/backend/generator/inpaint.py | 9 +++--- invokeai/backend/generator/txt2img.py | 6 ++-- invokeai/backend/image_util/__init__.py | 28 ++++++++++++++++++ .../backend/image_util}/patchmatch.py | 0 .../backend/image_util}/pngwriter.py | 0 .../backend/image_util}/txt2mask.py | 0 .../backend/image_util/util.py | 0 invokeai/backend/invoke_ai_web_server.py | 13 +++++--- invokeai/backend/ldm/models/__init__.py | 10 ------- invokeai/backend/ldm/models/__init__.py~ | 10 ------- .../backend/{ldm/models => }/model_manager.py | 7 ++--- invokeai/backend/prompting/__init__.py | 7 +++++ .../{ldm => prompting}/conditioning.py | 4 +-- invokeai/backend/stable_diffusion/__init__.py | 16 ++++++++++ .../modules => stable_diffusion}/attention.py | 2 +- .../autoencoder.py | 4 +-- .../{ldm => stable_diffusion}/concepts_lib.py | 0 .../data/__init__.py | 0 .../{ldm => stable_diffusion}/data/base.py | 0 .../data/imagenet.py | 0 .../{ldm => stable_diffusion}/data/lsun.py | 0 .../data/personalized.py | 0 .../data/personalized_style.py | 0 .../diffusers_pipeline.py | 9 +++--- .../diffusion/__init__.py | 0 .../diffusion/__init__.py~ | 0 .../diffusion/classifier.py | 0 .../diffusion/cross_attention_control.py | 0 .../diffusion/cross_attention_map_saving.py | 0 .../diffusion/ddim.py | 2 +- .../diffusion/ddpm.py | 8 ++--- .../diffusion/ksampler.py | 0 .../diffusion/plms.py | 2 +- .../diffusion/sampler.py | 2 +- .../diffusion/shared_invokeai_diffusion.py | 0 .../diffusionmodules}/__init__.py | 0 .../diffusionmodules/model.py | 0 .../diffusionmodules/openaimodel.py | 0 .../diffusionmodules/util.py | 0 .../distributions}/__init__.py | 0 .../distributions/distributions.py | 0 .../{ldm/modules => stable_diffusion}/ema.py | 0 .../encoders}/__init__.py | 0 .../encoders/modules.py | 0 .../image_degradation/__init__.py | 0 .../image_degradation/bsrgan.py | 0 .../image_degradation/bsrgan_light.py | 0 .../image_degradation/utils/test.png | Bin .../image_degradation/utils_image.py | 0 .../losses/__init__.py | 0 .../losses/contperceptual.py | 0 .../losses/vqperceptual.py | 0 .../modules}/__init__.py | 0 .../{ldm => stable_diffusion}/offloading.py | 0 .../textual_inversion_manager.py | 2 +- .../x_transformer.py | 0 invokeai/backend/{ldm => }/util.py | 17 ----------- {ldm/invoke => invokeai/version}/__init__.py | 11 +++++-- .../version/invokeai_version.py | 0 ldm/generate.py | 18 +++++------ ldm/invoke/CLI.py | 13 ++++---- ldm/invoke/app/services/image_storage.py | 2 +- ldm/invoke/args.py | 20 ++++++------- ldm/invoke/config/model_install.py | 2 +- ldm/invoke/config/model_install_backend.py | 4 +-- ldm/invoke/merge_diffusers.py | 2 +- ldm/invoke/readline.py | 2 +- pyproject.toml | 6 ++-- tests/test_textual_inversion.py | 2 +- 76 files changed, 141 insertions(+), 120 deletions(-) rename invokeai/backend/{ldm => }/devices.py (100%) create mode 100644 invokeai/backend/image_util/__init__.py rename {ldm/invoke => invokeai/backend/image_util}/patchmatch.py (100%) rename {ldm/invoke => invokeai/backend/image_util}/pngwriter.py (100%) rename {ldm/invoke => invokeai/backend/image_util}/txt2mask.py (100%) rename ldm/invoke/image_util.py => invokeai/backend/image_util/util.py (100%) delete mode 100644 invokeai/backend/ldm/models/__init__.py delete mode 100644 invokeai/backend/ldm/models/__init__.py~ rename invokeai/backend/{ldm/models => }/model_manager.py (99%) create mode 100644 invokeai/backend/prompting/__init__.py rename invokeai/backend/{ldm => prompting}/conditioning.py (99%) create mode 100644 invokeai/backend/stable_diffusion/__init__.py rename invokeai/backend/{ldm/modules => stable_diffusion}/attention.py (99%) rename invokeai/backend/{ldm/models => stable_diffusion}/autoencoder.py (99%) rename invokeai/backend/{ldm => stable_diffusion}/concepts_lib.py (100%) rename invokeai/backend/{ldm => stable_diffusion}/data/__init__.py (100%) rename invokeai/backend/{ldm => stable_diffusion}/data/base.py (100%) rename invokeai/backend/{ldm => stable_diffusion}/data/imagenet.py (100%) rename invokeai/backend/{ldm => stable_diffusion}/data/lsun.py (100%) rename invokeai/backend/{ldm => stable_diffusion}/data/personalized.py (100%) rename invokeai/backend/{ldm => stable_diffusion}/data/personalized_style.py (100%) rename invokeai/backend/{generator => stable_diffusion}/diffusers_pipeline.py (99%) rename invokeai/backend/{ldm/models => stable_diffusion}/diffusion/__init__.py (100%) rename invokeai/backend/{ldm/models => stable_diffusion}/diffusion/__init__.py~ (100%) rename invokeai/backend/{ldm/models => stable_diffusion}/diffusion/classifier.py (100%) rename invokeai/backend/{ldm/models => stable_diffusion}/diffusion/cross_attention_control.py (100%) rename invokeai/backend/{ldm/models => stable_diffusion}/diffusion/cross_attention_map_saving.py (100%) rename invokeai/backend/{ldm/models => stable_diffusion}/diffusion/ddim.py (98%) rename invokeai/backend/{ldm/models => stable_diffusion}/diffusion/ddpm.py (99%) rename invokeai/backend/{ldm/models => stable_diffusion}/diffusion/ksampler.py (100%) rename invokeai/backend/{ldm/models => stable_diffusion}/diffusion/plms.py (99%) rename invokeai/backend/{ldm/models => stable_diffusion}/diffusion/sampler.py (99%) rename invokeai/backend/{ldm/models => stable_diffusion}/diffusion/shared_invokeai_diffusion.py (100%) rename invokeai/backend/{ldm/modules => stable_diffusion/diffusionmodules}/__init__.py (100%) rename invokeai/backend/{ldm/modules => stable_diffusion}/diffusionmodules/model.py (100%) rename invokeai/backend/{ldm/modules => stable_diffusion}/diffusionmodules/openaimodel.py (100%) rename invokeai/backend/{ldm/modules => stable_diffusion}/diffusionmodules/util.py (100%) rename invokeai/backend/{ldm/modules/diffusionmodules => stable_diffusion/distributions}/__init__.py (100%) rename invokeai/backend/{ldm/modules => stable_diffusion}/distributions/distributions.py (100%) rename invokeai/backend/{ldm/modules => stable_diffusion}/ema.py (100%) rename invokeai/backend/{ldm/modules/distributions => stable_diffusion/encoders}/__init__.py (100%) rename invokeai/backend/{ldm/modules => stable_diffusion}/encoders/modules.py (100%) rename invokeai/backend/{ldm/modules => stable_diffusion}/image_degradation/__init__.py (100%) rename invokeai/backend/{ldm/modules => stable_diffusion}/image_degradation/bsrgan.py (100%) rename invokeai/backend/{ldm/modules => stable_diffusion}/image_degradation/bsrgan_light.py (100%) rename invokeai/backend/{ldm/modules => stable_diffusion}/image_degradation/utils/test.png (100%) rename invokeai/backend/{ldm/modules => stable_diffusion}/image_degradation/utils_image.py (100%) rename invokeai/backend/{ldm/modules => stable_diffusion}/losses/__init__.py (100%) rename invokeai/backend/{ldm/modules => stable_diffusion}/losses/contperceptual.py (100%) rename invokeai/backend/{ldm/modules => stable_diffusion}/losses/vqperceptual.py (100%) rename invokeai/backend/{ldm/modules/encoders => stable_diffusion/modules}/__init__.py (100%) rename invokeai/backend/{ldm => stable_diffusion}/offloading.py (100%) rename invokeai/backend/{ldm/modules => stable_diffusion}/textual_inversion_manager.py (99%) rename invokeai/backend/{ldm/modules => stable_diffusion}/x_transformer.py (100%) rename invokeai/backend/{ldm => }/util.py (96%) rename {ldm/invoke => invokeai/version}/__init__.py (58%) rename ldm/invoke/_version.py => invokeai/version/invokeai_version.py (100%) diff --git a/.gitignore b/.gitignore index e28b2c432c..c84ffb1e65 100644 --- a/.gitignore +++ b/.gitignore @@ -213,11 +213,6 @@ gfpgan/ # config file (will be created by installer) configs/models.yaml -# weights (will be created by installer) -# models/ldm/stable-diffusion-v1/*.ckpt -# models/clipseg -# models/gfpgan - # ignore initfile .invokeai diff --git a/installer/create_installer.sh b/installer/create_installer.sh index 8d01c2b331..eac0028493 100755 --- a/installer/create_installer.sh +++ b/installer/create_installer.sh @@ -11,10 +11,10 @@ if [[ -v "VIRTUAL_ENV" ]]; then exit -1 fi -VERSION=$(cd ..; python -c "from ldm.invoke import __version__ as version; print(version)") +VERSION=$(cd ..; python -c "from invokeai.version import __version__ as version; print(version)") PATCH="" VERSION="v${VERSION}${PATCH}" -LATEST_TAG="v2.3-latest" +LATEST_TAG="v3.0-latest" echo Building installer for version $VERSION echo "Be certain that you're in the 'installer' directory before continuing." diff --git a/invokeai/backend/__init__.py b/invokeai/backend/__init__.py index 16ced6d9d3..5384b3cee0 100644 --- a/invokeai/backend/__init__.py +++ b/invokeai/backend/__init__.py @@ -3,5 +3,6 @@ Initialization file for invokeai.backend ''' # this is causing circular import issues # from .invoke_ai_web_server import InvokeAIWebServer +from .model_manager import ModelManager diff --git a/invokeai/backend/ldm/devices.py b/invokeai/backend/devices.py similarity index 100% rename from invokeai/backend/ldm/devices.py rename to invokeai/backend/devices.py diff --git a/invokeai/backend/generator/__init__.py b/invokeai/backend/generator/__init__.py index c50c9d387d..4d61779472 100644 --- a/invokeai/backend/generator/__init__.py +++ b/invokeai/backend/generator/__init__.py @@ -2,5 +2,4 @@ Initialization file for the invokeai.generator package ''' from .base import Generator -from .diffusers_pipeline import PipelineIntermediateState, StableDiffusionGeneratorPipeline from .inpaint import infill_methods diff --git a/invokeai/backend/generator/base.py b/invokeai/backend/generator/base.py index 994a06f461..c35cf58995 100644 --- a/invokeai/backend/generator/base.py +++ b/invokeai/backend/generator/base.py @@ -22,8 +22,8 @@ from pytorch_lightning import seed_everything from tqdm import trange import invokeai.assets.web as web_assets -from ..ldm.models.diffusion.ddpm import DiffusionWrapper -from ..ldm.util import rand_perlin_2d +from ..stable_diffusion.diffusion.ddpm import DiffusionWrapper +from ..util import rand_perlin_2d downsampling = 8 CAUTION_IMG = 'caution.png' diff --git a/invokeai/backend/generator/img2img.py b/invokeai/backend/generator/img2img.py index c50120fc98..edd78d6148 100644 --- a/invokeai/backend/generator/img2img.py +++ b/invokeai/backend/generator/img2img.py @@ -6,8 +6,10 @@ import torch from diffusers import logging from .base import Generator -from .diffusers_pipeline import StableDiffusionGeneratorPipeline, ConditioningData -from ..ldm.models.diffusion import PostprocessingSettings +from ..stable_diffusion import (StableDiffusionGeneratorPipeline, + ConditioningData, + PostprocessingSettings + ) class Img2Img(Generator): def __init__(self, model, precision): diff --git a/invokeai/backend/generator/inpaint.py b/invokeai/backend/generator/inpaint.py index ec5e4087ea..a6e6fe4387 100644 --- a/invokeai/backend/generator/inpaint.py +++ b/invokeai/backend/generator/inpaint.py @@ -11,11 +11,12 @@ import numpy as np import torch from PIL import Image, ImageFilter, ImageOps, ImageChops -from .diffusers_pipeline import image_resized_to_grid_as_tensor, StableDiffusionGeneratorPipeline, \ - ConditioningData +from ..stable_diffusion.diffusers_pipeline import (image_resized_to_grid_as_tensor, + StableDiffusionGeneratorPipeline, + ConditioningData + ) from .img2img import Img2Img -from ldm.invoke.patchmatch import PatchMatch -from ..ldm.util import debug_image +from ..image_util import PatchMatch, debug_image def infill_methods()->list[str]: diff --git a/invokeai/backend/generator/txt2img.py b/invokeai/backend/generator/txt2img.py index 6ff4cedd6c..40094a3033 100644 --- a/invokeai/backend/generator/txt2img.py +++ b/invokeai/backend/generator/txt2img.py @@ -5,8 +5,10 @@ import PIL.Image import torch from .base import Generator -from .diffusers_pipeline import StableDiffusionGeneratorPipeline, ConditioningData -from ..ldm.models import PostprocessingSettings +from ..stable_diffusion import (PostprocessingSettings, + StableDiffusionGeneratorPipeline, + ConditioningData + ) class Txt2Img(Generator): def __init__(self, model, precision): diff --git a/invokeai/backend/image_util/__init__.py b/invokeai/backend/image_util/__init__.py new file mode 100644 index 0000000000..8cb3199d2d --- /dev/null +++ b/invokeai/backend/image_util/__init__.py @@ -0,0 +1,28 @@ +''' +Initialization file for invokeai.backend.image_util methods. +''' +from .patchmatch import PatchMatch +from .txt2mask import Txt2Mask +from .util import InitImageResizer, make_grid +from .pngwriter import (PngWriter, + PromptFormatter, + retrieve_metadata, + write_metadata, + ) + +def debug_image( + debug_image, debug_text, debug_show=True, debug_result=False, debug_status=False +): + if not debug_status: + return + + image_copy = debug_image.copy().convert("RGBA") + ImageDraw.Draw(image_copy).text((5, 5), debug_text, (255, 0, 0)) + + if debug_show: + image_copy.show() + + if debug_result: + return image_copy + + diff --git a/ldm/invoke/patchmatch.py b/invokeai/backend/image_util/patchmatch.py similarity index 100% rename from ldm/invoke/patchmatch.py rename to invokeai/backend/image_util/patchmatch.py diff --git a/ldm/invoke/pngwriter.py b/invokeai/backend/image_util/pngwriter.py similarity index 100% rename from ldm/invoke/pngwriter.py rename to invokeai/backend/image_util/pngwriter.py diff --git a/ldm/invoke/txt2mask.py b/invokeai/backend/image_util/txt2mask.py similarity index 100% rename from ldm/invoke/txt2mask.py rename to invokeai/backend/image_util/txt2mask.py diff --git a/ldm/invoke/image_util.py b/invokeai/backend/image_util/util.py similarity index 100% rename from ldm/invoke/image_util.py rename to invokeai/backend/image_util/util.py diff --git a/invokeai/backend/invoke_ai_web_server.py b/invokeai/backend/invoke_ai_web_server.py index f6e9446618..7c6177803c 100644 --- a/invokeai/backend/invoke_ai_web_server.py +++ b/invokeai/backend/invoke_ai_web_server.py @@ -23,16 +23,21 @@ from werkzeug.utils import secure_filename from invokeai.backend.modules.get_canvas_generation_mode import ( get_canvas_generation_mode, ) -from invokeai.backend.modules.parameters import parameters_to_command +from .modules.parameters import parameters_to_command +from .prompting import (get_tokens_for_prompt_object, + get_prompt_structure, + get_tokenizer + ) +from .image_util import PngWriter, retrieve_metadata +from .generator import infill_methods +from .stable_diffusion import PipelineIntermediateState + from ldm.generate import Generate from ldm.invoke.args import Args, APP_ID, APP_VERSION, calculate_init_img_hash -from invokeai.backend.ldm.conditioning import get_tokens_for_prompt_object, get_prompt_structure, get_tokenizer -from .generator import infill_methods, PipelineIntermediateState from ldm.invoke.globals import ( Globals, global_converted_ckpts_dir, global_models_dir ) from ldm.invoke.merge_diffusers import merge_diffusion_models -from ldm.invoke.pngwriter import PngWriter, retrieve_metadata # Loading Arguments opt = Args() diff --git a/invokeai/backend/ldm/models/__init__.py b/invokeai/backend/ldm/models/__init__.py deleted file mode 100644 index bd11ddb78c..0000000000 --- a/invokeai/backend/ldm/models/__init__.py +++ /dev/null @@ -1,10 +0,0 @@ -''' -Initialization file for the invokeai.backend.models package -''' -from .model_manager import ModelManager, SDLegacyType -from .diffusion import InvokeAIDiffuserComponent -from .diffusion.ddim import DDIMSampler -from .diffusion.ksampler import KSampler -from .diffusion.plms import PLMSSampler -from .diffusion.cross_attention_map_saving import AttentionMapSaver -from .diffusion.shared_invokeai_diffusion import PostprocessingSettings diff --git a/invokeai/backend/ldm/models/__init__.py~ b/invokeai/backend/ldm/models/__init__.py~ deleted file mode 100644 index 6e060d7fa5..0000000000 --- a/invokeai/backend/ldm/models/__init__.py~ +++ /dev/null @@ -1,10 +0,0 @@ -''' -Initialization file for the invokeai.models package -''' -from .model_manager import ModelManager, SDLegacyType -from .diffusion.shared_invokeai_diffusion import InvokeAIDiffuserComponent -from .diffusion.ddim import DDIMSampler -from .diffusion.ksampler import KSampler -from .diffusion.plms import PLMSSampler -from .diffusion.cross_attention_map_saving import AttentionMapSaver -from .diffusion.shared_invokeai_diffusion import PostprocessingSettings diff --git a/invokeai/backend/ldm/models/model_manager.py b/invokeai/backend/model_manager.py similarity index 99% rename from invokeai/backend/ldm/models/model_manager.py rename to invokeai/backend/model_manager.py index 8edf220a4c..1f99654610 100644 --- a/invokeai/backend/ldm/models/model_manager.py +++ b/invokeai/backend/model_manager.py @@ -31,15 +31,14 @@ from omegaconf import OmegaConf from omegaconf.dictconfig import DictConfig from picklescan.scanner import scan_file_path -from ..devices import CPU_DEVICE +from .devices import CPU_DEVICE from ldm.invoke.globals import Globals, global_cache_dir -from ..util import ( +from .util import ( ask_user, download_with_resume, url_attachment_name, ) -from ...generator.diffusers_pipeline import StableDiffusionGeneratorPipeline - +from .stable_diffusion import StableDiffusionGeneratorPipeline class SDLegacyType(Enum): V1 = 1 diff --git a/invokeai/backend/prompting/__init__.py b/invokeai/backend/prompting/__init__.py new file mode 100644 index 0000000000..29694c6538 --- /dev/null +++ b/invokeai/backend/prompting/__init__.py @@ -0,0 +1,7 @@ +''' +Initialization file for invokeai.backend.prompting +''' +from .conditioning import (get_uc_and_c_and_ec, + split_weighted_subprompts, + get_tokens_for_prompt_object, + get_prompt_structure, get_tokenizer) diff --git a/invokeai/backend/ldm/conditioning.py b/invokeai/backend/prompting/conditioning.py similarity index 99% rename from invokeai/backend/ldm/conditioning.py rename to invokeai/backend/prompting/conditioning.py index 918fa2def1..9ec8babf16 100644 --- a/invokeai/backend/ldm/conditioning.py +++ b/invokeai/backend/prompting/conditioning.py @@ -13,8 +13,8 @@ from transformers import CLIPTokenizer, CLIPTextModel from compel import Compel from compel.prompt_parser import FlattenedPrompt, Blend, Fragment, CrossAttentionControlSubstitute, PromptParser -from .devices import torch_dtype -from .models import InvokeAIDiffuserComponent +from ..devices import torch_dtype +from ..stable_diffusion import InvokeAIDiffuserComponent from ldm.invoke.globals import Globals def get_tokenizer(model) -> CLIPTokenizer: diff --git a/invokeai/backend/stable_diffusion/__init__.py b/invokeai/backend/stable_diffusion/__init__.py new file mode 100644 index 0000000000..13e28ce22d --- /dev/null +++ b/invokeai/backend/stable_diffusion/__init__.py @@ -0,0 +1,16 @@ +''' +Initialization file for the invokeai.backend.stable_diffusion package +''' +from .diffusion import InvokeAIDiffuserComponent +from .diffusion.ddim import DDIMSampler +from .diffusion.ksampler import KSampler +from .diffusion.plms import PLMSSampler +from .diffusion.cross_attention_map_saving import AttentionMapSaver +from .diffusion.shared_invokeai_diffusion import PostprocessingSettings +from .textual_inversion_manager import TextualInversionManager +from .concepts_lib import HuggingFaceConceptsLibrary +from .diffusers_pipeline import (StableDiffusionGeneratorPipeline, + ConditioningData, + PipelineIntermediateState, + StableDiffusionGeneratorPipeline + ) diff --git a/invokeai/backend/ldm/modules/attention.py b/invokeai/backend/stable_diffusion/attention.py similarity index 99% rename from invokeai/backend/ldm/modules/attention.py rename to invokeai/backend/stable_diffusion/attention.py index 4fb426130f..27fc5cf4bd 100644 --- a/invokeai/backend/ldm/modules/attention.py +++ b/invokeai/backend/stable_diffusion/attention.py @@ -7,7 +7,7 @@ import torch.nn.functional as F from torch import nn, einsum from einops import rearrange, repeat -from ..models.diffusion import InvokeAICrossAttentionMixin +from .diffusion import InvokeAICrossAttentionMixin from .diffusionmodules.util import checkpoint def exists(val): diff --git a/invokeai/backend/ldm/models/autoencoder.py b/invokeai/backend/stable_diffusion/autoencoder.py similarity index 99% rename from invokeai/backend/ldm/models/autoencoder.py rename to invokeai/backend/stable_diffusion/autoencoder.py index 49c413a5fb..ba081bab28 100644 --- a/invokeai/backend/ldm/models/autoencoder.py +++ b/invokeai/backend/stable_diffusion/autoencoder.py @@ -5,8 +5,8 @@ from contextlib import contextmanager from taming.modules.vqvae.quantize import VectorQuantizer2 as VectorQuantizer -from ..modules.diffusionmodules.model import Encoder, Decoder -from ..modules.distributions.distributions import ( +from .diffusionmodules.model import Encoder, Decoder +from .distributions.distributions import ( DiagonalGaussianDistribution, ) diff --git a/invokeai/backend/ldm/concepts_lib.py b/invokeai/backend/stable_diffusion/concepts_lib.py similarity index 100% rename from invokeai/backend/ldm/concepts_lib.py rename to invokeai/backend/stable_diffusion/concepts_lib.py diff --git a/invokeai/backend/ldm/data/__init__.py b/invokeai/backend/stable_diffusion/data/__init__.py similarity index 100% rename from invokeai/backend/ldm/data/__init__.py rename to invokeai/backend/stable_diffusion/data/__init__.py diff --git a/invokeai/backend/ldm/data/base.py b/invokeai/backend/stable_diffusion/data/base.py similarity index 100% rename from invokeai/backend/ldm/data/base.py rename to invokeai/backend/stable_diffusion/data/base.py diff --git a/invokeai/backend/ldm/data/imagenet.py b/invokeai/backend/stable_diffusion/data/imagenet.py similarity index 100% rename from invokeai/backend/ldm/data/imagenet.py rename to invokeai/backend/stable_diffusion/data/imagenet.py diff --git a/invokeai/backend/ldm/data/lsun.py b/invokeai/backend/stable_diffusion/data/lsun.py similarity index 100% rename from invokeai/backend/ldm/data/lsun.py rename to invokeai/backend/stable_diffusion/data/lsun.py diff --git a/invokeai/backend/ldm/data/personalized.py b/invokeai/backend/stable_diffusion/data/personalized.py similarity index 100% rename from invokeai/backend/ldm/data/personalized.py rename to invokeai/backend/stable_diffusion/data/personalized.py diff --git a/invokeai/backend/ldm/data/personalized_style.py b/invokeai/backend/stable_diffusion/data/personalized_style.py similarity index 100% rename from invokeai/backend/ldm/data/personalized_style.py rename to invokeai/backend/stable_diffusion/data/personalized_style.py diff --git a/invokeai/backend/generator/diffusers_pipeline.py b/invokeai/backend/stable_diffusion/diffusers_pipeline.py similarity index 99% rename from invokeai/backend/generator/diffusers_pipeline.py rename to invokeai/backend/stable_diffusion/diffusers_pipeline.py index e9aa9fb86f..fcc958d61b 100644 --- a/invokeai/backend/generator/diffusers_pipeline.py +++ b/invokeai/backend/stable_diffusion/diffusers_pipeline.py @@ -27,11 +27,10 @@ from transformers import CLIPFeatureExtractor, CLIPTextModel, CLIPTokenizer from typing_extensions import ParamSpec from ldm.invoke.globals import Globals -from ..ldm.models.diffusion import InvokeAIDiffuserComponent, PostprocessingSettings -from ..ldm.modules.textual_inversion_manager import TextualInversionManager -from ..ldm.devices import normalize_device, CPU_DEVICE -from ..ldm.offloading import LazilyLoadedModelGroup, FullyLoadedModelGroup, ModelGroup -from ..ldm.models.diffusion import AttentionMapSaver +from ..stable_diffusion.diffusion import InvokeAIDiffuserComponent, PostprocessingSettings, AttentionMapSaver +from ..stable_diffusion.textual_inversion_manager import TextualInversionManager +from ..stable_diffusion.offloading import LazilyLoadedModelGroup, FullyLoadedModelGroup, ModelGroup +from ..devices import normalize_device, CPU_DEVICE from compel import EmbeddingsProvider @dataclass diff --git a/invokeai/backend/ldm/models/diffusion/__init__.py b/invokeai/backend/stable_diffusion/diffusion/__init__.py similarity index 100% rename from invokeai/backend/ldm/models/diffusion/__init__.py rename to invokeai/backend/stable_diffusion/diffusion/__init__.py diff --git a/invokeai/backend/ldm/models/diffusion/__init__.py~ b/invokeai/backend/stable_diffusion/diffusion/__init__.py~ similarity index 100% rename from invokeai/backend/ldm/models/diffusion/__init__.py~ rename to invokeai/backend/stable_diffusion/diffusion/__init__.py~ diff --git a/invokeai/backend/ldm/models/diffusion/classifier.py b/invokeai/backend/stable_diffusion/diffusion/classifier.py similarity index 100% rename from invokeai/backend/ldm/models/diffusion/classifier.py rename to invokeai/backend/stable_diffusion/diffusion/classifier.py diff --git a/invokeai/backend/ldm/models/diffusion/cross_attention_control.py b/invokeai/backend/stable_diffusion/diffusion/cross_attention_control.py similarity index 100% rename from invokeai/backend/ldm/models/diffusion/cross_attention_control.py rename to invokeai/backend/stable_diffusion/diffusion/cross_attention_control.py diff --git a/invokeai/backend/ldm/models/diffusion/cross_attention_map_saving.py b/invokeai/backend/stable_diffusion/diffusion/cross_attention_map_saving.py similarity index 100% rename from invokeai/backend/ldm/models/diffusion/cross_attention_map_saving.py rename to invokeai/backend/stable_diffusion/diffusion/cross_attention_map_saving.py diff --git a/invokeai/backend/ldm/models/diffusion/ddim.py b/invokeai/backend/stable_diffusion/diffusion/ddim.py similarity index 98% rename from invokeai/backend/ldm/models/diffusion/ddim.py rename to invokeai/backend/stable_diffusion/diffusion/ddim.py index f36e970552..41d6249fc5 100644 --- a/invokeai/backend/ldm/models/diffusion/ddim.py +++ b/invokeai/backend/stable_diffusion/diffusion/ddim.py @@ -3,7 +3,7 @@ import torch from .shared_invokeai_diffusion import InvokeAIDiffuserComponent from .sampler import Sampler -from ...modules.diffusionmodules.util import noise_like +from ..diffusionmodules.util import noise_like class DDIMSampler(Sampler): def __init__(self, model, schedule='linear', device=None, **kwargs): diff --git a/invokeai/backend/ldm/models/diffusion/ddpm.py b/invokeai/backend/stable_diffusion/diffusion/ddpm.py similarity index 99% rename from invokeai/backend/ldm/models/diffusion/ddpm.py rename to invokeai/backend/stable_diffusion/diffusion/ddpm.py index f9e9485dd3..deba4ebaf1 100644 --- a/invokeai/backend/ldm/models/diffusion/ddpm.py +++ b/invokeai/backend/stable_diffusion/diffusion/ddpm.py @@ -22,7 +22,7 @@ from pytorch_lightning.utilities.distributed import rank_zero_only from omegaconf import ListConfig import urllib -from ...modules.textual_inversion_manager import TextualInversionManager +from ..textual_inversion_manager import TextualInversionManager from ...util import ( log_txt_as_img, exists, @@ -33,8 +33,8 @@ from ...util import ( count_params, instantiate_from_config, ) -from ...modules.ema import LitEma -from ...modules.distributions.distributions import ( +from ..ema import LitEma +from ..distributions.distributions import ( normal_kl, DiagonalGaussianDistribution, ) @@ -43,7 +43,7 @@ from ..autoencoder import ( IdentityFirstStage, AutoencoderKL, ) -from ...modules.diffusionmodules.util import ( +from ..diffusionmodules.util import ( make_beta_schedule, extract_into_tensor, noise_like, diff --git a/invokeai/backend/ldm/models/diffusion/ksampler.py b/invokeai/backend/stable_diffusion/diffusion/ksampler.py similarity index 100% rename from invokeai/backend/ldm/models/diffusion/ksampler.py rename to invokeai/backend/stable_diffusion/diffusion/ksampler.py diff --git a/invokeai/backend/ldm/models/diffusion/plms.py b/invokeai/backend/stable_diffusion/diffusion/plms.py similarity index 99% rename from invokeai/backend/ldm/models/diffusion/plms.py rename to invokeai/backend/stable_diffusion/diffusion/plms.py index e0a187e900..2dfead482b 100644 --- a/invokeai/backend/ldm/models/diffusion/plms.py +++ b/invokeai/backend/stable_diffusion/diffusion/plms.py @@ -7,7 +7,7 @@ from functools import partial from ...devices import choose_torch_device from .shared_invokeai_diffusion import InvokeAIDiffuserComponent from .sampler import Sampler -from ...modules.diffusionmodules.util import noise_like +from ..diffusionmodules.util import noise_like class PLMSSampler(Sampler): diff --git a/invokeai/backend/ldm/models/diffusion/sampler.py b/invokeai/backend/stable_diffusion/diffusion/sampler.py similarity index 99% rename from invokeai/backend/ldm/models/diffusion/sampler.py rename to invokeai/backend/stable_diffusion/diffusion/sampler.py index bd9d8c157b..656897ee31 100644 --- a/invokeai/backend/ldm/models/diffusion/sampler.py +++ b/invokeai/backend/stable_diffusion/diffusion/sampler.py @@ -10,7 +10,7 @@ from functools import partial from ...devices import choose_torch_device from .shared_invokeai_diffusion import InvokeAIDiffuserComponent -from ...modules.diffusionmodules.util import ( +from ..diffusionmodules.util import ( make_ddim_sampling_parameters, make_ddim_timesteps, noise_like, diff --git a/invokeai/backend/ldm/models/diffusion/shared_invokeai_diffusion.py b/invokeai/backend/stable_diffusion/diffusion/shared_invokeai_diffusion.py similarity index 100% rename from invokeai/backend/ldm/models/diffusion/shared_invokeai_diffusion.py rename to invokeai/backend/stable_diffusion/diffusion/shared_invokeai_diffusion.py diff --git a/invokeai/backend/ldm/modules/__init__.py b/invokeai/backend/stable_diffusion/diffusionmodules/__init__.py similarity index 100% rename from invokeai/backend/ldm/modules/__init__.py rename to invokeai/backend/stable_diffusion/diffusionmodules/__init__.py diff --git a/invokeai/backend/ldm/modules/diffusionmodules/model.py b/invokeai/backend/stable_diffusion/diffusionmodules/model.py similarity index 100% rename from invokeai/backend/ldm/modules/diffusionmodules/model.py rename to invokeai/backend/stable_diffusion/diffusionmodules/model.py diff --git a/invokeai/backend/ldm/modules/diffusionmodules/openaimodel.py b/invokeai/backend/stable_diffusion/diffusionmodules/openaimodel.py similarity index 100% rename from invokeai/backend/ldm/modules/diffusionmodules/openaimodel.py rename to invokeai/backend/stable_diffusion/diffusionmodules/openaimodel.py diff --git a/invokeai/backend/ldm/modules/diffusionmodules/util.py b/invokeai/backend/stable_diffusion/diffusionmodules/util.py similarity index 100% rename from invokeai/backend/ldm/modules/diffusionmodules/util.py rename to invokeai/backend/stable_diffusion/diffusionmodules/util.py diff --git a/invokeai/backend/ldm/modules/diffusionmodules/__init__.py b/invokeai/backend/stable_diffusion/distributions/__init__.py similarity index 100% rename from invokeai/backend/ldm/modules/diffusionmodules/__init__.py rename to invokeai/backend/stable_diffusion/distributions/__init__.py diff --git a/invokeai/backend/ldm/modules/distributions/distributions.py b/invokeai/backend/stable_diffusion/distributions/distributions.py similarity index 100% rename from invokeai/backend/ldm/modules/distributions/distributions.py rename to invokeai/backend/stable_diffusion/distributions/distributions.py diff --git a/invokeai/backend/ldm/modules/ema.py b/invokeai/backend/stable_diffusion/ema.py similarity index 100% rename from invokeai/backend/ldm/modules/ema.py rename to invokeai/backend/stable_diffusion/ema.py diff --git a/invokeai/backend/ldm/modules/distributions/__init__.py b/invokeai/backend/stable_diffusion/encoders/__init__.py similarity index 100% rename from invokeai/backend/ldm/modules/distributions/__init__.py rename to invokeai/backend/stable_diffusion/encoders/__init__.py diff --git a/invokeai/backend/ldm/modules/encoders/modules.py b/invokeai/backend/stable_diffusion/encoders/modules.py similarity index 100% rename from invokeai/backend/ldm/modules/encoders/modules.py rename to invokeai/backend/stable_diffusion/encoders/modules.py diff --git a/invokeai/backend/ldm/modules/image_degradation/__init__.py b/invokeai/backend/stable_diffusion/image_degradation/__init__.py similarity index 100% rename from invokeai/backend/ldm/modules/image_degradation/__init__.py rename to invokeai/backend/stable_diffusion/image_degradation/__init__.py diff --git a/invokeai/backend/ldm/modules/image_degradation/bsrgan.py b/invokeai/backend/stable_diffusion/image_degradation/bsrgan.py similarity index 100% rename from invokeai/backend/ldm/modules/image_degradation/bsrgan.py rename to invokeai/backend/stable_diffusion/image_degradation/bsrgan.py diff --git a/invokeai/backend/ldm/modules/image_degradation/bsrgan_light.py b/invokeai/backend/stable_diffusion/image_degradation/bsrgan_light.py similarity index 100% rename from invokeai/backend/ldm/modules/image_degradation/bsrgan_light.py rename to invokeai/backend/stable_diffusion/image_degradation/bsrgan_light.py diff --git a/invokeai/backend/ldm/modules/image_degradation/utils/test.png b/invokeai/backend/stable_diffusion/image_degradation/utils/test.png similarity index 100% rename from invokeai/backend/ldm/modules/image_degradation/utils/test.png rename to invokeai/backend/stable_diffusion/image_degradation/utils/test.png diff --git a/invokeai/backend/ldm/modules/image_degradation/utils_image.py b/invokeai/backend/stable_diffusion/image_degradation/utils_image.py similarity index 100% rename from invokeai/backend/ldm/modules/image_degradation/utils_image.py rename to invokeai/backend/stable_diffusion/image_degradation/utils_image.py diff --git a/invokeai/backend/ldm/modules/losses/__init__.py b/invokeai/backend/stable_diffusion/losses/__init__.py similarity index 100% rename from invokeai/backend/ldm/modules/losses/__init__.py rename to invokeai/backend/stable_diffusion/losses/__init__.py diff --git a/invokeai/backend/ldm/modules/losses/contperceptual.py b/invokeai/backend/stable_diffusion/losses/contperceptual.py similarity index 100% rename from invokeai/backend/ldm/modules/losses/contperceptual.py rename to invokeai/backend/stable_diffusion/losses/contperceptual.py diff --git a/invokeai/backend/ldm/modules/losses/vqperceptual.py b/invokeai/backend/stable_diffusion/losses/vqperceptual.py similarity index 100% rename from invokeai/backend/ldm/modules/losses/vqperceptual.py rename to invokeai/backend/stable_diffusion/losses/vqperceptual.py diff --git a/invokeai/backend/ldm/modules/encoders/__init__.py b/invokeai/backend/stable_diffusion/modules/__init__.py similarity index 100% rename from invokeai/backend/ldm/modules/encoders/__init__.py rename to invokeai/backend/stable_diffusion/modules/__init__.py diff --git a/invokeai/backend/ldm/offloading.py b/invokeai/backend/stable_diffusion/offloading.py similarity index 100% rename from invokeai/backend/ldm/offloading.py rename to invokeai/backend/stable_diffusion/offloading.py diff --git a/invokeai/backend/ldm/modules/textual_inversion_manager.py b/invokeai/backend/stable_diffusion/textual_inversion_manager.py similarity index 99% rename from invokeai/backend/ldm/modules/textual_inversion_manager.py rename to invokeai/backend/stable_diffusion/textual_inversion_manager.py index 2c5721ea7b..e45ea7362b 100644 --- a/invokeai/backend/ldm/modules/textual_inversion_manager.py +++ b/invokeai/backend/stable_diffusion/textual_inversion_manager.py @@ -9,7 +9,7 @@ from picklescan.scanner import scan_file_path from transformers import CLIPTextModel, CLIPTokenizer from compel.embeddings_provider import BaseTextualInversionManager -from ..concepts_lib import HuggingFaceConceptsLibrary +from .concepts_lib import HuggingFaceConceptsLibrary @dataclass diff --git a/invokeai/backend/ldm/modules/x_transformer.py b/invokeai/backend/stable_diffusion/x_transformer.py similarity index 100% rename from invokeai/backend/ldm/modules/x_transformer.py rename to invokeai/backend/stable_diffusion/x_transformer.py diff --git a/invokeai/backend/ldm/util.py b/invokeai/backend/util.py similarity index 96% rename from invokeai/backend/ldm/util.py rename to invokeai/backend/util.py index 0aac014ef9..2bd24d3ef0 100644 --- a/invokeai/backend/ldm/util.py +++ b/invokeai/backend/util.py @@ -17,7 +17,6 @@ from tqdm import tqdm from .devices import torch_dtype - def log_txt_as_img(wh, xc, size=10): # wh a tuple of (width, height) # xc a list of captions to plot @@ -280,22 +279,6 @@ def ask_user(question: str, answers: list): return valid_response -def debug_image( - debug_image, debug_text, debug_show=True, debug_result=False, debug_status=False -): - if not debug_status: - return - - image_copy = debug_image.copy().convert("RGBA") - ImageDraw.Draw(image_copy).text((5, 5), debug_text, (255, 0, 0)) - - if debug_show: - image_copy.show() - - if debug_result: - return image_copy - - # ------------------------------------- def download_with_resume(url: str, dest: Path, access_token: str = None) -> Path: ''' diff --git a/ldm/invoke/__init__.py b/invokeai/version/__init__.py similarity index 58% rename from ldm/invoke/__init__.py rename to invokeai/version/__init__.py index b643e80240..805834bb9a 100644 --- a/ldm/invoke/__init__.py +++ b/invokeai/version/__init__.py @@ -1,8 +1,15 @@ -from ._version import __version__ - +''' +initialization file for invokeai +''' +import invokeai +from .invokeai_version import __version__ __app_id__= 'invoke-ai/InvokeAI' __app_name__= 'InvokeAI' +# copy these attributes into the invokeai namespace +setattr(invokeai,'__version__',__version__) +setattr(invokeai,'__app_id__',__app_id__) +setattr(invokeai,'__app_name__',__app_name__) def _ignore_xformers_triton_message_on_windows(): import logging diff --git a/ldm/invoke/_version.py b/invokeai/version/invokeai_version.py similarity index 100% rename from ldm/invoke/_version.py rename to invokeai/version/invokeai_version.py diff --git a/ldm/generate.py b/ldm/generate.py index 536a7f2df8..4bce177258 100644 --- a/ldm/generate.py +++ b/ldm/generate.py @@ -25,19 +25,17 @@ from omegaconf import OmegaConf from PIL import Image, ImageOps from pytorch_lightning import logging, seed_everything -import invokeai.backend.ldm.conditioning - -from invokeai.backend.ldm.models import (ModelManager,DDIMSampler, KSampler, PLMSSampler) +from invokeai.backend import ModelManager +from invokeai.backend.prompting import get_uc_and_c_and_ec +from invokeai.backend.stable_diffusion import (DDIMSampler, KSampler, PLMSSampler) from invokeai.backend.generator import infill_methods -from ldm.invoke.args import metadata_from_png -from invokeai.backend.ldm.concepts_lib import HuggingFaceConceptsLibrary -from invokeai.backend.ldm.conditioning import get_uc_and_c_and_ec -from invokeai.backend.ldm.devices import choose_precision, choose_torch_device +from invokeai.backend.stable_diffusion.concepts_lib import HuggingFaceConceptsLibrary +from invokeai.backend.devices import choose_precision, choose_torch_device +from invokeai.backend.image_util import InitImageResizer, PngWriter, Txt2Mask + from ldm.invoke.globals import Globals, global_cache_dir -from ldm.invoke.image_util import InitImageResizer -from ldm.invoke.pngwriter import PngWriter +from ldm.invoke.args import metadata_from_png from ldm.invoke.seamless import configure_model_padding -from ldm.invoke.txt2mask import Txt2Mask def fix_func(orig): if hasattr(torch.backends, "mps") and torch.backends.mps.is_available(): diff --git a/ldm/invoke/CLI.py b/ldm/invoke/CLI.py index 16f64e3bd1..80442cffd0 100644 --- a/ldm/invoke/CLI.py +++ b/ldm/invoke/CLI.py @@ -16,19 +16,18 @@ if sys.platform == "darwin": import pyparsing # type: ignore -import ldm.invoke +import invokeai.version from ..generate import Generate from .args import (Args, dream_cmd_from_png, metadata_dumps, metadata_from_png) -from invokeai.backend.generator import PipelineIntermediateState +from invokeai.backend.stable_diffusion import PipelineIntermediateState +from invokeai.backend.image_util import make_grid, PngWriter, retrieve_metadata, write_metadata +from invokeai.backend import ModelManager from .globals import Globals -from .image_util import make_grid from .log import write_log -from invokeai.backend.ldm.models import ModelManager -from .pngwriter import PngWriter, retrieve_metadata, write_metadata from .readline import Completer, get_completer -from invokeai.backend.ldm.util import url_attachment_name +from invokeai.backend.util import url_attachment_name # global used in multiple functions (fix) infile = None @@ -75,7 +74,7 @@ def main(): opt, FileNotFoundError(f"The file {config_file} could not be found.") ) - print(f">> {ldm.invoke.__app_name__}, version {ldm.invoke.__version__}") + print(f">> {invokeai.__app_name__}, version {invokeai.__version__}") print(f'>> InvokeAI runtime directory is "{Globals.root}"') # loading here to avoid long delays on startup diff --git a/ldm/invoke/app/services/image_storage.py b/ldm/invoke/app/services/image_storage.py index 03227d870b..fa6a85dfbe 100644 --- a/ldm/invoke/app/services/image_storage.py +++ b/ldm/invoke/app/services/image_storage.py @@ -8,7 +8,7 @@ from pathlib import Path from queue import Queue from typing import Dict from PIL.Image import Image -from ...pngwriter import PngWriter +from invokeai.backend.image_util import PngWriter class ImageType(str, Enum): diff --git a/ldm/invoke/args.py b/ldm/invoke/args.py index 17bb8005cb..d661409d18 100644 --- a/ldm/invoke/args.py +++ b/ldm/invoke/args.py @@ -95,15 +95,15 @@ from argparse import Namespace from pathlib import Path from typing import List -import ldm.invoke -import ldm.invoke.pngwriter -from invokeai.backend.ldm.conditioning import split_weighted_subprompts +from invokeai.backend.image_util import retrieve_metadata +import invokeai.version from ldm.invoke.globals import Globals +from invokeai.backend.prompting import split_weighted_subprompts -APP_ID = ldm.invoke.__app_id__ -APP_NAME = ldm.invoke.__app_name__ -APP_VERSION = ldm.invoke.__version__ +APP_ID = invokeai.version.__app_id__ +APP_NAME = invokeai.version.__app_name__ +APP_VERSION = invokeai.version.__version__ SAMPLER_CHOICES = [ 'ddim', @@ -182,7 +182,7 @@ class Args(object): # and intercept --version request switches = self._arg_parser.parse_args(sysargs) if switches.version: - print(f'{ldm.invoke.__app_name__} {ldm.invoke.__version__}') + print(f'{APP_NAME} {APP_VERSION}') sys.exit(0) print('* Initializing, be patient...') @@ -1170,8 +1170,8 @@ def metadata_dumps(opt, 'model' : 'stable diffusion', 'model_id' : opt.model, 'model_hash' : model_hash, - 'app_id' : ldm.invoke.__app_id__, - 'app_version' : ldm.invoke.__version__, + 'app_id' : APP_ID, + 'app_version' : APP_VERSION, } # # add some RFC266 fields that are generated internally, and not as @@ -1242,7 +1242,7 @@ def args_from_png(png_file_path) -> list[Args]: data. ''' try: - meta = ldm.invoke.pngwriter.retrieve_metadata(png_file_path) + meta = retrieve_metadata(png_file_path) except AttributeError: return [legacy_metadata_load({},png_file_path)] diff --git a/ldm/invoke/config/model_install.py b/ldm/invoke/config/model_install.py index 9dd22d2ac7..bdffe61a55 100644 --- a/ldm/invoke/config/model_install.py +++ b/ldm/invoke/config/model_install.py @@ -22,7 +22,7 @@ from npyscreen import widget from omegaconf import OmegaConf from shutil import get_terminal_size -from invokeai.backend.ldm.devices import choose_precision, choose_torch_device +from invokeai.backend.devices import choose_precision, choose_torch_device from ..globals import Globals, global_config_dir from .model_install_backend import (Dataset_path, default_config_file, default_dataset, get_root, diff --git a/ldm/invoke/config/model_install_backend.py b/ldm/invoke/config/model_install_backend.py index c50e5ebc3c..d281ffbd73 100644 --- a/ldm/invoke/config/model_install_backend.py +++ b/ldm/invoke/config/model_install_backend.py @@ -18,9 +18,9 @@ from tqdm import tqdm from typing import List import invokeai.configs as configs -from invokeai.backend.generator import StableDiffusionGeneratorPipeline +from invokeai.backend.stable_diffusion import StableDiffusionGeneratorPipeline from ..globals import Globals, global_cache_dir, global_config_dir -from invokeai.backend.ldm.models import ModelManager +from invokeai.backend import ModelManager warnings.filterwarnings("ignore") diff --git a/ldm/invoke/merge_diffusers.py b/ldm/invoke/merge_diffusers.py index 28abb5d432..10496d5b57 100644 --- a/ldm/invoke/merge_diffusers.py +++ b/ldm/invoke/merge_diffusers.py @@ -23,7 +23,7 @@ from omegaconf import OmegaConf from ldm.invoke.config.widgets import FloatTitleSlider from ldm.invoke.globals import (Globals, global_cache_dir, global_config_file, global_models_dir, global_set_root) -from invokeai.backend.ldm.models import ModelManager +from invokeai.backend import ModelManager DEST_MERGED_MODEL_DIR = "merged_models" diff --git a/ldm/invoke/readline.py b/ldm/invoke/readline.py index a605358a9b..7fe74fc953 100644 --- a/ldm/invoke/readline.py +++ b/ldm/invoke/readline.py @@ -12,8 +12,8 @@ import os import re import atexit from ldm.invoke.args import Args -from invokeai.backend.ldm.concepts_lib import HuggingFaceConceptsLibrary from ldm.invoke.globals import Globals +from invokeai.backend.stable_diffusion import HuggingFaceConceptsLibrary # ---------------readline utilities--------------------- try: diff --git a/pyproject.toml b/pyproject.toml index 22e6f9282c..3e219172cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -125,15 +125,15 @@ dependencies = [ "Discord" = "https://discord.gg/ZmtBAhwWhy" [tool.setuptools.dynamic] -version = { attr = "ldm.invoke.__version__" } +version = { attr = "invokeai.version.__version__" } [tool.setuptools.packages.find] "where" = ["."] "include" = [ - "invokeai.assets.web*", + "invokeai.assets.web*","invokeai.version*", "invokeai.generator*","invokeai.backend*", "invokeai.frontend.dist*", "invokeai.configs*", - "ldm*" + "ldm*", ] [tool.setuptools.package-data] diff --git a/tests/test_textual_inversion.py b/tests/test_textual_inversion.py index 54b396489e..53d2f2bfe6 100644 --- a/tests/test_textual_inversion.py +++ b/tests/test_textual_inversion.py @@ -4,7 +4,7 @@ from typing import Union import torch -from ldm.modules.textual_inversion_manager import TextualInversionManager +from invokeai.backend.stable_diffusion import TextualInversionManager KNOWN_WORDS = ['a', 'b', 'c']