From 1d449097cca8f79a99edf2f9d0df980229895c65 Mon Sep 17 00:00:00 2001 From: Ryan Dick Date: Wed, 3 Jul 2024 12:20:35 -0400 Subject: [PATCH] Apply ruff rule to disallow all relative imports. --- invokeai/app/api_app.py | 15 ++++--- invokeai/app/invocations/collections.py | 5 +-- invokeai/app/invocations/compel.py | 5 +-- .../controlnet_image_processors.py | 9 +++- invokeai/app/invocations/cv.py | 6 +-- invokeai/app/invocations/image.py | 3 +- invokeai/app/invocations/infill.py | 8 ++-- invokeai/app/invocations/math.py | 3 +- invokeai/app/invocations/model.py | 11 +++-- invokeai/app/invocations/noise.py | 8 +--- invokeai/app/invocations/param_easing.py | 5 +-- invokeai/app/invocations/primitives.py | 8 +--- invokeai/app/invocations/prompt.py | 5 +-- invokeai/app/invocations/sdxl.py | 10 +---- invokeai/app/invocations/strings.py | 12 ++---- invokeai/app/invocations/upscale.py | 6 +-- .../board_image_records_sqlite.py | 3 +- .../board_images/board_images_default.py | 3 +- .../board_records/board_records_base.py | 3 +- .../board_records/board_records_sqlite.py | 11 +++-- invokeai/app/services/boards/boards_base.py | 3 +- .../app/services/boards/boards_default.py | 6 +-- .../bulk_download/bulk_download_default.py | 3 +- invokeai/app/services/config/__init__.py | 3 +- invokeai/app/services/download/__init__.py | 4 +- .../app/services/download/download_default.py | 11 +++-- .../services/events/events_fastapievents.py | 3 +- .../services/image_files/image_files_disk.py | 9 ++-- .../image_records/image_records_base.py | 8 +++- .../image_records/image_records_sqlite.py | 11 +++-- .../app/services/images/images_default.py | 5 +-- invokeai/app/services/invocation_services.py | 41 +++++++++---------- .../invocation_stats_default.py | 9 ++-- invokeai/app/services/invoker.py | 2 +- .../model_images/model_images_default.py | 9 ++-- .../app/services/model_install/__init__.py | 8 ++-- .../model_install/model_install_default.py | 21 +++++----- invokeai/app/services/model_load/__init__.py | 4 +- .../services/model_load/model_load_default.py | 3 +- .../app/services/model_manager/__init__.py | 3 +- .../model_manager/model_manager_default.py | 3 +- .../model_records/model_records_sql.py | 17 ++++---- invokeai/app/services/names/names_default.py | 3 +- .../session_processor_default.py | 8 ++-- invokeai/app/services/urls/urls_default.py | 2 +- invokeai/backend/image_util/__init__.py | 11 +++-- .../image_util/basicsr/rrdbnet_arch.py | 2 +- .../image_util/depth_anything/model/dpt.py | 2 +- .../image_util/dw_openpose/wholebody.py | 5 +-- invokeai/backend/ip_adapter/ip_adapter.py | 3 +- invokeai/backend/lora.py | 3 +- invokeai/backend/model_manager/__init__.py | 8 ++-- .../backend/model_manager/load/__init__.py | 8 ++-- .../load/model_cache/model_cache_default.py | 10 +++-- .../load/model_cache/model_locker.py | 7 +++- .../load/model_loader_registry.py | 3 +- .../load/model_loaders/controlnet.py | 3 +- .../model_manager/load/model_loaders/onnx.py | 3 +- .../load/model_loaders/stable_diffusion.py | 3 +- .../model_manager/load/model_loaders/vae.py | 3 +- invokeai/backend/model_manager/merge.py | 10 +---- .../model_manager/metadata/__init__.py | 4 +- .../model_manager/metadata/fetch/__init__.py | 4 +- .../metadata/fetch/huggingface.py | 3 +- invokeai/backend/model_manager/probe.py | 7 ++-- invokeai/backend/model_patcher.py | 9 ++-- invokeai/backend/stable_diffusion/__init__.py | 9 ++-- .../stable_diffusion/diffusion/__init__.py | 4 +- .../stable_diffusion/schedulers/__init__.py | 2 +- invokeai/backend/textual_inversion.py | 2 +- invokeai/backend/util/__init__.py | 4 +- invokeai/version/__init__.py | 2 +- pyproject.toml | 2 +- tests/test_graph_execution_state.py | 15 ++++--- tests/test_node_graph.py | 3 +- tests/test_session_queue.py | 3 +- 76 files changed, 221 insertions(+), 274 deletions(-) diff --git a/invokeai/app/api_app.py b/invokeai/app/api_app.py index 654279536c..dca0bc139d 100644 --- a/invokeai/app/api_app.py +++ b/invokeai/app/api_app.py @@ -20,14 +20,9 @@ from torch.backends.mps import is_available as is_mps_available # noinspection PyUnresolvedReferences import invokeai.backend.util.hotfixes # noqa: F401 (monkeypatching on import) import invokeai.frontend.web as web_dir +from invokeai.app.api.dependencies import ApiDependencies from invokeai.app.api.no_cache_staticfiles import NoCacheStaticFiles -from invokeai.app.services.config.config_default import get_config -from invokeai.app.util.custom_openapi import get_openapi_func -from invokeai.backend.util.devices import TorchDevice -from invokeai.backend.util.logging import InvokeAILogger - -from .api.dependencies import ApiDependencies -from .api.routers import ( +from invokeai.app.api.routers import ( app_info, board_images, boards, @@ -38,7 +33,11 @@ from .api.routers import ( utilities, workflows, ) -from .api.sockets import SocketIO +from invokeai.app.api.sockets import SocketIO +from invokeai.app.services.config.config_default import get_config +from invokeai.app.util.custom_openapi import get_openapi_func +from invokeai.backend.util.devices import TorchDevice +from invokeai.backend.util.logging import InvokeAILogger app_config = get_config() diff --git a/invokeai/app/invocations/collections.py b/invokeai/app/invocations/collections.py index e02291980f..bd3dedb3f8 100644 --- a/invokeai/app/invocations/collections.py +++ b/invokeai/app/invocations/collections.py @@ -4,13 +4,12 @@ import numpy as np from pydantic import ValidationInfo, field_validator +from invokeai.app.invocations.baseinvocation import BaseInvocation, invocation +from invokeai.app.invocations.fields import InputField from invokeai.app.invocations.primitives import IntegerCollectionOutput from invokeai.app.services.shared.invocation_context import InvocationContext from invokeai.app.util.misc import SEED_MAX -from .baseinvocation import BaseInvocation, invocation -from .fields import InputField - @invocation( "range", title="Integer Range", tags=["collection", "integer", "range"], category="collections", version="1.0.0" diff --git a/invokeai/app/invocations/compel.py b/invokeai/app/invocations/compel.py index 1e78e10d38..fffb09e654 100644 --- a/invokeai/app/invocations/compel.py +++ b/invokeai/app/invocations/compel.py @@ -5,6 +5,7 @@ from compel import Compel, ReturnedEmbeddingsType from compel.prompt_parser import Blend, Conjunction, CrossAttentionControlSubstitute, FlattenedPrompt, Fragment from transformers import CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer +from invokeai.app.invocations.baseinvocation import BaseInvocation, BaseInvocationOutput, invocation, invocation_output from invokeai.app.invocations.fields import ( ConditioningField, FieldDescriptions, @@ -14,6 +15,7 @@ from invokeai.app.invocations.fields import ( TensorField, UIComponent, ) +from invokeai.app.invocations.model import CLIPField from invokeai.app.invocations.primitives import ConditioningOutput from invokeai.app.services.shared.invocation_context import InvocationContext from invokeai.app.util.ti_utils import generate_ti_list @@ -26,9 +28,6 @@ from invokeai.backend.stable_diffusion.diffusion.conditioning_data import ( ) from invokeai.backend.util.devices import TorchDevice -from .baseinvocation import BaseInvocation, BaseInvocationOutput, invocation, invocation_output -from .model import CLIPField - # unconditioned: Optional[torch.Tensor] diff --git a/invokeai/app/invocations/controlnet_image_processors.py b/invokeai/app/invocations/controlnet_image_processors.py index c0b332f27b..497d07e7cf 100644 --- a/invokeai/app/invocations/controlnet_image_processors.py +++ b/invokeai/app/invocations/controlnet_image_processors.py @@ -22,6 +22,13 @@ from controlnet_aux.util import HWC3, ade_palette from PIL import Image from pydantic import BaseModel, Field, field_validator, model_validator +from invokeai.app.invocations.baseinvocation import ( + BaseInvocation, + BaseInvocationOutput, + Classification, + invocation, + invocation_output, +) from invokeai.app.invocations.fields import ( FieldDescriptions, ImageField, @@ -45,8 +52,6 @@ from invokeai.backend.image_util.lineart_anime import LineartAnimeProcessor from invokeai.backend.image_util.util import np_to_pil, pil_to_np from invokeai.backend.util.devices import TorchDevice -from .baseinvocation import BaseInvocation, BaseInvocationOutput, Classification, invocation, invocation_output - class ControlField(BaseModel): image: ImageField = Field(description="The control image") diff --git a/invokeai/app/invocations/cv.py b/invokeai/app/invocations/cv.py index a7c394deb2..f7951ccfeb 100644 --- a/invokeai/app/invocations/cv.py +++ b/invokeai/app/invocations/cv.py @@ -5,13 +5,11 @@ import cv2 as cv import numpy from PIL import Image, ImageOps -from invokeai.app.invocations.fields import ImageField +from invokeai.app.invocations.baseinvocation import BaseInvocation, invocation +from invokeai.app.invocations.fields import ImageField, InputField, WithBoard, WithMetadata from invokeai.app.invocations.primitives import ImageOutput from invokeai.app.services.shared.invocation_context import InvocationContext -from .baseinvocation import BaseInvocation, invocation -from .fields import InputField, WithBoard, WithMetadata - @invocation("cv_inpaint", title="OpenCV Inpaint", tags=["opencv", "inpaint"], category="inpaint", version="1.3.1") class CvInpaintInvocation(BaseInvocation, WithMetadata, WithBoard): diff --git a/invokeai/app/invocations/image.py b/invokeai/app/invocations/image.py index 65e7ce5e06..a551f8df8a 100644 --- a/invokeai/app/invocations/image.py +++ b/invokeai/app/invocations/image.py @@ -6,6 +6,7 @@ import cv2 import numpy from PIL import Image, ImageChops, ImageFilter, ImageOps +from invokeai.app.invocations.baseinvocation import BaseInvocation, Classification, invocation from invokeai.app.invocations.constants import IMAGE_MODES from invokeai.app.invocations.fields import ( ColorField, @@ -21,8 +22,6 @@ from invokeai.app.services.shared.invocation_context import InvocationContext from invokeai.backend.image_util.invisible_watermark import InvisibleWatermark from invokeai.backend.image_util.safety_checker import SafetyChecker -from .baseinvocation import BaseInvocation, Classification, invocation - @invocation("show_image", title="Show Image", tags=["image"], category="image", version="1.0.1") class ShowImageInvocation(BaseInvocation): diff --git a/invokeai/app/invocations/infill.py b/invokeai/app/invocations/infill.py index 7e1a2ee322..3314d72620 100644 --- a/invokeai/app/invocations/infill.py +++ b/invokeai/app/invocations/infill.py @@ -3,7 +3,9 @@ from typing import Literal, get_args from PIL import Image -from invokeai.app.invocations.fields import ColorField, ImageField +from invokeai.app.invocations.baseinvocation import BaseInvocation, invocation +from invokeai.app.invocations.fields import ColorField, ImageField, InputField, WithBoard, WithMetadata +from invokeai.app.invocations.image import PIL_RESAMPLING_MAP, PIL_RESAMPLING_MODES from invokeai.app.invocations.primitives import ImageOutput from invokeai.app.services.shared.invocation_context import InvocationContext from invokeai.app.util.misc import SEED_MAX @@ -14,10 +16,6 @@ from invokeai.backend.image_util.infill_methods.patchmatch import PatchMatch, in from invokeai.backend.image_util.infill_methods.tile import infill_tile from invokeai.backend.util.logging import InvokeAILogger -from .baseinvocation import BaseInvocation, invocation -from .fields import InputField, WithBoard, WithMetadata -from .image import PIL_RESAMPLING_MAP, PIL_RESAMPLING_MODES - logger = InvokeAILogger.get_logger() diff --git a/invokeai/app/invocations/math.py b/invokeai/app/invocations/math.py index dad000d411..5d3988031b 100644 --- a/invokeai/app/invocations/math.py +++ b/invokeai/app/invocations/math.py @@ -5,12 +5,11 @@ from typing import Literal import numpy as np from pydantic import ValidationInfo, field_validator +from invokeai.app.invocations.baseinvocation import BaseInvocation, invocation from invokeai.app.invocations.fields import FieldDescriptions, InputField from invokeai.app.invocations.primitives import FloatOutput, IntegerOutput from invokeai.app.services.shared.invocation_context import InvocationContext -from .baseinvocation import BaseInvocation, invocation - @invocation("add", title="Add Integers", tags=["math", "add"], category="math", version="1.0.1") class AddInvocation(BaseInvocation): diff --git a/invokeai/app/invocations/model.py b/invokeai/app/invocations/model.py index 94a6136fcb..c0d067c0a7 100644 --- a/invokeai/app/invocations/model.py +++ b/invokeai/app/invocations/model.py @@ -3,18 +3,17 @@ from typing import List, Optional from pydantic import BaseModel, Field -from invokeai.app.invocations.fields import FieldDescriptions, Input, InputField, OutputField, UIType -from invokeai.app.services.shared.invocation_context import InvocationContext -from invokeai.app.shared.models import FreeUConfig -from invokeai.backend.model_manager.config import AnyModelConfig, BaseModelType, ModelType, SubModelType - -from .baseinvocation import ( +from invokeai.app.invocations.baseinvocation import ( BaseInvocation, BaseInvocationOutput, Classification, invocation, invocation_output, ) +from invokeai.app.invocations.fields import FieldDescriptions, Input, InputField, OutputField, UIType +from invokeai.app.services.shared.invocation_context import InvocationContext +from invokeai.app.shared.models import FreeUConfig +from invokeai.backend.model_manager.config import AnyModelConfig, BaseModelType, ModelType, SubModelType class ModelIdentifierField(BaseModel): diff --git a/invokeai/app/invocations/noise.py b/invokeai/app/invocations/noise.py index 3e628ef1ba..1d3ff3a29c 100644 --- a/invokeai/app/invocations/noise.py +++ b/invokeai/app/invocations/noise.py @@ -4,19 +4,13 @@ import torch from pydantic import field_validator +from invokeai.app.invocations.baseinvocation import BaseInvocation, BaseInvocationOutput, invocation, invocation_output from invokeai.app.invocations.constants import LATENT_SCALE_FACTOR from invokeai.app.invocations.fields import FieldDescriptions, InputField, LatentsField, OutputField from invokeai.app.services.shared.invocation_context import InvocationContext from invokeai.app.util.misc import SEED_MAX from invokeai.backend.util.devices import TorchDevice -from .baseinvocation import ( - BaseInvocation, - BaseInvocationOutput, - invocation, - invocation_output, -) - """ Utilities """ diff --git a/invokeai/app/invocations/param_easing.py b/invokeai/app/invocations/param_easing.py index 0e590f4e2b..3e785ef545 100644 --- a/invokeai/app/invocations/param_easing.py +++ b/invokeai/app/invocations/param_easing.py @@ -39,12 +39,11 @@ from easing_functions import ( ) from matplotlib.ticker import MaxNLocator +from invokeai.app.invocations.baseinvocation import BaseInvocation, invocation +from invokeai.app.invocations.fields import InputField from invokeai.app.invocations.primitives import FloatCollectionOutput from invokeai.app.services.shared.invocation_context import InvocationContext -from .baseinvocation import BaseInvocation, invocation -from .fields import InputField - @invocation( "float_range", diff --git a/invokeai/app/invocations/primitives.py b/invokeai/app/invocations/primitives.py index 28f72fb377..e5056e3775 100644 --- a/invokeai/app/invocations/primitives.py +++ b/invokeai/app/invocations/primitives.py @@ -4,6 +4,7 @@ from typing import Optional import torch +from invokeai.app.invocations.baseinvocation import BaseInvocation, BaseInvocationOutput, invocation, invocation_output from invokeai.app.invocations.constants import LATENT_SCALE_FACTOR from invokeai.app.invocations.fields import ( ColorField, @@ -21,13 +22,6 @@ from invokeai.app.invocations.fields import ( from invokeai.app.services.images.images_common import ImageDTO from invokeai.app.services.shared.invocation_context import InvocationContext -from .baseinvocation import ( - BaseInvocation, - BaseInvocationOutput, - invocation, - invocation_output, -) - """ Primitives: Boolean, Integer, Float, String, Image, Latents, Conditioning, Color - primitive nodes diff --git a/invokeai/app/invocations/prompt.py b/invokeai/app/invocations/prompt.py index 64a06d2f18..48eec0ac0e 100644 --- a/invokeai/app/invocations/prompt.py +++ b/invokeai/app/invocations/prompt.py @@ -5,12 +5,11 @@ import numpy as np from dynamicprompts.generators import CombinatorialPromptGenerator, RandomPromptGenerator from pydantic import field_validator +from invokeai.app.invocations.baseinvocation import BaseInvocation, invocation +from invokeai.app.invocations.fields import InputField, UIComponent from invokeai.app.invocations.primitives import StringCollectionOutput from invokeai.app.services.shared.invocation_context import InvocationContext -from .baseinvocation import BaseInvocation, invocation -from .fields import InputField, UIComponent - @invocation( "dynamic_prompt", diff --git a/invokeai/app/invocations/sdxl.py b/invokeai/app/invocations/sdxl.py index 1c0817cb92..8eed158a61 100644 --- a/invokeai/app/invocations/sdxl.py +++ b/invokeai/app/invocations/sdxl.py @@ -1,15 +1,9 @@ +from invokeai.app.invocations.baseinvocation import BaseInvocation, BaseInvocationOutput, invocation, invocation_output from invokeai.app.invocations.fields import FieldDescriptions, InputField, OutputField, UIType +from invokeai.app.invocations.model import CLIPField, ModelIdentifierField, UNetField, VAEField from invokeai.app.services.shared.invocation_context import InvocationContext from invokeai.backend.model_manager import SubModelType -from .baseinvocation import ( - BaseInvocation, - BaseInvocationOutput, - invocation, - invocation_output, -) -from .model import CLIPField, ModelIdentifierField, UNetField, VAEField - @invocation_output("sdxl_model_loader_output") class SDXLModelLoaderOutput(BaseInvocationOutput): diff --git a/invokeai/app/invocations/strings.py b/invokeai/app/invocations/strings.py index 46ef35cbbf..2b6bf300b9 100644 --- a/invokeai/app/invocations/strings.py +++ b/invokeai/app/invocations/strings.py @@ -2,17 +2,11 @@ import re +from invokeai.app.invocations.baseinvocation import BaseInvocation, BaseInvocationOutput, invocation, invocation_output +from invokeai.app.invocations.fields import InputField, OutputField, UIComponent +from invokeai.app.invocations.primitives import StringOutput from invokeai.app.services.shared.invocation_context import InvocationContext -from .baseinvocation import ( - BaseInvocation, - BaseInvocationOutput, - invocation, - invocation_output, -) -from .fields import InputField, OutputField, UIComponent -from .primitives import StringOutput - @invocation_output("string_pos_neg_output") class StringPosNegOutput(BaseInvocationOutput): diff --git a/invokeai/app/invocations/upscale.py b/invokeai/app/invocations/upscale.py index f93060f8d3..e7b3968aec 100644 --- a/invokeai/app/invocations/upscale.py +++ b/invokeai/app/invocations/upscale.py @@ -6,15 +6,13 @@ import numpy as np from PIL import Image from pydantic import ConfigDict -from invokeai.app.invocations.fields import ImageField +from invokeai.app.invocations.baseinvocation import BaseInvocation, invocation +from invokeai.app.invocations.fields import ImageField, InputField, WithBoard, WithMetadata from invokeai.app.invocations.primitives import ImageOutput from invokeai.app.services.shared.invocation_context import InvocationContext from invokeai.backend.image_util.basicsr.rrdbnet_arch import RRDBNet from invokeai.backend.image_util.realesrgan.realesrgan import RealESRGAN -from .baseinvocation import BaseInvocation, invocation -from .fields import InputField, WithBoard, WithMetadata - # TODO: Populate this from disk? # TODO: Use model manager to load? ESRGAN_MODELS = Literal[ diff --git a/invokeai/app/services/board_image_records/board_image_records_sqlite.py b/invokeai/app/services/board_image_records/board_image_records_sqlite.py index cde810a739..33ac76b06f 100644 --- a/invokeai/app/services/board_image_records/board_image_records_sqlite.py +++ b/invokeai/app/services/board_image_records/board_image_records_sqlite.py @@ -2,12 +2,11 @@ import sqlite3 import threading from typing import Optional, cast +from invokeai.app.services.board_image_records.board_image_records_base import BoardImageRecordStorageBase from invokeai.app.services.image_records.image_records_common import ImageRecord, deserialize_image_record from invokeai.app.services.shared.pagination import OffsetPaginatedResults from invokeai.app.services.shared.sqlite.sqlite_database import SqliteDatabase -from .board_image_records_base import BoardImageRecordStorageBase - class SqliteBoardImageRecordStorage(BoardImageRecordStorageBase): _conn: sqlite3.Connection diff --git a/invokeai/app/services/board_images/board_images_default.py b/invokeai/app/services/board_images/board_images_default.py index 85e478619c..6a564f5a91 100644 --- a/invokeai/app/services/board_images/board_images_default.py +++ b/invokeai/app/services/board_images/board_images_default.py @@ -1,9 +1,8 @@ from typing import Optional +from invokeai.app.services.board_images.board_images_base import BoardImagesServiceABC from invokeai.app.services.invoker import Invoker -from .board_images_base import BoardImagesServiceABC - class BoardImagesService(BoardImagesServiceABC): __invoker: Invoker diff --git a/invokeai/app/services/board_records/board_records_base.py b/invokeai/app/services/board_records/board_records_base.py index 9d065b3750..9d16dacf60 100644 --- a/invokeai/app/services/board_records/board_records_base.py +++ b/invokeai/app/services/board_records/board_records_base.py @@ -1,9 +1,8 @@ from abc import ABC, abstractmethod +from invokeai.app.services.board_records.board_records_common import BoardChanges, BoardRecord from invokeai.app.services.shared.pagination import OffsetPaginatedResults -from .board_records_common import BoardChanges, BoardRecord - class BoardRecordStorageBase(ABC): """Low-level service responsible for interfacing with the board record store.""" diff --git a/invokeai/app/services/board_records/board_records_sqlite.py b/invokeai/app/services/board_records/board_records_sqlite.py index 9d81e2f1e7..c64e060b95 100644 --- a/invokeai/app/services/board_records/board_records_sqlite.py +++ b/invokeai/app/services/board_records/board_records_sqlite.py @@ -2,12 +2,8 @@ import sqlite3 import threading from typing import Union, cast -from invokeai.app.services.shared.pagination import OffsetPaginatedResults -from invokeai.app.services.shared.sqlite.sqlite_database import SqliteDatabase -from invokeai.app.util.misc import uuid_string - -from .board_records_base import BoardRecordStorageBase -from .board_records_common import ( +from invokeai.app.services.board_records.board_records_base import BoardRecordStorageBase +from invokeai.app.services.board_records.board_records_common import ( BoardChanges, BoardRecord, BoardRecordDeleteException, @@ -15,6 +11,9 @@ from .board_records_common import ( BoardRecordSaveException, deserialize_board_record, ) +from invokeai.app.services.shared.pagination import OffsetPaginatedResults +from invokeai.app.services.shared.sqlite.sqlite_database import SqliteDatabase +from invokeai.app.util.misc import uuid_string class SqliteBoardRecordStorage(BoardRecordStorageBase): diff --git a/invokeai/app/services/boards/boards_base.py b/invokeai/app/services/boards/boards_base.py index fddd5a7954..3c2d148cb9 100644 --- a/invokeai/app/services/boards/boards_base.py +++ b/invokeai/app/services/boards/boards_base.py @@ -1,10 +1,9 @@ from abc import ABC, abstractmethod from invokeai.app.services.board_records.board_records_common import BoardChanges +from invokeai.app.services.boards.boards_common import BoardDTO from invokeai.app.services.shared.pagination import OffsetPaginatedResults -from .boards_common import BoardDTO - class BoardServiceABC(ABC): """High-level service for board management.""" diff --git a/invokeai/app/services/boards/boards_default.py b/invokeai/app/services/boards/boards_default.py index 6457aee1d2..97fd3059a9 100644 --- a/invokeai/app/services/boards/boards_default.py +++ b/invokeai/app/services/boards/boards_default.py @@ -1,11 +1,9 @@ from invokeai.app.services.board_records.board_records_common import BoardChanges -from invokeai.app.services.boards.boards_common import BoardDTO +from invokeai.app.services.boards.boards_base import BoardServiceABC +from invokeai.app.services.boards.boards_common import BoardDTO, board_record_to_dto from invokeai.app.services.invoker import Invoker from invokeai.app.services.shared.pagination import OffsetPaginatedResults -from .boards_base import BoardServiceABC -from .boards_common import board_record_to_dto - class BoardService(BoardServiceABC): __invoker: Invoker diff --git a/invokeai/app/services/bulk_download/bulk_download_default.py b/invokeai/app/services/bulk_download/bulk_download_default.py index d4bf059b8f..4ebbd10d4f 100644 --- a/invokeai/app/services/bulk_download/bulk_download_default.py +++ b/invokeai/app/services/bulk_download/bulk_download_default.py @@ -4,6 +4,7 @@ from typing import Optional, Union from zipfile import ZipFile from invokeai.app.services.board_records.board_records_common import BoardRecordNotFoundException +from invokeai.app.services.bulk_download.bulk_download_base import BulkDownloadBase from invokeai.app.services.bulk_download.bulk_download_common import ( DEFAULT_BULK_DOWNLOAD_ID, BulkDownloadException, @@ -15,8 +16,6 @@ from invokeai.app.services.images.images_common import ImageDTO from invokeai.app.services.invoker import Invoker from invokeai.app.util.misc import uuid_string -from .bulk_download_base import BulkDownloadBase - class BulkDownloadService(BulkDownloadBase): def start(self, invoker: Invoker) -> None: diff --git a/invokeai/app/services/config/__init__.py b/invokeai/app/services/config/__init__.py index 126692f08a..df1acbf104 100644 --- a/invokeai/app/services/config/__init__.py +++ b/invokeai/app/services/config/__init__.py @@ -1,7 +1,6 @@ """Init file for InvokeAI configure package.""" from invokeai.app.services.config.config_common import PagingArgumentParser - -from .config_default import InvokeAIAppConfig, get_config +from invokeai.app.services.config.config_default import InvokeAIAppConfig, get_config __all__ = ["InvokeAIAppConfig", "get_config", "PagingArgumentParser"] diff --git a/invokeai/app/services/download/__init__.py b/invokeai/app/services/download/__init__.py index 33b0025809..48ded7d549 100644 --- a/invokeai/app/services/download/__init__.py +++ b/invokeai/app/services/download/__init__.py @@ -1,13 +1,13 @@ """Init file for download queue.""" -from .download_base import ( +from invokeai.app.services.download.download_base import ( DownloadJob, DownloadJobStatus, DownloadQueueServiceBase, MultiFileDownloadJob, UnknownJobIDException, ) -from .download_default import DownloadQueueService, TqdmProgress +from invokeai.app.services.download.download_default import DownloadQueueService, TqdmProgress __all__ = [ "DownloadJob", diff --git a/invokeai/app/services/download/download_default.py b/invokeai/app/services/download/download_default.py index 73022e7d93..b97f61657c 100644 --- a/invokeai/app/services/download/download_default.py +++ b/invokeai/app/services/download/download_default.py @@ -16,12 +16,7 @@ from requests import HTTPError from tqdm import tqdm from invokeai.app.services.config import InvokeAIAppConfig, get_config -from invokeai.app.services.events.events_base import EventServiceBase -from invokeai.app.util.misc import get_iso_timestamp -from invokeai.backend.model_manager.metadata import RemoteModelFile -from invokeai.backend.util.logging import InvokeAILogger - -from .download_base import ( +from invokeai.app.services.download.download_base import ( DownloadEventHandler, DownloadExceptionHandler, DownloadJob, @@ -33,6 +28,10 @@ from .download_base import ( ServiceInactiveException, UnknownJobIDException, ) +from invokeai.app.services.events.events_base import EventServiceBase +from invokeai.app.util.misc import get_iso_timestamp +from invokeai.backend.model_manager.metadata import RemoteModelFile +from invokeai.backend.util.logging import InvokeAILogger # Maximum number of bytes to download during each call to requests.iter_content() DOWNLOAD_CHUNK_SIZE = 100000 diff --git a/invokeai/app/services/events/events_fastapievents.py b/invokeai/app/services/events/events_fastapievents.py index 8279d3bb34..d514a06b67 100644 --- a/invokeai/app/services/events/events_fastapievents.py +++ b/invokeai/app/services/events/events_fastapievents.py @@ -6,12 +6,11 @@ from queue import Empty, Queue from fastapi_events.dispatcher import dispatch +from invokeai.app.services.events.events_base import EventServiceBase from invokeai.app.services.events.events_common import ( EventBase, ) -from .events_base import EventServiceBase - class FastAPIEventService(EventServiceBase): def __init__(self, event_handler_id: int) -> None: diff --git a/invokeai/app/services/image_files/image_files_disk.py b/invokeai/app/services/image_files/image_files_disk.py index 15d0be31f8..95ab052520 100644 --- a/invokeai/app/services/image_files/image_files_disk.py +++ b/invokeai/app/services/image_files/image_files_disk.py @@ -7,12 +7,15 @@ from PIL import Image, PngImagePlugin from PIL.Image import Image as PILImageType from send2trash import send2trash +from invokeai.app.services.image_files.image_files_base import ImageFileStorageBase +from invokeai.app.services.image_files.image_files_common import ( + ImageFileDeleteException, + ImageFileNotFoundException, + ImageFileSaveException, +) from invokeai.app.services.invoker import Invoker from invokeai.app.util.thumbnails import get_thumbnail_name, make_thumbnail -from .image_files_base import ImageFileStorageBase -from .image_files_common import ImageFileDeleteException, ImageFileNotFoundException, ImageFileSaveException - class DiskImageFileStorage(ImageFileStorageBase): """Stores images on disk""" diff --git a/invokeai/app/services/image_records/image_records_base.py b/invokeai/app/services/image_records/image_records_base.py index 94e884e549..1211c9762c 100644 --- a/invokeai/app/services/image_records/image_records_base.py +++ b/invokeai/app/services/image_records/image_records_base.py @@ -3,11 +3,15 @@ from datetime import datetime from typing import Optional from invokeai.app.invocations.fields import MetadataField +from invokeai.app.services.image_records.image_records_common import ( + ImageCategory, + ImageRecord, + ImageRecordChanges, + ResourceOrigin, +) from invokeai.app.services.shared.pagination import OffsetPaginatedResults from invokeai.app.services.shared.sqlite.sqlite_common import SQLiteDirection -from .image_records_common import ImageCategory, ImageRecord, ImageRecordChanges, ResourceOrigin - class ImageRecordStorageBase(ABC): """Low-level service responsible for interfacing with the image record store.""" diff --git a/invokeai/app/services/image_records/image_records_sqlite.py b/invokeai/app/services/image_records/image_records_sqlite.py index 82e7ffae9d..b0c2155a18 100644 --- a/invokeai/app/services/image_records/image_records_sqlite.py +++ b/invokeai/app/services/image_records/image_records_sqlite.py @@ -4,12 +4,8 @@ from datetime import datetime from typing import Optional, Union, cast from invokeai.app.invocations.fields import MetadataField, MetadataFieldValidator -from invokeai.app.services.shared.pagination import OffsetPaginatedResults -from invokeai.app.services.shared.sqlite.sqlite_common import SQLiteDirection -from invokeai.app.services.shared.sqlite.sqlite_database import SqliteDatabase - -from .image_records_base import ImageRecordStorageBase -from .image_records_common import ( +from invokeai.app.services.image_records.image_records_base import ImageRecordStorageBase +from invokeai.app.services.image_records.image_records_common import ( IMAGE_DTO_COLS, ImageCategory, ImageRecord, @@ -20,6 +16,9 @@ from .image_records_common import ( ResourceOrigin, deserialize_image_record, ) +from invokeai.app.services.shared.pagination import OffsetPaginatedResults +from invokeai.app.services.shared.sqlite.sqlite_common import SQLiteDirection +from invokeai.app.services.shared.sqlite.sqlite_database import SqliteDatabase class SqliteImageRecordStorage(ImageRecordStorageBase): diff --git a/invokeai/app/services/images/images_default.py b/invokeai/app/services/images/images_default.py index 6cf702cf62..15d950bab8 100644 --- a/invokeai/app/services/images/images_default.py +++ b/invokeai/app/services/images/images_default.py @@ -19,13 +19,12 @@ from invokeai.app.services.image_records.image_records_common import ( InvalidOriginException, ResourceOrigin, ) +from invokeai.app.services.images.images_base import ImageServiceABC +from invokeai.app.services.images.images_common import ImageDTO, image_record_to_dto from invokeai.app.services.invoker import Invoker from invokeai.app.services.shared.pagination import OffsetPaginatedResults from invokeai.app.services.shared.sqlite.sqlite_common import SQLiteDirection -from .images_base import ImageServiceABC -from .images_common import ImageDTO, image_record_to_dto - class ImageService(ImageServiceABC): __invoker: Invoker diff --git a/invokeai/app/services/invocation_services.py b/invokeai/app/services/invocation_services.py index f4fce6098f..90ca613074 100644 --- a/invokeai/app/services/invocation_services.py +++ b/invokeai/app/services/invocation_services.py @@ -10,29 +10,28 @@ if TYPE_CHECKING: import torch + from invokeai.app.services.board_image_records.board_image_records_base import BoardImageRecordStorageBase + from invokeai.app.services.board_images.board_images_base import BoardImagesServiceABC + from invokeai.app.services.board_records.board_records_base import BoardRecordStorageBase + from invokeai.app.services.boards.boards_base import BoardServiceABC + from invokeai.app.services.bulk_download.bulk_download_base import BulkDownloadBase + from invokeai.app.services.config import InvokeAIAppConfig + from invokeai.app.services.download import DownloadQueueServiceBase + from invokeai.app.services.events.events_base import EventServiceBase + from invokeai.app.services.image_files.image_files_base import ImageFileStorageBase + from invokeai.app.services.image_records.image_records_base import ImageRecordStorageBase + from invokeai.app.services.images.images_base import ImageServiceABC + from invokeai.app.services.invocation_cache.invocation_cache_base import InvocationCacheBase + from invokeai.app.services.invocation_stats.invocation_stats_base import InvocationStatsServiceBase + from invokeai.app.services.model_images.model_images_base import ModelImageFileStorageBase + from invokeai.app.services.model_manager.model_manager_base import ModelManagerServiceBase + from invokeai.app.services.names.names_base import NameServiceBase + from invokeai.app.services.session_processor.session_processor_base import SessionProcessorBase + from invokeai.app.services.session_queue.session_queue_base import SessionQueueBase + from invokeai.app.services.urls.urls_base import UrlServiceBase + from invokeai.app.services.workflow_records.workflow_records_base import WorkflowRecordsStorageBase from invokeai.backend.stable_diffusion.diffusion.conditioning_data import ConditioningFieldData - from .board_image_records.board_image_records_base import BoardImageRecordStorageBase - from .board_images.board_images_base import BoardImagesServiceABC - from .board_records.board_records_base import BoardRecordStorageBase - from .boards.boards_base import BoardServiceABC - from .bulk_download.bulk_download_base import BulkDownloadBase - from .config import InvokeAIAppConfig - from .download import DownloadQueueServiceBase - from .events.events_base import EventServiceBase - from .image_files.image_files_base import ImageFileStorageBase - from .image_records.image_records_base import ImageRecordStorageBase - from .images.images_base import ImageServiceABC - from .invocation_cache.invocation_cache_base import InvocationCacheBase - from .invocation_stats.invocation_stats_base import InvocationStatsServiceBase - from .model_images.model_images_base import ModelImageFileStorageBase - from .model_manager.model_manager_base import ModelManagerServiceBase - from .names.names_base import NameServiceBase - from .session_processor.session_processor_base import SessionProcessorBase - from .session_queue.session_queue_base import SessionQueueBase - from .urls.urls_base import UrlServiceBase - from .workflow_records.workflow_records_base import WorkflowRecordsStorageBase - class InvocationServices: """Services that can be used by invocations""" diff --git a/invokeai/app/services/invocation_stats/invocation_stats_default.py b/invokeai/app/services/invocation_stats/invocation_stats_default.py index 5a41f1f5d6..5533657dc7 100644 --- a/invokeai/app/services/invocation_stats/invocation_stats_default.py +++ b/invokeai/app/services/invocation_stats/invocation_stats_default.py @@ -9,11 +9,8 @@ import torch import invokeai.backend.util.logging as logger from invokeai.app.invocations.baseinvocation import BaseInvocation -from invokeai.app.services.invoker import Invoker -from invokeai.backend.model_manager.load.model_cache import CacheStats - -from .invocation_stats_base import InvocationStatsServiceBase -from .invocation_stats_common import ( +from invokeai.app.services.invocation_stats.invocation_stats_base import InvocationStatsServiceBase +from invokeai.app.services.invocation_stats.invocation_stats_common import ( GESStatsNotFoundError, GraphExecutionStats, GraphExecutionStatsSummary, @@ -22,6 +19,8 @@ from .invocation_stats_common import ( NodeExecutionStats, NodeExecutionStatsSummary, ) +from invokeai.app.services.invoker import Invoker +from invokeai.backend.model_manager.load.model_cache import CacheStats # Size of 1GB in bytes. GB = 2**30 diff --git a/invokeai/app/services/invoker.py b/invokeai/app/services/invoker.py index 527afb37f4..64f83725a1 100644 --- a/invokeai/app/services/invoker.py +++ b/invokeai/app/services/invoker.py @@ -1,7 +1,7 @@ # Copyright (c) 2022 Kyle Schouviller (https://github.com/kyle0654) -from .invocation_services import InvocationServices +from invokeai.app.services.invocation_services import InvocationServices class Invoker: diff --git a/invokeai/app/services/model_images/model_images_default.py b/invokeai/app/services/model_images/model_images_default.py index 0ab79df3ed..36f04a93b5 100644 --- a/invokeai/app/services/model_images/model_images_default.py +++ b/invokeai/app/services/model_images/model_images_default.py @@ -5,15 +5,14 @@ from PIL.Image import Image as PILImageType from send2trash import send2trash from invokeai.app.services.invoker import Invoker -from invokeai.app.util.misc import uuid_string -from invokeai.app.util.thumbnails import make_thumbnail - -from .model_images_base import ModelImageFileStorageBase -from .model_images_common import ( +from invokeai.app.services.model_images.model_images_base import ModelImageFileStorageBase +from invokeai.app.services.model_images.model_images_common import ( ModelImageFileDeleteException, ModelImageFileNotFoundException, ModelImageFileSaveException, ) +from invokeai.app.util.misc import uuid_string +from invokeai.app.util.thumbnails import make_thumbnail class ModelImageFileStorageDisk(ModelImageFileStorageBase): diff --git a/invokeai/app/services/model_install/__init__.py b/invokeai/app/services/model_install/__init__.py index 941485a134..d96e86cbfe 100644 --- a/invokeai/app/services/model_install/__init__.py +++ b/invokeai/app/services/model_install/__init__.py @@ -1,9 +1,7 @@ """Initialization file for model install service package.""" -from .model_install_base import ( - ModelInstallServiceBase, -) -from .model_install_common import ( +from invokeai.app.services.model_install.model_install_base import ModelInstallServiceBase +from invokeai.app.services.model_install.model_install_common import ( HFModelSource, InstallStatus, LocalModelSource, @@ -12,7 +10,7 @@ from .model_install_common import ( UnknownInstallJobException, URLModelSource, ) -from .model_install_default import ModelInstallService +from invokeai.app.services.model_install.model_install_default import ModelInstallService __all__ = [ "ModelInstallServiceBase", diff --git a/invokeai/app/services/model_install/model_install_default.py b/invokeai/app/services/model_install/model_install_default.py index 9ad6424053..5e19a349ad 100644 --- a/invokeai/app/services/model_install/model_install_default.py +++ b/invokeai/app/services/model_install/model_install_default.py @@ -23,6 +23,16 @@ from invokeai.app.services.download import DownloadQueueServiceBase, MultiFileDo from invokeai.app.services.events.events_base import EventServiceBase from invokeai.app.services.invoker import Invoker from invokeai.app.services.model_install.model_install_base import ModelInstallServiceBase +from invokeai.app.services.model_install.model_install_common import ( + MODEL_SOURCE_TO_TYPE_MAP, + HFModelSource, + InstallStatus, + LocalModelSource, + ModelInstallJob, + ModelSource, + StringLikeSource, + URLModelSource, +) from invokeai.app.services.model_records import DuplicateModelException, ModelRecordServiceBase from invokeai.app.services.model_records.model_records_base import ModelRecordChanges from invokeai.backend.model_manager.config import ( @@ -47,17 +57,6 @@ from invokeai.backend.util.catch_sigint import catch_sigint from invokeai.backend.util.devices import TorchDevice from invokeai.backend.util.util import slugify -from .model_install_common import ( - MODEL_SOURCE_TO_TYPE_MAP, - HFModelSource, - InstallStatus, - LocalModelSource, - ModelInstallJob, - ModelSource, - StringLikeSource, - URLModelSource, -) - TMPDIR_PREFIX = "tmpinstall_" diff --git a/invokeai/app/services/model_load/__init__.py b/invokeai/app/services/model_load/__init__.py index b4a86e9348..4c7e40c8c7 100644 --- a/invokeai/app/services/model_load/__init__.py +++ b/invokeai/app/services/model_load/__init__.py @@ -1,6 +1,6 @@ """Initialization file for model load service module.""" -from .model_load_base import ModelLoadServiceBase -from .model_load_default import ModelLoadService +from invokeai.app.services.model_load.model_load_base import ModelLoadServiceBase +from invokeai.app.services.model_load.model_load_default import ModelLoadService __all__ = ["ModelLoadServiceBase", "ModelLoadService"] diff --git a/invokeai/app/services/model_load/model_load_default.py b/invokeai/app/services/model_load/model_load_default.py index 8eb94616be..be2cc2478a 100644 --- a/invokeai/app/services/model_load/model_load_default.py +++ b/invokeai/app/services/model_load/model_load_default.py @@ -10,6 +10,7 @@ from torch import load as torch_load from invokeai.app.services.config import InvokeAIAppConfig from invokeai.app.services.invoker import Invoker +from invokeai.app.services.model_load.model_load_base import ModelLoadServiceBase from invokeai.backend.model_manager import AnyModel, AnyModelConfig, SubModelType from invokeai.backend.model_manager.load import ( LoadedModel, @@ -22,8 +23,6 @@ from invokeai.backend.model_manager.load.model_loaders.generic_diffusers import from invokeai.backend.util.devices import TorchDevice from invokeai.backend.util.logging import InvokeAILogger -from .model_load_base import ModelLoadServiceBase - class ModelLoadService(ModelLoadServiceBase): """Wrapper around ModelLoaderRegistry.""" diff --git a/invokeai/app/services/model_manager/__init__.py b/invokeai/app/services/model_manager/__init__.py index 5455577266..07c27cee31 100644 --- a/invokeai/app/services/model_manager/__init__.py +++ b/invokeai/app/services/model_manager/__init__.py @@ -1,10 +1,9 @@ """Initialization file for model manager service.""" +from invokeai.app.services.model_manager.model_manager_default import ModelManagerService, ModelManagerServiceBase from invokeai.backend.model_manager import AnyModel, AnyModelConfig, BaseModelType, ModelType, SubModelType from invokeai.backend.model_manager.load import LoadedModel -from .model_manager_default import ModelManagerService, ModelManagerServiceBase - __all__ = [ "ModelManagerServiceBase", "ModelManagerService", diff --git a/invokeai/app/services/model_manager/model_manager_default.py b/invokeai/app/services/model_manager/model_manager_default.py index 7353b98bb4..78f8e09e74 100644 --- a/invokeai/app/services/model_manager/model_manager_default.py +++ b/invokeai/app/services/model_manager/model_manager_default.py @@ -14,13 +14,12 @@ from invokeai.app.services.model_install.model_install_base import ModelInstallS from invokeai.app.services.model_install.model_install_default import ModelInstallService from invokeai.app.services.model_load.model_load_base import ModelLoadServiceBase from invokeai.app.services.model_load.model_load_default import ModelLoadService +from invokeai.app.services.model_manager.model_manager_base import ModelManagerServiceBase from invokeai.app.services.model_records.model_records_base import ModelRecordServiceBase from invokeai.backend.model_manager.load import ModelCache, ModelLoaderRegistry from invokeai.backend.util.devices import TorchDevice from invokeai.backend.util.logging import InvokeAILogger -from .model_manager_base import ModelManagerServiceBase - class ModelManagerService(ModelManagerServiceBase): """ diff --git a/invokeai/app/services/model_records/model_records_sql.py b/invokeai/app/services/model_records/model_records_sql.py index 3abbc662ee..2f9829dad4 100644 --- a/invokeai/app/services/model_records/model_records_sql.py +++ b/invokeai/app/services/model_records/model_records_sql.py @@ -45,6 +45,14 @@ from math import ceil from pathlib import Path from typing import List, Optional, Union +from invokeai.app.services.model_records.model_records_base import ( + DuplicateModelException, + ModelRecordChanges, + ModelRecordOrderBy, + ModelRecordServiceBase, + ModelSummary, + UnknownModelException, +) from invokeai.app.services.shared.pagination import PaginatedResults from invokeai.app.services.shared.sqlite.sqlite_database import SqliteDatabase from invokeai.backend.model_manager.config import ( @@ -55,15 +63,6 @@ from invokeai.backend.model_manager.config import ( ModelType, ) -from .model_records_base import ( - DuplicateModelException, - ModelRecordChanges, - ModelRecordOrderBy, - ModelRecordServiceBase, - ModelSummary, - UnknownModelException, -) - class ModelRecordServiceSQL(ModelRecordServiceBase): """Implementation of the ModelConfigStore ABC using a SQL database.""" diff --git a/invokeai/app/services/names/names_default.py b/invokeai/app/services/names/names_default.py index 104268c8bd..5804a937d6 100644 --- a/invokeai/app/services/names/names_default.py +++ b/invokeai/app/services/names/names_default.py @@ -1,7 +1,6 @@ +from invokeai.app.services.names.names_base import NameServiceBase from invokeai.app.util.misc import uuid_string -from .names_base import NameServiceBase - class SimpleNameService(NameServiceBase): """Creates image names from UUIDs.""" diff --git a/invokeai/app/services/session_processor/session_processor_default.py b/invokeai/app/services/session_processor/session_processor_default.py index 336a17d3d5..e4faaeb911 100644 --- a/invokeai/app/services/session_processor/session_processor_default.py +++ b/invokeai/app/services/session_processor/session_processor_default.py @@ -15,22 +15,22 @@ from invokeai.app.services.events.events_common import ( from invokeai.app.services.invocation_stats.invocation_stats_common import GESStatsNotFoundError from invokeai.app.services.invoker import Invoker from invokeai.app.services.session_processor.session_processor_base import ( + InvocationServices, OnAfterRunNode, OnAfterRunSession, OnBeforeRunNode, OnBeforeRunSession, OnNodeError, OnNonFatalProcessorError, + SessionProcessorBase, + SessionRunnerBase, ) -from invokeai.app.services.session_processor.session_processor_common import CanceledException +from invokeai.app.services.session_processor.session_processor_common import CanceledException, SessionProcessorStatus from invokeai.app.services.session_queue.session_queue_common import SessionQueueItem, SessionQueueItemNotFoundError from invokeai.app.services.shared.graph import NodeInputError from invokeai.app.services.shared.invocation_context import InvocationContextData, build_invocation_context from invokeai.app.util.profiler import Profiler -from .session_processor_base import InvocationServices, SessionProcessorBase, SessionRunnerBase -from .session_processor_common import SessionProcessorStatus - class DefaultSessionRunner(SessionRunnerBase): """Processes a single session's invocations.""" diff --git a/invokeai/app/services/urls/urls_default.py b/invokeai/app/services/urls/urls_default.py index ff5071333f..d570521fb8 100644 --- a/invokeai/app/services/urls/urls_default.py +++ b/invokeai/app/services/urls/urls_default.py @@ -1,6 +1,6 @@ import os -from .urls_base import UrlServiceBase +from invokeai.app.services.urls.urls_base import UrlServiceBase class LocalUrlService(UrlServiceBase): diff --git a/invokeai/backend/image_util/__init__.py b/invokeai/backend/image_util/__init__.py index f45af9feb4..bc5eed7ddd 100644 --- a/invokeai/backend/image_util/__init__.py +++ b/invokeai/backend/image_util/__init__.py @@ -2,6 +2,11 @@ Initialization file for invokeai.backend.image_util methods. """ -from .infill_methods.patchmatch import PatchMatch # noqa: F401 -from .pngwriter import PngWriter, PromptFormatter, retrieve_metadata, write_metadata # noqa: F401 -from .util import InitImageResizer, make_grid # noqa: F401 +from invokeai.backend.image_util.infill_methods.patchmatch import PatchMatch # noqa: F401 +from invokeai.backend.image_util.pngwriter import ( # noqa: F401 + PngWriter, + PromptFormatter, + retrieve_metadata, + write_metadata, +) +from invokeai.backend.image_util.util import InitImageResizer, make_grid # noqa: F401 diff --git a/invokeai/backend/image_util/basicsr/rrdbnet_arch.py b/invokeai/backend/image_util/basicsr/rrdbnet_arch.py index cdb77f3c21..a99a697123 100644 --- a/invokeai/backend/image_util/basicsr/rrdbnet_arch.py +++ b/invokeai/backend/image_util/basicsr/rrdbnet_arch.py @@ -2,7 +2,7 @@ import torch from torch import nn as nn from torch.nn import functional as F -from .arch_util import default_init_weights, make_layer, pixel_unshuffle +from invokeai.backend.image_util.basicsr.arch_util import default_init_weights, make_layer, pixel_unshuffle class ResidualDenseBlock(nn.Module): diff --git a/invokeai/backend/image_util/depth_anything/model/dpt.py b/invokeai/backend/image_util/depth_anything/model/dpt.py index e1101b3c39..9b1e84c7bd 100644 --- a/invokeai/backend/image_util/depth_anything/model/dpt.py +++ b/invokeai/backend/image_util/depth_anything/model/dpt.py @@ -4,7 +4,7 @@ import torch import torch.nn as nn import torch.nn.functional as F -from .blocks import FeatureFusionBlock, _make_scratch +from invokeai.backend.image_util.depth_anything.model.blocks import FeatureFusionBlock, _make_scratch torchhub_path = Path(__file__).parent.parent / "torchhub" diff --git a/invokeai/backend/image_util/dw_openpose/wholebody.py b/invokeai/backend/image_util/dw_openpose/wholebody.py index 3f77f20b9c..ce028df1fe 100644 --- a/invokeai/backend/image_util/dw_openpose/wholebody.py +++ b/invokeai/backend/image_util/dw_openpose/wholebody.py @@ -8,11 +8,10 @@ import numpy as np import onnxruntime as ort from invokeai.app.services.config.config_default import get_config +from invokeai.backend.image_util.dw_openpose.onnxdet import inference_detector +from invokeai.backend.image_util.dw_openpose.onnxpose import inference_pose from invokeai.backend.util.devices import TorchDevice -from .onnxdet import inference_detector -from .onnxpose import inference_pose - config = get_config() diff --git a/invokeai/backend/ip_adapter/ip_adapter.py b/invokeai/backend/ip_adapter/ip_adapter.py index ed3d70d832..75286f4733 100644 --- a/invokeai/backend/ip_adapter/ip_adapter.py +++ b/invokeai/backend/ip_adapter/ip_adapter.py @@ -11,10 +11,9 @@ from PIL import Image from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from invokeai.backend.ip_adapter.ip_attention_weights import IPAttentionWeights +from invokeai.backend.ip_adapter.resampler import Resampler from invokeai.backend.raw_model import RawModel -from .resampler import Resampler - class IPAdapterStateDict(TypedDict): ip_adapter: dict[str, torch.Tensor] diff --git a/invokeai/backend/lora.py b/invokeai/backend/lora.py index 8d17de0837..9c669a4c78 100644 --- a/invokeai/backend/lora.py +++ b/invokeai/backend/lora.py @@ -10,10 +10,9 @@ from safetensors.torch import load_file from typing_extensions import Self from invokeai.backend.model_manager import BaseModelType +from invokeai.backend.raw_model import RawModel from invokeai.backend.util.devices import TorchDevice -from .raw_model import RawModel - class LoRALayerBase: # rank: Optional[int] diff --git a/invokeai/backend/model_manager/__init__.py b/invokeai/backend/model_manager/__init__.py index 98cc5054c7..199c0c01f7 100644 --- a/invokeai/backend/model_manager/__init__.py +++ b/invokeai/backend/model_manager/__init__.py @@ -1,6 +1,6 @@ """Re-export frequently-used symbols from the Model Manager backend.""" -from .config import ( +from invokeai.backend.model_manager.config import ( AnyModel, AnyModelConfig, BaseModelType, @@ -13,9 +13,9 @@ from .config import ( SchedulerPredictionType, SubModelType, ) -from .load import LoadedModel -from .probe import ModelProbe -from .search import ModelSearch +from invokeai.backend.model_manager.load import LoadedModel +from invokeai.backend.model_manager.probe import ModelProbe +from invokeai.backend.model_manager.search import ModelSearch __all__ = [ "AnyModel", diff --git a/invokeai/backend/model_manager/load/__init__.py b/invokeai/backend/model_manager/load/__init__.py index 3d34f02727..d9a07bc250 100644 --- a/invokeai/backend/model_manager/load/__init__.py +++ b/invokeai/backend/model_manager/load/__init__.py @@ -6,10 +6,10 @@ Init file for the model loader. from importlib import import_module from pathlib import Path -from .load_base import LoadedModel, LoadedModelWithoutConfig, ModelLoaderBase -from .load_default import ModelLoader -from .model_cache.model_cache_default import ModelCache -from .model_loader_registry import ModelLoaderRegistry, ModelLoaderRegistryBase +from invokeai.backend.model_manager.load.load_base import LoadedModel, LoadedModelWithoutConfig, ModelLoaderBase +from invokeai.backend.model_manager.load.load_default import ModelLoader +from invokeai.backend.model_manager.load.model_cache.model_cache_default import ModelCache +from invokeai.backend.model_manager.load.model_loader_registry import ModelLoaderRegistry, ModelLoaderRegistryBase # This registers the subclasses that implement loaders of specific model types loaders = [x.stem for x in Path(Path(__file__).parent, "model_loaders").glob("*.py") if x.stem != "__init__"] diff --git a/invokeai/backend/model_manager/load/model_cache/model_cache_default.py b/invokeai/backend/model_manager/load/model_cache/model_cache_default.py index c9e68a926a..9027b7b5b7 100644 --- a/invokeai/backend/model_manager/load/model_cache/model_cache_default.py +++ b/invokeai/backend/model_manager/load/model_cache/model_cache_default.py @@ -29,13 +29,17 @@ import torch from invokeai.backend.model_manager import AnyModel, SubModelType from invokeai.backend.model_manager.load.memory_snapshot import MemorySnapshot, get_pretty_snapshot_diff +from invokeai.backend.model_manager.load.model_cache.model_cache_base import ( + CacheRecord, + CacheStats, + ModelCacheBase, + ModelLockerBase, +) +from invokeai.backend.model_manager.load.model_cache.model_locker import ModelLocker from invokeai.backend.model_manager.load.model_util import calc_model_size_by_data from invokeai.backend.util.devices import TorchDevice from invokeai.backend.util.logging import InvokeAILogger -from .model_cache_base import CacheRecord, CacheStats, ModelCacheBase, ModelLockerBase -from .model_locker import ModelLocker - # Maximum size of the cache, in gigs # Default is roughly enough to hold three fp16 diffusers models in RAM simultaneously DEFAULT_MAX_CACHE_SIZE = 6.0 diff --git a/invokeai/backend/model_manager/load/model_cache/model_locker.py b/invokeai/backend/model_manager/load/model_cache/model_locker.py index 9de17ca5f5..efbfc726f7 100644 --- a/invokeai/backend/model_manager/load/model_cache/model_locker.py +++ b/invokeai/backend/model_manager/load/model_cache/model_locker.py @@ -7,8 +7,11 @@ from typing import Dict, Optional import torch from invokeai.backend.model_manager import AnyModel - -from .model_cache_base import CacheRecord, ModelCacheBase, ModelLockerBase +from invokeai.backend.model_manager.load.model_cache.model_cache_base import ( + CacheRecord, + ModelCacheBase, + ModelLockerBase, +) class ModelLocker(ModelLockerBase): diff --git a/invokeai/backend/model_manager/load/model_loader_registry.py b/invokeai/backend/model_manager/load/model_loader_registry.py index e44d1bd41f..0ce8f8a6b4 100644 --- a/invokeai/backend/model_manager/load/model_loader_registry.py +++ b/invokeai/backend/model_manager/load/model_loader_registry.py @@ -26,8 +26,7 @@ from invokeai.backend.model_manager.config import ( ModelType, SubModelType, ) - -from . import ModelLoaderBase +from invokeai.backend.model_manager.load import ModelLoaderBase class ModelLoaderRegistryBase(ABC): diff --git a/invokeai/backend/model_manager/load/model_loaders/controlnet.py b/invokeai/backend/model_manager/load/model_loaders/controlnet.py index 6edcc48760..82091874df 100644 --- a/invokeai/backend/model_manager/load/model_loaders/controlnet.py +++ b/invokeai/backend/model_manager/load/model_loaders/controlnet.py @@ -14,8 +14,7 @@ from invokeai.backend.model_manager import ( ) from invokeai.backend.model_manager.config import ControlNetCheckpointConfig, SubModelType from invokeai.backend.model_manager.load.model_loader_registry import ModelLoaderRegistry - -from .generic_diffusers import GenericDiffusersLoader +from invokeai.backend.model_manager.load.model_loaders.generic_diffusers import GenericDiffusersLoader @ModelLoaderRegistry.register(base=BaseModelType.Any, type=ModelType.ControlNet, format=ModelFormat.Diffusers) diff --git a/invokeai/backend/model_manager/load/model_loaders/onnx.py b/invokeai/backend/model_manager/load/model_loaders/onnx.py index de4b4f0e2b..0a5d8477c4 100644 --- a/invokeai/backend/model_manager/load/model_loaders/onnx.py +++ b/invokeai/backend/model_manager/load/model_loaders/onnx.py @@ -14,8 +14,7 @@ from invokeai.backend.model_manager import ( SubModelType, ) from invokeai.backend.model_manager.load.model_loader_registry import ModelLoaderRegistry - -from .generic_diffusers import GenericDiffusersLoader +from invokeai.backend.model_manager.load.model_loaders.generic_diffusers import GenericDiffusersLoader @ModelLoaderRegistry.register(base=BaseModelType.Any, type=ModelType.ONNX, format=ModelFormat.ONNX) diff --git a/invokeai/backend/model_manager/load/model_loaders/stable_diffusion.py b/invokeai/backend/model_manager/load/model_loaders/stable_diffusion.py index 46b527acc9..d90352f0e6 100644 --- a/invokeai/backend/model_manager/load/model_loaders/stable_diffusion.py +++ b/invokeai/backend/model_manager/load/model_loaders/stable_diffusion.py @@ -26,10 +26,9 @@ from invokeai.backend.model_manager.config import ( MainCheckpointConfig, ) from invokeai.backend.model_manager.load.model_loader_registry import ModelLoaderRegistry +from invokeai.backend.model_manager.load.model_loaders.generic_diffusers import GenericDiffusersLoader from invokeai.backend.util.silence_warnings import SilenceWarnings -from .generic_diffusers import GenericDiffusersLoader - VARIANT_TO_IN_CHANNEL_MAP = { ModelVariantType.Normal: 4, ModelVariantType.Depth: 5, diff --git a/invokeai/backend/model_manager/load/model_loaders/vae.py b/invokeai/backend/model_manager/load/model_loaders/vae.py index e01d4c9251..bae29ea773 100644 --- a/invokeai/backend/model_manager/load/model_loaders/vae.py +++ b/invokeai/backend/model_manager/load/model_loaders/vae.py @@ -13,8 +13,7 @@ from invokeai.backend.model_manager import ( ) from invokeai.backend.model_manager.config import AnyModel, SubModelType, VAECheckpointConfig from invokeai.backend.model_manager.load.model_loader_registry import ModelLoaderRegistry - -from .generic_diffusers import GenericDiffusersLoader +from invokeai.backend.model_manager.load.model_loaders.generic_diffusers import GenericDiffusersLoader @ModelLoaderRegistry.register(base=BaseModelType.Any, type=ModelType.VAE, format=ModelFormat.Diffusers) diff --git a/invokeai/backend/model_manager/merge.py b/invokeai/backend/model_manager/merge.py index 125e99be93..b00bc99f3e 100644 --- a/invokeai/backend/model_manager/merge.py +++ b/invokeai/backend/model_manager/merge.py @@ -17,16 +17,10 @@ from diffusers.utils import logging as dlogging from invokeai.app.services.model_install import ModelInstallServiceBase from invokeai.app.services.model_records.model_records_base import ModelRecordChanges +from invokeai.backend.model_manager import AnyModelConfig, BaseModelType, ModelType, ModelVariantType +from invokeai.backend.model_manager.config import MainDiffusersConfig from invokeai.backend.util.devices import TorchDevice -from . import ( - AnyModelConfig, - BaseModelType, - ModelType, - ModelVariantType, -) -from .config import MainDiffusersConfig - class MergeInterpolationMethod(str, Enum): WeightedSum = "weighted_sum" diff --git a/invokeai/backend/model_manager/metadata/__init__.py b/invokeai/backend/model_manager/metadata/__init__.py index 1fd080b679..76da268153 100644 --- a/invokeai/backend/model_manager/metadata/__init__.py +++ b/invokeai/backend/model_manager/metadata/__init__.py @@ -16,8 +16,8 @@ data = HuggingFaceMetadataFetch().from_id("") assert isinstance(data, HuggingFaceMetadata) """ -from .fetch import HuggingFaceMetadataFetch, ModelMetadataFetchBase -from .metadata_base import ( +from invokeai.backend.model_manager.metadata.fetch import HuggingFaceMetadataFetch, ModelMetadataFetchBase +from invokeai.backend.model_manager.metadata.metadata_base import ( AnyModelRepoMetadata, AnyModelRepoMetadataValidator, BaseMetadata, diff --git a/invokeai/backend/model_manager/metadata/fetch/__init__.py b/invokeai/backend/model_manager/metadata/fetch/__init__.py index 652a3cf6b7..62b3dc4d54 100644 --- a/invokeai/backend/model_manager/metadata/fetch/__init__.py +++ b/invokeai/backend/model_manager/metadata/fetch/__init__.py @@ -10,7 +10,7 @@ data = HuggingFaceMetadataFetch().from_id("") assert isinstance(data, HuggingFaceMetadata) """ -from .fetch_base import ModelMetadataFetchBase -from .huggingface import HuggingFaceMetadataFetch +from invokeai.backend.model_manager.metadata.fetch.fetch_base import ModelMetadataFetchBase +from invokeai.backend.model_manager.metadata.fetch.huggingface import HuggingFaceMetadataFetch __all__ = ["ModelMetadataFetchBase", "HuggingFaceMetadataFetch"] diff --git a/invokeai/backend/model_manager/metadata/fetch/huggingface.py b/invokeai/backend/model_manager/metadata/fetch/huggingface.py index 49b942c7d7..8787ceeb36 100644 --- a/invokeai/backend/model_manager/metadata/fetch/huggingface.py +++ b/invokeai/backend/model_manager/metadata/fetch/huggingface.py @@ -25,6 +25,7 @@ from pydantic.networks import AnyHttpUrl from requests.sessions import Session from invokeai.backend.model_manager.config import ModelRepoVariant +from invokeai.backend.model_manager.metadata.fetch.fetch_base import ModelMetadataFetchBase from invokeai.backend.model_manager.metadata.metadata_base import ( AnyModelRepoMetadata, HuggingFaceMetadata, @@ -32,8 +33,6 @@ from invokeai.backend.model_manager.metadata.metadata_base import ( UnknownMetadataException, ) -from .fetch_base import ModelMetadataFetchBase - HF_MODEL_RE = r"https?://huggingface.co/([\w\-.]+/[\w\-.]+)" diff --git a/invokeai/backend/model_manager/probe.py b/invokeai/backend/model_manager/probe.py index 2f18f1a8a6..f6fb2d24bc 100644 --- a/invokeai/backend/model_manager/probe.py +++ b/invokeai/backend/model_manager/probe.py @@ -10,9 +10,7 @@ from picklescan.scanner import scan_file_path import invokeai.backend.util.logging as logger from invokeai.app.util.misc import uuid_string from invokeai.backend.model_hash.model_hash import HASHING_ALGORITHMS, ModelHash -from invokeai.backend.util.silence_warnings import SilenceWarnings - -from .config import ( +from invokeai.backend.model_manager.config import ( AnyModelConfig, BaseModelType, ControlAdapterDefaultSettings, @@ -26,7 +24,8 @@ from .config import ( ModelVariantType, SchedulerPredictionType, ) -from .util.model_util import lora_token_vector_length, read_checkpoint_meta +from invokeai.backend.model_manager.util.model_util import lora_token_vector_length, read_checkpoint_meta +from invokeai.backend.util.silence_warnings import SilenceWarnings CkptType = Dict[str | int, Any] diff --git a/invokeai/backend/model_patcher.py b/invokeai/backend/model_patcher.py index 051d114276..8c7a62c371 100644 --- a/invokeai/backend/model_patcher.py +++ b/invokeai/backend/model_patcher.py @@ -13,14 +13,13 @@ from diffusers import OnnxRuntimeModel, UNet2DConditionModel from transformers import CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from invokeai.app.shared.models import FreeUConfig +from invokeai.backend.lora import LoRAModelRaw from invokeai.backend.model_manager import AnyModel from invokeai.backend.model_manager.load.optimizations import skip_torch_weight_init from invokeai.backend.onnx.onnx_runtime import IAIOnnxRuntimeModel +from invokeai.backend.textual_inversion import TextualInversionManager, TextualInversionModelRaw from invokeai.backend.util.devices import TorchDevice -from .lora import LoRAModelRaw -from .textual_inversion import TextualInversionManager, TextualInversionModelRaw - """ loras = [ (lora_model1, 0.7), @@ -338,7 +337,7 @@ class ONNXModelPatcher: loras: List[Tuple[LoRAModelRaw, float]], prefix: str, ) -> None: - from .models.base import IAIOnnxRuntimeModel + from invokeai.backend.models.base import IAIOnnxRuntimeModel if not isinstance(model, IAIOnnxRuntimeModel): raise Exception("Only IAIOnnxRuntimeModel models supported") @@ -425,7 +424,7 @@ class ONNXModelPatcher: text_encoder: IAIOnnxRuntimeModel, ti_list: List[Tuple[str, Any]], ) -> Iterator[Tuple[CLIPTokenizer, TextualInversionManager]]: - from .models.base import IAIOnnxRuntimeModel + from invokeai.backend.models.base import IAIOnnxRuntimeModel if not isinstance(text_encoder, IAIOnnxRuntimeModel): raise Exception("Only IAIOnnxRuntimeModel models supported") diff --git a/invokeai/backend/stable_diffusion/__init__.py b/invokeai/backend/stable_diffusion/__init__.py index ed6782eefa..440cb4410b 100644 --- a/invokeai/backend/stable_diffusion/__init__.py +++ b/invokeai/backend/stable_diffusion/__init__.py @@ -2,9 +2,12 @@ Initialization file for the invokeai.backend.stable_diffusion package """ -from .diffusers_pipeline import PipelineIntermediateState, StableDiffusionGeneratorPipeline # noqa: F401 -from .diffusion import InvokeAIDiffuserComponent # noqa: F401 -from .seamless import set_seamless # noqa: F401 +from invokeai.backend.stable_diffusion.diffusers_pipeline import ( # noqa: F401 + PipelineIntermediateState, + StableDiffusionGeneratorPipeline, +) +from invokeai.backend.stable_diffusion.diffusion import InvokeAIDiffuserComponent # noqa: F401 +from invokeai.backend.stable_diffusion.seamless import set_seamless # noqa: F401 __all__ = [ "PipelineIntermediateState", diff --git a/invokeai/backend/stable_diffusion/diffusion/__init__.py b/invokeai/backend/stable_diffusion/diffusion/__init__.py index 854d127a36..712542f79c 100644 --- a/invokeai/backend/stable_diffusion/diffusion/__init__.py +++ b/invokeai/backend/stable_diffusion/diffusion/__init__.py @@ -2,4 +2,6 @@ Initialization file for invokeai.models.diffusion """ -from .shared_invokeai_diffusion import InvokeAIDiffuserComponent # noqa: F401 +from invokeai.backend.stable_diffusion.diffusion.shared_invokeai_diffusion import ( + InvokeAIDiffuserComponent, # noqa: F401 +) diff --git a/invokeai/backend/stable_diffusion/schedulers/__init__.py b/invokeai/backend/stable_diffusion/schedulers/__init__.py index 0b780d3ee2..6c02acda51 100644 --- a/invokeai/backend/stable_diffusion/schedulers/__init__.py +++ b/invokeai/backend/stable_diffusion/schedulers/__init__.py @@ -1,3 +1,3 @@ -from .schedulers import SCHEDULER_MAP # noqa: F401 +from invokeai.backend.stable_diffusion.schedulers.schedulers import SCHEDULER_MAP # noqa: F401 __all__ = ["SCHEDULER_MAP"] diff --git a/invokeai/backend/textual_inversion.py b/invokeai/backend/textual_inversion.py index 4c7625ea37..483f2da88c 100644 --- a/invokeai/backend/textual_inversion.py +++ b/invokeai/backend/textual_inversion.py @@ -9,7 +9,7 @@ from safetensors.torch import load_file from transformers import CLIPTokenizer from typing_extensions import Self -from .raw_model import RawModel +from invokeai.backend.raw_model import RawModel class TextualInversionModelRaw(RawModel): diff --git a/invokeai/backend/util/__init__.py b/invokeai/backend/util/__init__.py index 1e4d467cd0..101215640a 100644 --- a/invokeai/backend/util/__init__.py +++ b/invokeai/backend/util/__init__.py @@ -2,8 +2,8 @@ Initialization file for invokeai.backend.util """ -from .logging import InvokeAILogger -from .util import GIG, Chdir, directory_size +from invokeai.backend.util.logging import InvokeAILogger +from invokeai.backend.util.util import GIG, Chdir, directory_size __all__ = [ "GIG", diff --git a/invokeai/version/__init__.py b/invokeai/version/__init__.py index dbc30bc636..57efb1af95 100644 --- a/invokeai/version/__init__.py +++ b/invokeai/version/__init__.py @@ -2,7 +2,7 @@ initialization file for invokeai """ -from .invokeai_version import __version__ # noqa: F401 +from invokeai.version.invokeai_version import __version__ # noqa: F401 __app_id__ = "invoke-ai/InvokeAI" __app_name__ = "InvokeAI" diff --git a/pyproject.toml b/pyproject.toml index ec215230f3..a11a19071c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -210,7 +210,7 @@ select = ["B", "C", "E", "F", "W", "I", "TID"] [tool.ruff.lint.flake8-tidy-imports] # Disallow all relative imports. -ban-relative-imports = "parents" +ban-relative-imports = "all" #=== End: Ruff diff --git a/tests/test_graph_execution_state.py b/tests/test_graph_execution_state.py index d8cbc38860..9aee5febc9 100644 --- a/tests/test_graph_execution_state.py +++ b/tests/test_graph_execution_state.py @@ -3,13 +3,6 @@ from unittest.mock import Mock import pytest -# This import must happen before other invoke imports or test in other files(!!) break -from .test_nodes import ( # isort: split - PromptCollectionTestInvocation, - PromptTestInvocation, - TextToImageTestInvocation, -) - from invokeai.app.invocations.baseinvocation import BaseInvocation, BaseInvocationOutput, InvocationContext from invokeai.app.invocations.collections import RangeInvocation from invokeai.app.invocations.math import AddInvocation, MultiplyInvocation @@ -20,7 +13,13 @@ from invokeai.app.services.shared.graph import ( IterateInvocation, ) -from .test_nodes import create_edge +# This import must happen before other invoke imports or test in other files(!!) break +from tests.test_nodes import ( + PromptCollectionTestInvocation, + PromptTestInvocation, + TextToImageTestInvocation, + create_edge, +) @pytest.fixture diff --git a/tests/test_node_graph.py b/tests/test_node_graph.py index 861f1bd07b..ebaab9ff54 100644 --- a/tests/test_node_graph.py +++ b/tests/test_node_graph.py @@ -27,8 +27,7 @@ from invokeai.app.services.shared.graph import ( NodeNotFoundError, are_connections_compatible, ) - -from .test_nodes import ( +from tests.test_nodes import ( AnyTypeTestInvocation, ImageToImageTestInvocation, ListPassThroughInvocation, diff --git a/tests/test_session_queue.py b/tests/test_session_queue.py index bf26b9b002..f0a9dd4808 100644 --- a/tests/test_session_queue.py +++ b/tests/test_session_queue.py @@ -11,8 +11,7 @@ from invokeai.app.services.session_queue.session_queue_common import ( prepare_values_to_insert, ) from invokeai.app.services.shared.graph import Graph, GraphExecutionState - -from .test_nodes import PromptTestInvocation +from tests.test_nodes import PromptTestInvocation @pytest.fixture