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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ldm/invoke/CLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ def main():
print('--max_loaded_models must be >= 1; using 1')
args.max_loaded_models = 1

# alert - setting a global here
# alert - setting globals here
Globals.root = os.path.expanduser(args.root_dir or os.environ.get('INVOKEAI_ROOT') or os.path.abspath('.'))
Globals.try_patchmatch = args.patchmatch

print(f'>> InvokeAI runtime directory is "{Globals.root}"')

# loading here to avoid long delays on startup
Expand Down
6 changes: 6 additions & 0 deletions ldm/invoke/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,12 @@ def _create_arg_parser(self):
action='store_true',
help='Check for and blur potentially NSFW images',
)
model_group.add_argument(
'--patchmatch',
action=argparse.BooleanOptionalAction,
default=True,
help='Load the patchmatch extension for outpainting. Use --no-patchmatch to disable.',
)
file_group.add_argument(
'--from_file',
dest='infile',
Expand Down
14 changes: 10 additions & 4 deletions ldm/invoke/generator/inpaint.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@
from ldm.models.diffusion.ksampler import KSampler
from ldm.invoke.generator.base import downsampling
from ldm.util import debug_image
from patchmatch import patch_match

from ldm.invoke.globals import Globals

infill_methods: list[str] = list()

if patch_match.patchmatch_available:
infill_methods.append('patchmatch')
if Globals.try_patchmatch:
from patchmatch import patch_match
if patch_match.patchmatch_available:
print('>> Patchmatch initialized')
infill_methods.append('patchmatch')
else:
print('>> Patchmatch not loaded, please see https://github.com/invoke-ai/InvokeAI/blob/patchmatch-install-docs/docs/installation/INSTALL_PATCHMATCH.md')
else:
print('>> Patchmatch loading disabled')

infill_methods.append('tile')

Expand Down
4 changes: 4 additions & 0 deletions ldm/invoke/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@

# Where to look for the initialization file
Globals.initfile = os.path.expanduser('~/.invokeai')

# Awkward workaround to disable attempted loading of pypatchmatch
# which is causing CI tests to error out.
Globals.try_patchmatch = True