Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
63 changes: 23 additions & 40 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,51 +1,34 @@
# continuous integration
/.github/workflows/ @mauwii @lstein @blessedcoolant
/.github/workflows/ @mauwii @lstein

# documentation
/docs/ @lstein @mauwii @tildebyte @blessedcoolant
mkdocs.yml @lstein @mauwii @blessedcoolant
/docs/ @lstein @mauwii @tildebyte
/mkdocs.yml @lstein @mauwii

# nodes
/invokeai/app/ @Kyle0654 @blessedcoolant

# installation and configuration
/pyproject.toml @mauwii @lstein @ebr @blessedcoolant
/docker/ @mauwii @lstein @blessedcoolant
/scripts/ @ebr @lstein @blessedcoolant
/installer/ @ebr @lstein @tildebyte @blessedcoolant
ldm/invoke/config @lstein @ebr @blessedcoolant
invokeai/assets @lstein @ebr @blessedcoolant
invokeai/configs @lstein @ebr @blessedcoolant
/ldm/invoke/_version.py @lstein @blessedcoolant
/pyproject.toml @mauwii @lstein @blessedcoolant
/docker/ @mauwii @lstein
/scripts/ @ebr @lstein
/installer/ @lstein @ebr
/invokeai/assets @lstein @ebr
/invokeai/configs @lstein
/invokeai/version @lstein @blessedcoolant

# web ui
/invokeai/frontend @blessedcoolant @psychedelicious @lstein
/invokeai/backend @blessedcoolant @psychedelicious @lstein

