mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
almost all of backend migrated; restoration next
This commit is contained in:
parent
1a7371ea17
commit
3f0b0f3250
5
.gitignore
vendored
5
.gitignore
vendored
@ -213,11 +213,6 @@ gfpgan/
|
|||||||
# config file (will be created by installer)
|
# config file (will be created by installer)
|
||||||
configs/models.yaml
|
configs/models.yaml
|
||||||
|
|
||||||
# weights (will be created by installer)
|
|
||||||
# models/ldm/stable-diffusion-v1/*.ckpt
|
|
||||||
# models/clipseg
|
|
||||||
# models/gfpgan
|
|
||||||
|
|
||||||
# ignore initfile
|
# ignore initfile
|
||||||
.invokeai
|
.invokeai
|
||||||
|
|
||||||
|
@ -11,10 +11,10 @@ if [[ -v "VIRTUAL_ENV" ]]; then
|
|||||||
exit -1
|
exit -1
|
||||||
fi
|
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=""
|
PATCH=""
|
||||||
VERSION="v${VERSION}${PATCH}"
|
VERSION="v${VERSION}${PATCH}"
|
||||||
LATEST_TAG="v2.3-latest"
|
LATEST_TAG="v3.0-latest"
|
||||||
|
|
||||||
echo Building installer for version $VERSION
|
echo Building installer for version $VERSION
|
||||||
echo "Be certain that you're in the 'installer' directory before continuing."
|
echo "Be certain that you're in the 'installer' directory before continuing."
|
||||||
|
@ -3,5 +3,6 @@ Initialization file for invokeai.backend
|
|||||||
'''
|
'''
|
||||||
# this is causing circular import issues
|
# this is causing circular import issues
|
||||||
# from .invoke_ai_web_server import InvokeAIWebServer
|
# from .invoke_ai_web_server import InvokeAIWebServer
|
||||||
|
from .model_manager import ModelManager
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,5 +2,4 @@
|
|||||||
Initialization file for the invokeai.generator package
|
Initialization file for the invokeai.generator package
|
||||||
'''
|
'''
|
||||||
from .base import Generator
|
from .base import Generator
|
||||||
from .diffusers_pipeline import PipelineIntermediateState, StableDiffusionGeneratorPipeline
|
|
||||||
from .inpaint import infill_methods
|
from .inpaint import infill_methods
|
||||||
|
@ -22,8 +22,8 @@ from pytorch_lightning import seed_everything
|
|||||||
from tqdm import trange
|
from tqdm import trange
|
||||||
|
|
||||||
import invokeai.assets.web as web_assets
|
import invokeai.assets.web as web_assets
|
||||||
from ..ldm.models.diffusion.ddpm import DiffusionWrapper
|
from ..stable_diffusion.diffusion.ddpm import DiffusionWrapper
|
||||||
from ..ldm.util import rand_perlin_2d
|
from ..util import rand_perlin_2d
|
||||||
|
|
||||||
downsampling = 8
|
downsampling = 8
|
||||||
CAUTION_IMG = 'caution.png'
|
CAUTION_IMG = 'caution.png'
|
||||||
|
@ -6,8 +6,10 @@ import torch
|
|||||||
from diffusers import logging
|
from diffusers import logging
|
||||||
|
|
||||||
from .base import Generator
|
from .base import Generator
|
||||||
from .diffusers_pipeline import StableDiffusionGeneratorPipeline, ConditioningData
|
from ..stable_diffusion import (StableDiffusionGeneratorPipeline,
|
||||||
from ..ldm.models.diffusion import PostprocessingSettings
|
ConditioningData,
|
||||||
|
PostprocessingSettings
|
||||||
|
)
|
||||||
|
|
||||||
class Img2Img(Generator):
|
class Img2Img(Generator):
|
||||||
def __init__(self, model, precision):
|
def __init__(self, model, precision):
|
||||||
|
@ -11,11 +11,12 @@ import numpy as np
|
|||||||
import torch
|
import torch
|
||||||
from PIL import Image, ImageFilter, ImageOps, ImageChops
|
from PIL import Image, ImageFilter, ImageOps, ImageChops
|
||||||
|
|
||||||
from .diffusers_pipeline import image_resized_to_grid_as_tensor, StableDiffusionGeneratorPipeline, \
|
from ..stable_diffusion.diffusers_pipeline import (image_resized_to_grid_as_tensor,
|
||||||
ConditioningData
|
StableDiffusionGeneratorPipeline,
|
||||||
|
ConditioningData
|
||||||
|
)
|
||||||
from .img2img import Img2Img
|
from .img2img import Img2Img
|
||||||
from ldm.invoke.patchmatch import PatchMatch
|
from ..image_util import PatchMatch, debug_image
|
||||||
from ..ldm.util import debug_image
|
|
||||||
|
|
||||||
|
|
||||||
def infill_methods()->list[str]:
|
def infill_methods()->list[str]:
|
||||||
|
@ -5,8 +5,10 @@ import PIL.Image
|
|||||||
import torch
|
import torch
|
||||||
|
|
||||||
from .base import Generator
|
from .base import Generator
|
||||||
from .diffusers_pipeline import StableDiffusionGeneratorPipeline, ConditioningData
|
from ..stable_diffusion import (PostprocessingSettings,
|
||||||
from ..ldm.models import PostprocessingSettings
|
StableDiffusionGeneratorPipeline,
|
||||||
|
ConditioningData
|
||||||
|
)
|
||||||
|
|
||||||
class Txt2Img(Generator):
|
class Txt2Img(Generator):
|
||||||
def __init__(self, model, precision):
|
def __init__(self, model, precision):
|
||||||
|
28
invokeai/backend/image_util/__init__.py
Normal file
28
invokeai/backend/image_util/__init__.py
Normal file
@ -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
|
||||||
|
|
||||||
|
|
@ -23,16 +23,21 @@ from werkzeug.utils import secure_filename
|
|||||||
from invokeai.backend.modules.get_canvas_generation_mode import (
|
from invokeai.backend.modules.get_canvas_generation_mode import (
|
||||||
get_canvas_generation_mode,
|
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.generate import Generate
|
||||||
from ldm.invoke.args import Args, APP_ID, APP_VERSION, calculate_init_img_hash
|
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,
|
from ldm.invoke.globals import ( Globals, global_converted_ckpts_dir,
|
||||||
global_models_dir
|
global_models_dir
|
||||||
)
|
)
|
||||||
from ldm.invoke.merge_diffusers import merge_diffusion_models
|
from ldm.invoke.merge_diffusers import merge_diffusion_models
|
||||||
from ldm.invoke.pngwriter import PngWriter, retrieve_metadata
|
|
||||||
|
|
||||||
# Loading Arguments
|
# Loading Arguments
|
||||||
opt = Args()
|
opt = Args()
|
||||||
|
@ -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
|
|
@ -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
|
|
@ -31,15 +31,14 @@ from omegaconf import OmegaConf
|
|||||||
from omegaconf.dictconfig import DictConfig
|
from omegaconf.dictconfig import DictConfig
|
||||||
from picklescan.scanner import scan_file_path
|
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 ldm.invoke.globals import Globals, global_cache_dir
|
||||||
from ..util import (
|
from .util import (
|
||||||
ask_user,
|
ask_user,
|
||||||
download_with_resume,
|
download_with_resume,
|
||||||
url_attachment_name,
|
url_attachment_name,
|
||||||
)
|
)
|
||||||
from ...generator.diffusers_pipeline import StableDiffusionGeneratorPipeline
|
from .stable_diffusion import StableDiffusionGeneratorPipeline
|
||||||
|
|
||||||
|
|
||||||
class SDLegacyType(Enum):
|
class SDLegacyType(Enum):
|
||||||
V1 = 1
|
V1 = 1
|
7
invokeai/backend/prompting/__init__.py
Normal file
7
invokeai/backend/prompting/__init__.py
Normal file
@ -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)
|
@ -13,8 +13,8 @@ from transformers import CLIPTokenizer, CLIPTextModel
|
|||||||
|
|
||||||
from compel import Compel
|
from compel import Compel
|
||||||
from compel.prompt_parser import FlattenedPrompt, Blend, Fragment, CrossAttentionControlSubstitute, PromptParser
|
from compel.prompt_parser import FlattenedPrompt, Blend, Fragment, CrossAttentionControlSubstitute, PromptParser
|
||||||
from .devices import torch_dtype
|
from ..devices import torch_dtype
|
||||||
from .models import InvokeAIDiffuserComponent
|
from ..stable_diffusion import InvokeAIDiffuserComponent
|
||||||
from ldm.invoke.globals import Globals
|
from ldm.invoke.globals import Globals
|
||||||
|
|
||||||
def get_tokenizer(model) -> CLIPTokenizer:
|
def get_tokenizer(model) -> CLIPTokenizer:
|
16
invokeai/backend/stable_diffusion/__init__.py
Normal file
16
invokeai/backend/stable_diffusion/__init__.py
Normal file
@ -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
|
||||||
|
)
|
@ -7,7 +7,7 @@ import torch.nn.functional as F
|
|||||||
from torch import nn, einsum
|
from torch import nn, einsum
|
||||||
from einops import rearrange, repeat
|
from einops import rearrange, repeat
|
||||||
|
|
||||||
from ..models.diffusion import InvokeAICrossAttentionMixin
|
from .diffusion import InvokeAICrossAttentionMixin
|
||||||
from .diffusionmodules.util import checkpoint
|
from .diffusionmodules.util import checkpoint
|
||||||
|
|
||||||
def exists(val):
|
def exists(val):
|
@ -5,8 +5,8 @@ from contextlib import contextmanager
|
|||||||
|
|
||||||
from taming.modules.vqvae.quantize import VectorQuantizer2 as VectorQuantizer
|
from taming.modules.vqvae.quantize import VectorQuantizer2 as VectorQuantizer
|
||||||
|
|
||||||
from ..modules.diffusionmodules.model import Encoder, Decoder
|
from .diffusionmodules.model import Encoder, Decoder
|
||||||
from ..modules.distributions.distributions import (
|
from .distributions.distributions import (
|
||||||
DiagonalGaussianDistribution,
|
DiagonalGaussianDistribution,
|
||||||
)
|
)
|
||||||
|
|
@ -27,11 +27,10 @@ from transformers import CLIPFeatureExtractor, CLIPTextModel, CLIPTokenizer
|
|||||||
from typing_extensions import ParamSpec
|
from typing_extensions import ParamSpec
|
||||||
|
|
||||||
from ldm.invoke.globals import Globals
|
from ldm.invoke.globals import Globals
|
||||||
from ..ldm.models.diffusion import InvokeAIDiffuserComponent, PostprocessingSettings
|
from ..stable_diffusion.diffusion import InvokeAIDiffuserComponent, PostprocessingSettings, AttentionMapSaver
|
||||||
from ..ldm.modules.textual_inversion_manager import TextualInversionManager
|
from ..stable_diffusion.textual_inversion_manager import TextualInversionManager
|
||||||
from ..ldm.devices import normalize_device, CPU_DEVICE
|
from ..stable_diffusion.offloading import LazilyLoadedModelGroup, FullyLoadedModelGroup, ModelGroup
|
||||||
from ..ldm.offloading import LazilyLoadedModelGroup, FullyLoadedModelGroup, ModelGroup
|
from ..devices import normalize_device, CPU_DEVICE
|
||||||
from ..ldm.models.diffusion import AttentionMapSaver
|
|
||||||
from compel import EmbeddingsProvider
|
from compel import EmbeddingsProvider
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
@ -3,7 +3,7 @@
|
|||||||
import torch
|
import torch
|
||||||
from .shared_invokeai_diffusion import InvokeAIDiffuserComponent
|
from .shared_invokeai_diffusion import InvokeAIDiffuserComponent
|
||||||
from .sampler import Sampler
|
from .sampler import Sampler
|
||||||
from ...modules.diffusionmodules.util import noise_like
|
from ..diffusionmodules.util import noise_like
|
||||||
|
|
||||||
class DDIMSampler(Sampler):
|
class DDIMSampler(Sampler):
|
||||||
def __init__(self, model, schedule='linear', device=None, **kwargs):
|
def __init__(self, model, schedule='linear', device=None, **kwargs):
|
@ -22,7 +22,7 @@ from pytorch_lightning.utilities.distributed import rank_zero_only
|
|||||||
from omegaconf import ListConfig
|
from omegaconf import ListConfig
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
from ...modules.textual_inversion_manager import TextualInversionManager
|
from ..textual_inversion_manager import TextualInversionManager
|
||||||
from ...util import (
|
from ...util import (
|
||||||
log_txt_as_img,
|
log_txt_as_img,
|
||||||
exists,
|
exists,
|
||||||
@ -33,8 +33,8 @@ from ...util import (
|
|||||||
count_params,
|
count_params,
|
||||||
instantiate_from_config,
|
instantiate_from_config,
|
||||||
)
|
)
|
||||||
from ...modules.ema import LitEma
|
from ..ema import LitEma
|
||||||
from ...modules.distributions.distributions import (
|
from ..distributions.distributions import (
|
||||||
normal_kl,
|
normal_kl,
|
||||||
DiagonalGaussianDistribution,
|
DiagonalGaussianDistribution,
|
||||||
)
|
)
|
||||||
@ -43,7 +43,7 @@ from ..autoencoder import (
|
|||||||
IdentityFirstStage,
|
IdentityFirstStage,
|
||||||
AutoencoderKL,
|
AutoencoderKL,
|
||||||
)
|
)
|
||||||
from ...modules.diffusionmodules.util import (
|
from ..diffusionmodules.util import (
|
||||||
make_beta_schedule,
|
make_beta_schedule,
|
||||||
extract_into_tensor,
|
extract_into_tensor,
|
||||||
noise_like,
|
noise_like,
|
@ -7,7 +7,7 @@ from functools import partial
|
|||||||
from ...devices import choose_torch_device
|
from ...devices import choose_torch_device
|
||||||
from .shared_invokeai_diffusion import InvokeAIDiffuserComponent
|
from .shared_invokeai_diffusion import InvokeAIDiffuserComponent
|
||||||
from .sampler import Sampler
|
from .sampler import Sampler
|
||||||
from ...modules.diffusionmodules.util import noise_like
|
from ..diffusionmodules.util import noise_like
|
||||||
|
|
||||||
|
|
||||||
class PLMSSampler(Sampler):
|
class PLMSSampler(Sampler):
|
@ -10,7 +10,7 @@ from functools import partial
|
|||||||
from ...devices import choose_torch_device
|
from ...devices import choose_torch_device
|
||||||
from .shared_invokeai_diffusion import InvokeAIDiffuserComponent
|
from .shared_invokeai_diffusion import InvokeAIDiffuserComponent
|
||||||
|
|
||||||
from ...modules.diffusionmodules.util import (
|
from ..diffusionmodules.util import (
|
||||||
make_ddim_sampling_parameters,
|
make_ddim_sampling_parameters,
|
||||||
make_ddim_timesteps,
|
make_ddim_timesteps,
|
||||||
noise_like,
|
noise_like,
|
Before Width: | Height: | Size: 431 KiB After Width: | Height: | Size: 431 KiB |
@ -9,7 +9,7 @@ from picklescan.scanner import scan_file_path
|
|||||||
from transformers import CLIPTextModel, CLIPTokenizer
|
from transformers import CLIPTextModel, CLIPTokenizer
|
||||||
|
|
||||||
from compel.embeddings_provider import BaseTextualInversionManager
|
from compel.embeddings_provider import BaseTextualInversionManager
|
||||||
from ..concepts_lib import HuggingFaceConceptsLibrary
|
from .concepts_lib import HuggingFaceConceptsLibrary
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
@ -17,7 +17,6 @@ from tqdm import tqdm
|
|||||||
|
|
||||||
from .devices import torch_dtype
|
from .devices import torch_dtype
|
||||||
|
|
||||||
|
|
||||||
def log_txt_as_img(wh, xc, size=10):
|
def log_txt_as_img(wh, xc, size=10):
|
||||||
# wh a tuple of (width, height)
|
# wh a tuple of (width, height)
|
||||||
# xc a list of captions to plot
|
# xc a list of captions to plot
|
||||||
@ -280,22 +279,6 @@ def ask_user(question: str, answers: list):
|
|||||||
return valid_response
|
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:
|
def download_with_resume(url: str, dest: Path, access_token: str = None) -> Path:
|
||||||
'''
|
'''
|
@ -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_id__= 'invoke-ai/InvokeAI'
|
||||||
__app_name__= '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():
|
def _ignore_xformers_triton_message_on_windows():
|
||||||
import logging
|
import logging
|
@ -25,19 +25,17 @@ from omegaconf import OmegaConf
|
|||||||
from PIL import Image, ImageOps
|
from PIL import Image, ImageOps
|
||||||
from pytorch_lightning import logging, seed_everything
|
from pytorch_lightning import logging, seed_everything
|
||||||
|
|
||||||
import invokeai.backend.ldm.conditioning
|
from invokeai.backend import ModelManager
|
||||||
|
from invokeai.backend.prompting import get_uc_and_c_and_ec
|
||||||
from invokeai.backend.ldm.models import (ModelManager,DDIMSampler, KSampler, PLMSSampler)
|
from invokeai.backend.stable_diffusion import (DDIMSampler, KSampler, PLMSSampler)
|
||||||
from invokeai.backend.generator import infill_methods
|
from invokeai.backend.generator import infill_methods
|
||||||
from ldm.invoke.args import metadata_from_png
|
from invokeai.backend.stable_diffusion.concepts_lib import HuggingFaceConceptsLibrary
|
||||||
from invokeai.backend.ldm.concepts_lib import HuggingFaceConceptsLibrary
|
from invokeai.backend.devices import choose_precision, choose_torch_device
|
||||||
from invokeai.backend.ldm.conditioning import get_uc_and_c_and_ec
|
from invokeai.backend.image_util import InitImageResizer, PngWriter, Txt2Mask
|
||||||
from invokeai.backend.ldm.devices import choose_precision, choose_torch_device
|
|
||||||
from ldm.invoke.globals import Globals, global_cache_dir
|
from ldm.invoke.globals import Globals, global_cache_dir
|
||||||
from ldm.invoke.image_util import InitImageResizer
|
from ldm.invoke.args import metadata_from_png
|
||||||
from ldm.invoke.pngwriter import PngWriter
|
|
||||||
from ldm.invoke.seamless import configure_model_padding
|
from ldm.invoke.seamless import configure_model_padding
|
||||||
from ldm.invoke.txt2mask import Txt2Mask
|
|
||||||
|
|
||||||
def fix_func(orig):
|
def fix_func(orig):
|
||||||
if hasattr(torch.backends, "mps") and torch.backends.mps.is_available():
|
if hasattr(torch.backends, "mps") and torch.backends.mps.is_available():
|
||||||
|
@ -16,19 +16,18 @@ if sys.platform == "darwin":
|
|||||||
|
|
||||||
import pyparsing # type: ignore
|
import pyparsing # type: ignore
|
||||||
|
|
||||||
import ldm.invoke
|
import invokeai.version
|
||||||
|
|
||||||
from ..generate import Generate
|
from ..generate import Generate
|
||||||
from .args import (Args, dream_cmd_from_png, metadata_dumps,
|
from .args import (Args, dream_cmd_from_png, metadata_dumps,
|
||||||
metadata_from_png)
|
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 .globals import Globals
|
||||||
from .image_util import make_grid
|
|
||||||
from .log import write_log
|
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 .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)
|
# global used in multiple functions (fix)
|
||||||
infile = None
|
infile = None
|
||||||
@ -75,7 +74,7 @@ def main():
|
|||||||
opt, FileNotFoundError(f"The file {config_file} could not be found.")
|
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}"')
|
print(f'>> InvokeAI runtime directory is "{Globals.root}"')
|
||||||
|
|
||||||
# loading here to avoid long delays on startup
|
# loading here to avoid long delays on startup
|
||||||
|
@ -8,7 +8,7 @@ from pathlib import Path
|
|||||||
from queue import Queue
|
from queue import Queue
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
from PIL.Image import Image
|
from PIL.Image import Image
|
||||||
from ...pngwriter import PngWriter
|
from invokeai.backend.image_util import PngWriter
|
||||||
|
|
||||||
|
|
||||||
class ImageType(str, Enum):
|
class ImageType(str, Enum):
|
||||||
|
@ -95,15 +95,15 @@ from argparse import Namespace
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
import ldm.invoke
|
from invokeai.backend.image_util import retrieve_metadata
|
||||||
import ldm.invoke.pngwriter
|
import invokeai.version
|
||||||
from invokeai.backend.ldm.conditioning import split_weighted_subprompts
|
|
||||||
|
|
||||||
from ldm.invoke.globals import Globals
|
from ldm.invoke.globals import Globals
|
||||||
|
from invokeai.backend.prompting import split_weighted_subprompts
|
||||||
|
|
||||||
APP_ID = ldm.invoke.__app_id__
|
APP_ID = invokeai.version.__app_id__
|
||||||
APP_NAME = ldm.invoke.__app_name__
|
APP_NAME = invokeai.version.__app_name__
|
||||||
APP_VERSION = ldm.invoke.__version__
|
APP_VERSION = invokeai.version.__version__
|
||||||
|
|
||||||
SAMPLER_CHOICES = [
|
SAMPLER_CHOICES = [
|
||||||
'ddim',
|
'ddim',
|
||||||
@ -182,7 +182,7 @@ class Args(object):
|
|||||||
# and intercept --version request
|
# and intercept --version request
|
||||||
switches = self._arg_parser.parse_args(sysargs)
|
switches = self._arg_parser.parse_args(sysargs)
|
||||||
if switches.version:
|
if switches.version:
|
||||||
print(f'{ldm.invoke.__app_name__} {ldm.invoke.__version__}')
|
print(f'{APP_NAME} {APP_VERSION}')
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
print('* Initializing, be patient...')
|
print('* Initializing, be patient...')
|
||||||
@ -1170,8 +1170,8 @@ def metadata_dumps(opt,
|
|||||||
'model' : 'stable diffusion',
|
'model' : 'stable diffusion',
|
||||||
'model_id' : opt.model,
|
'model_id' : opt.model,
|
||||||
'model_hash' : model_hash,
|
'model_hash' : model_hash,
|
||||||
'app_id' : ldm.invoke.__app_id__,
|
'app_id' : APP_ID,
|
||||||
'app_version' : ldm.invoke.__version__,
|
'app_version' : APP_VERSION,
|
||||||
}
|
}
|
||||||
|
|
||||||
# # add some RFC266 fields that are generated internally, and not as
|
# # 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.
|
data.
|
||||||
'''
|
'''
|
||||||
try:
|
try:
|
||||||
meta = ldm.invoke.pngwriter.retrieve_metadata(png_file_path)
|
meta = retrieve_metadata(png_file_path)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
return [legacy_metadata_load({},png_file_path)]
|
return [legacy_metadata_load({},png_file_path)]
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ from npyscreen import widget
|
|||||||
from omegaconf import OmegaConf
|
from omegaconf import OmegaConf
|
||||||
from shutil import get_terminal_size
|
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 ..globals import Globals, global_config_dir
|
||||||
from .model_install_backend import (Dataset_path, default_config_file,
|
from .model_install_backend import (Dataset_path, default_config_file,
|
||||||
default_dataset, get_root,
|
default_dataset, get_root,
|
||||||
|
@ -18,9 +18,9 @@ from tqdm import tqdm
|
|||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
import invokeai.configs as configs
|
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 ..globals import Globals, global_cache_dir, global_config_dir
|
||||||
from invokeai.backend.ldm.models import ModelManager
|
from invokeai.backend import ModelManager
|
||||||
|
|
||||||
warnings.filterwarnings("ignore")
|
warnings.filterwarnings("ignore")
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ from omegaconf import OmegaConf
|
|||||||
from ldm.invoke.config.widgets import FloatTitleSlider
|
from ldm.invoke.config.widgets import FloatTitleSlider
|
||||||
from ldm.invoke.globals import (Globals, global_cache_dir, global_config_file,
|
from ldm.invoke.globals import (Globals, global_cache_dir, global_config_file,
|
||||||
global_models_dir, global_set_root)
|
global_models_dir, global_set_root)
|
||||||
from invokeai.backend.ldm.models import ModelManager
|
from invokeai.backend import ModelManager
|
||||||
|
|
||||||
DEST_MERGED_MODEL_DIR = "merged_models"
|
DEST_MERGED_MODEL_DIR = "merged_models"
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@ import os
|
|||||||
import re
|
import re
|
||||||
import atexit
|
import atexit
|
||||||
from ldm.invoke.args import Args
|
from ldm.invoke.args import Args
|
||||||
from invokeai.backend.ldm.concepts_lib import HuggingFaceConceptsLibrary
|
|
||||||
from ldm.invoke.globals import Globals
|
from ldm.invoke.globals import Globals
|
||||||
|
from invokeai.backend.stable_diffusion import HuggingFaceConceptsLibrary
|
||||||
|
|
||||||
# ---------------readline utilities---------------------
|
# ---------------readline utilities---------------------
|
||||||
try:
|
try:
|
||||||
|
@ -125,15 +125,15 @@ dependencies = [
|
|||||||
"Discord" = "https://discord.gg/ZmtBAhwWhy"
|
"Discord" = "https://discord.gg/ZmtBAhwWhy"
|
||||||
|
|
||||||
[tool.setuptools.dynamic]
|
[tool.setuptools.dynamic]
|
||||||
version = { attr = "ldm.invoke.__version__" }
|
version = { attr = "invokeai.version.__version__" }
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
"where" = ["."]
|
"where" = ["."]
|
||||||
"include" = [
|
"include" = [
|
||||||
"invokeai.assets.web*",
|
"invokeai.assets.web*","invokeai.version*",
|
||||||
"invokeai.generator*","invokeai.backend*",
|
"invokeai.generator*","invokeai.backend*",
|
||||||
"invokeai.frontend.dist*", "invokeai.configs*",
|
"invokeai.frontend.dist*", "invokeai.configs*",
|
||||||
"ldm*"
|
"ldm*",
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.setuptools.package-data]
|
[tool.setuptools.package-data]
|
||||||
|
@ -4,7 +4,7 @@ from typing import Union
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
from ldm.modules.textual_inversion_manager import TextualInversionManager
|
from invokeai.backend.stable_diffusion import TextualInversionManager
|
||||||
|
|
||||||
|
|
||||||
KNOWN_WORDS = ['a', 'b', 'c']
|
KNOWN_WORDS = ['a', 'b', 'c']
|
||||||
|
Loading…
Reference in New Issue
Block a user