Compare commits

..

18 Commits

Author SHA1 Message Date
Mary Hipp
0acf800015 update URL for bulk download placeholder 2023-11-15 08:49:15 -05:00
Mary Hipp
fa031156ab Merge branch 'main' of https://github.com/invoke-ai/InvokeAI 2023-11-15 08:48:33 -05:00
Mary Hipp
d19460bda3 Merge branch 'main' of https://github.com/invoke-ai/InvokeAI 2023-10-30 12:22:55 -04:00
Mary Hipp
cc901e5ace Merge branch 'main' of https://github.com/invoke-ai/InvokeAI 2023-10-27 09:51:59 -04:00
Mary Hipp
c8d6bec9b3 Merge branch 'main' of https://github.com/invoke-ai/InvokeAI 2023-10-17 12:47:21 -04:00
Mary Hipp
3c044bb245 Merge branch 'main' of https://github.com/invoke-ai/InvokeAI 2023-10-17 11:06:43 -04:00
Mary Hipp
af5341b39d Merge branch 'main' of https://github.com/invoke-ai/InvokeAI 2023-10-13 10:07:42 -04:00
psychedelicious
0e60f3dac1 chore: typegen 2023-10-12 09:23:10 -04:00
psychedelicious
ce9183113b fix: fix test imports 2023-10-12 09:23:10 -04:00
psychedelicious
ff4a57f883 chore(ui): regen types 2023-10-12 09:23:10 -04:00
psychedelicious
0f361cc3f1 fix(app): remove errant logger line 2023-10-12 09:23:10 -04:00
psychedelicious
028fe7eb04 chore: rebase conflicts 2023-10-12 09:23:10 -04:00
psychedelicious
efda2ded7a fix: merge conflicts 2023-10-12 09:23:10 -04:00
psychedelicious
899935a861 fix(backend): remove logic to create workflows column
Snuck in there while I was organising
2023-10-12 09:23:10 -04:00
psychedelicious
94c00cee4c feat: refactor services folder/module structure
Refactor services folder/module structure.

**Motivation**

While working on our services I've repeatedly encountered circular imports and a general lack of clarity regarding where to put things. The structure introduced goes a long way towards resolving those issues, setting us up for a clean structure going forward.

**Services**

Services are now in their own folder with a few files:

- `services/{service_name}/__init__.py`: init as needed, mostly empty now
- `services/{service_name}/{service_name}_base.py`: the base class for the service
- `services/{service_name}/{service_name}_{impl_type}.py`: the default concrete implementation of the service - typically one of `sqlite`, `default`, or `memory`
- `services/{service_name}/{service_name}_common.py`: any common items - models, exceptions, utilities, etc

Though it's a bit verbose to have the service name both as the folder name and the prefix for files, I found it is _extremely_ confusing to have all of the base classes just be named `base.py`. So, at the cost of some verbosity when importing things, I've included the service name in the filename.

There are some minor logic changes. For example, in `InvocationProcessor`, instead of assigning the model manager service to a variable to be used later in the file, the service is used directly via the `Invoker`.

**Shared**

Things that are used across disparate services are in `services/shared/`:

- `default_graphs.py`: previously in `services/`
- `graphs.py`: previously in `services/`
- `paginatation`: generic pagination models used in a few services
- `sqlite`: the `SqliteDatabase` class, other sqlite-specific things
2023-10-12 09:23:10 -04:00
psychedelicious
021f92fadc feat(backend): rename db.py to sqlite.py 2023-10-12 09:23:10 -04:00
psychedelicious
fe4c5a68c4 feat(backend): move pagination models to own file 2023-10-12 09:23:10 -04:00
psychedelicious
4f2318571d feat(backend): organise service dependencies
**Service Dependencies**

Services that depend on other services now access those services via the `Invoker` object. This object is provided to the service as a kwarg to its `start()` method.

Until now, most services did not utilize this feature, and several services required their dependencies to be initialized and passed in on init.

Additionally, _all_ services are now registered as invocation services - including the low-level services. This obviates issues with inter-dependent services we would otherwise experience as we add workflow storage.

**Database Access**

Previously, we were passing in a separate sqlite connection and corresponding lock as args to services in their init. A good amount of posturing was done in each service that uses the db.

These objects, along with the sqlite startup and cleanup logic, is now abstracted into a simple `SqliteDatabase` class. This creates the shared connection and lock objects, enables foreign keys, and provides a `clean()` method to do startup db maintenance.

This is not a service as it's only used by sqlite services.
2023-10-12 09:23:10 -04:00
4 changed files with 7 additions and 16 deletions

View File

@@ -366,7 +366,7 @@ class ImagesDownloaded(BaseModel):
)
@images_router.post("/download", operation_id="download_images_from_list", response_model=ImagesDownloaded)
@images_router.post("/export", operation_id="download_images_from_list", response_model=ImagesDownloaded)
async def download_images_from_list(
image_names: list[str] = Body(description="The list of names of images to download", embed=True),
board_id: Optional[str] = Body(

View File

@@ -90,14 +90,6 @@ def get_extras():
pass
return extras
def get_extra_index() -> str:
# parsed_version.local for torch is the platform + version, eg 'cu121' or 'rocm5.6'
local = pkg_resources.get_distribution("torch").parsed_version.local
if local and 'cu' in local:
return "--extra-index-url https://download.pytorch.org/whl/cu121"
if local and 'rocm' in local:
return "--extra-index-url https://download.pytorch.org/whl/rocm5.6"
return ""
def main():
versions = get_versions()
@@ -130,15 +122,14 @@ def main():
branch = Prompt.ask("Enter an InvokeAI branch name")
extras = get_extras()
extra_index_url = get_extra_index()
print(f":crossed_fingers: Upgrading to [yellow]{tag or release or branch}[/yellow]")
if release:
cmd = f'pip install "invokeai{extras} @ {INVOKE_AI_SRC}/{release}.zip" --use-pep517 --upgrade {extra_index_url}'
cmd = f'pip install "invokeai{extras} @ {INVOKE_AI_SRC}/{release}.zip" --use-pep517 --upgrade'
elif tag:
cmd = f'pip install "invokeai{extras} @ {INVOKE_AI_TAG}/{tag}.zip" --use-pep517 --upgrade {extra_index_url}'
cmd = f'pip install "invokeai{extras} @ {INVOKE_AI_TAG}/{tag}.zip" --use-pep517 --upgrade'
else:
cmd = f'pip install "invokeai{extras} @ {INVOKE_AI_BRANCH}/{branch}.zip" --use-pep517 --upgrade {extra_index_url}'
cmd = f'pip install "invokeai{extras} @ {INVOKE_AI_BRANCH}/{branch}.zip" --use-pep517 --upgrade'
print("")
print("")
if os.system(cmd) == 0:

View File

@@ -1543,7 +1543,7 @@ export const imagesApi = api.injectEndpoints({
components['schemas']['Body_download_images_from_list']
>({
query: ({ image_names, board_id }) => ({
url: `images/download`,
url: `images/export`,
method: 'POST',
body: {
image_names,

View File

@@ -79,11 +79,11 @@ dependencies = [
"semver~=3.0.1",
"send2trash",
"test-tube~=0.7.5",
"torch==2.1.0",
"torch~=2.1.0",
"torchvision~=0.16",
"torchmetrics~=0.11.0",
"torchsde~=0.2.5",
"transformers==4.35.1",
"transformers~=4.35.0",
"uvicorn[standard]~=0.21.1",
"windows-curses; sys_platform=='win32'",
]