# generation and model management
/ldm/*.py @lstein @blessedcoolant
/ldm/generate.py @lstein @keturn @blessedcoolant
/ldm/invoke/args.py @lstein @blessedcoolant
/ldm/invoke/ckpt* @lstein @blessedcoolant
/ldm/invoke/ckpt_generator @lstein @blessedcoolant
/ldm/invoke/CLI.py @lstein @blessedcoolant
/ldm/invoke/config @lstein @ebr @mauwii @blessedcoolant
/ldm/invoke/generator @keturn @damian0815 @blessedcoolant
/ldm/invoke/globals.py @lstein @blessedcoolant
/ldm/invoke/merge_diffusers.py @lstein @blessedcoolant
/ldm/invoke/model_manager.py @lstein @blessedcoolant
/ldm/invoke/txt2mask.py @lstein @blessedcoolant
/ldm/invoke/patchmatch.py @Kyle0654 @blessedcoolant @lstein
/ldm/invoke/restoration @lstein @blessedcoolant

# attention, textual inversion, model configuration
/ldm/models @damian0815 @keturn @lstein @blessedcoolant
/ldm/modules @damian0815 @keturn @lstein @blessedcoolant

# Nodes
apps/ @Kyle0654 @lstein @blessedcoolant

# legacy REST API
# is CapableWeb still engaged?
/ldm/invoke/pngwriter.py @CapableWeb @lstein @blessedcoolant
/ldm/invoke/server_legacy.py @CapableWeb @lstein @blessedcoolant
/scripts/legacy_api.py @CapableWeb @lstein @blessedcoolant
/tests/legacy_tests.sh @CapableWeb @lstein @blessedcoolant
# generation, model management, postprocessing
/invokeai/backend @keturn @damian0815 @lstein @blessedcoolant @jpphoto

# front ends
/invokeai/frontend/CLI @lstein
/invokeai/frontend/install @lstein @ebr @mauwii
/invokeai/frontend/merge @lstein @blessedcoolant @hipsterusername
/invokeai/frontend/training @lstein @blessedcoolant @hipsterusername
/invokeai/frontend/web @psychedelicious @blessedcoolant


2 changes: 1 addition & 1 deletion .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- 'dev/docker/*'
paths:
- 'pyproject.toml'
- 'ldm/**'
- 'invokeai/**'
- 'invokeai/backend/**'
- 'invokeai/configs/**'
- 'invokeai/frontend/dist/**'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name: Lint frontend
on:
pull_request:
paths:
- 'invokeai/frontend/**'
- 'invokeai/frontend/web/**'
push:
paths:
- 'invokeai/frontend/**'
- 'invokeai/frontend/web/**'

defaults:
run:
working-directory: invokeai/frontend
working-directory: invokeai/frontend/web

jobs:
lint-frontend:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: PyPI Release
on:
push:
paths:
- 'ldm/invoke/_version.py'
- 'invokeai/version/invokeai_version.py'
workflow_dispatch:

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-invoke-pip-skip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
pull_request:
paths-ignore:
- 'pyproject.toml'
- 'ldm/**'
- 'invokeai/**'
- 'invokeai/backend/**'
- 'invokeai/configs/**'
- 'invokeai/frontend/dist/**'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-invoke-pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ on:
- 'main'
paths:
- 'pyproject.toml'
- 'ldm/**'
- 'invokeai/**'
- 'invokeai/backend/**'
- 'invokeai/configs/**'
- 'invokeai/frontend/dist/**'
pull_request:
paths:
- 'pyproject.toml'
- 'ldm/**'
- 'invokeai/**'
- 'invokeai/backend/**'
- 'invokeai/configs/**'
- 'invokeai/frontend/dist/**'
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
- name: set INVOKEAI_OUTDIR
run: >
python -c
"import os;from ldm.invoke.globals import Globals;OUTDIR=os.path.join(Globals.root,str('outputs'));print(f'INVOKEAI_OUTDIR={OUTDIR}')"
"import os;from invokeai.backend.globals import Globals;OUTDIR=os.path.join(Globals.root,str('outputs'));print(f'INVOKEAI_OUTDIR={OUTDIR}')"
>> ${{ matrix.github-env }}

- name: run invokeai-configure
Expand Down
10 changes: 1 addition & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ checkpoints
.DS_Store

# Let the frontend manage its own gitignore
!invokeai/frontend/*
!invokeai/frontend/web/*

# Scratch folder
.scratch/
Expand All @@ -213,11 +213,6 @@ gfpgan/
# config file (will be created by installer)
configs/models.yaml

# weights (will be created by installer)
models/ldm/stable-diffusion-v1/*.ckpt
models/clipseg
models/gfpgan

# ignore initfile
.invokeai

Expand All @@ -232,6 +227,3 @@ installer/install.bat
installer/install.sh
installer/update.bat
installer/update.sh

# no longer stored in source directory
models
4 changes: 2 additions & 2 deletions installer/create_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ if [[ -v "VIRTUAL_ENV" ]]; then
exit -1
fi

VERSION=$(cd ..; python -c "from ldm.invoke import __version__ as version; print(version)")
VERSION=$(cd ..; python -c "from invokeai.version import __version__ as version; print(version)")
PATCH=""
VERSION="v${VERSION}${PATCH}"
LATEST_TAG="v2.3-latest"
LATEST_TAG="v3.0-latest"

echo Building installer for version $VERSION
echo "Be certain that you're in the 'installer' directory before continuing."
Expand Down
6 changes: 3 additions & 3 deletions installer/lib/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ def install_app(self, extra_index_url=None, optional_modules=None, find_links=No
src = Path(__file__).parents[1].expanduser().resolve()
# if the above directory contains one of these files, we'll do a source install
next(src.glob("pyproject.toml"))
next(src.glob("ldm"))
next(src.glob("invokeai"))
except StopIteration:
print("Unable to find a wheel or perform a source install. Giving up.")

Expand Down Expand Up @@ -342,14 +342,14 @@ def configure(self):

introduction()

from ldm.invoke.config import invokeai_configure
from invokeai.frontend.install import invokeai_configure

# NOTE: currently the config script does its own arg parsing! this means the command-line switches
# from the installer will also automatically propagate down to the config script.
# this may change in the future with config refactoring!
succeeded = False
try:
invokeai_configure.main()
invokeai_configure()
succeeded = True
except requests.exceptions.ConnectionError as e:
print(f'\nA network error was encountered during configuration and download: {str(e)}')
Expand Down
14 changes: 11 additions & 3 deletions invokeai/README
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
After version 2.3 is released, the ldm/invoke modules will be migrated to this location
so that we have a proper invokeai distribution. Currently it is only being used for
data files.
Organization of the source tree:

app -- Home of nodes invocations and services
assets -- Images and other data files used by InvokeAI
backend -- Non-user facing libraries, including the rendering
core.
configs -- Configuration files used at install and run times
frontend -- User-facing scripts, including the CLI and the WebUI
version -- Current InvokeAI version string, stored
in version/invokeai_version.py

Original file line number Diff line number Diff line change
@@ -1,79 +1,78 @@
# Copyright (c) 2022 Kyle Schouviller (https://github.com/kyle0654)

from argparse import Namespace
import os

from ..services.processor import DefaultInvocationProcessor

from ..services.graph import GraphExecutionState
from ..services.sqlite import SqliteItemStorage
from argparse import Namespace

from ...globals import Globals

from ..services.generate_initializer import get_generate
from ..services.graph import GraphExecutionState
from ..services.image_storage import DiskImageStorage
from ..services.invocation_queue import MemoryInvocationQueue
from ..services.invocation_services import InvocationServices
from ..services.invoker import Invoker
from ..services.generate_initializer import get_generate
from ..services.processor import DefaultInvocationProcessor
from ..services.sqlite import SqliteItemStorage
from .events import FastAPIEventService


# TODO: is there a better way to achieve this?
def check_internet()->bool:
'''
def check_internet() -> bool:
"""
Return true if the internet is reachable.
It does this by pinging huggingface.co.
'''
"""
import urllib.request
host = 'http://huggingface.co'

host = "http://huggingface.co"
try:
urllib.request.urlopen(host,timeout=1)
urllib.request.urlopen(host, timeout=1)
return True
except:
return False


class ApiDependencies:
"""Contains and initializes all dependencies for the API"""

invoker: Invoker = None

@staticmethod
def initialize(
args,
config,
event_handler_id: int
):
def initialize(args, config, event_handler_id: int):
Globals.try_patchmatch = args.patchmatch
Globals.always_use_cpu = args.always_use_cpu
Globals.internet_available = args.internet_available and check_internet()
Globals.disable_xformers = not args.xformers
Globals.ckpt_convert = args.ckpt_convert

# TODO: Use a logger
print(f'>> Internet connectivity is {Globals.internet_available}')
print(f">> Internet connectivity is {Globals.internet_available}")

generate = get_generate(args, config)

events = FastAPIEventService(event_handler_id)

output_folder = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../../outputs'))
output_folder = os.path.abspath(
os.path.join(os.path.dirname(__file__), "../../../../outputs")
)

images = DiskImageStorage(output_folder)

# TODO: build a file/path manager?
db_location = os.path.join(output_folder, 'invokeai.db')
db_location = os.path.join(output_folder, "invokeai.db")

services = InvocationServices(
generate = generate,
events = events,
images = images,
queue = MemoryInvocationQueue(),
graph_execution_manager = SqliteItemStorage[GraphExecutionState](filename = db_location, table_name = 'graph_executions'),
processor = DefaultInvocationProcessor()
generate=generate,
events=events,
images=images,
queue=MemoryInvocationQueue(),
graph_execution_manager=SqliteItemStorage[GraphExecutionState](
filename=db_location, table_name="graph_executions"
),
processor=DefaultInvocationProcessor(),
)

ApiDependencies.invoker = Invoker(services)

@staticmethod
def shutdown():
if ApiDependencies.invoker:
Expand Down
Loading