diff --git a/ldm/invoke/CLI.py b/ldm/invoke/CLI.py index 9ddab9ed15..5c95aa80b7 100644 --- a/ldm/invoke/CLI.py +++ b/ldm/invoke/CLI.py @@ -21,6 +21,9 @@ import ldm.invoke # global used in multiple functions (fix) infile = None +if sys.platform == 'darwin': + os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1" + def main(): """Initialize command-line parsers and the diffusion model""" global infile diff --git a/pyproject.toml b/pyproject.toml index 87c7308720..0f2f34b962 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -61,6 +61,7 @@ dependencies = [ "picklescan", "pillow", "pudb", + "prompt-toolkit", "pypatchmatch", "pyreadline3", "pytorch-lightning==1.7.7", @@ -90,10 +91,10 @@ dependencies = [ "test" = ["pytest>6.0.0", "pytest-cov"] [project.scripts] -"configure_invokeai" = "ldm.invoke.configure_invokeai:main" -"invokeai-config" = "ldm.invoke.config.configure_invokeai:main" -"textual_inversion" = "ldm.invoke.textual_inversion:main" -"merge_models" = "ldm.invoke.merge_diffusers:main" # note name munging +"invoke" = "ldm.invoke.CLI:main" +"invoke-configure" = "ldm.invoke.config.configure_invokeai:main" +"invoke-merge" = "ldm.invoke.merge_diffusers:main" # note name munging +"invoke-ti" = "ldm.invoke.training.textual_inversion:main" [project.urls] "Homepage" = "https://invoke-ai.github.io/InvokeAI/" diff --git a/scripts/configure_invokeai.py b/scripts/configure_invokeai.py index b8e5f0da5e..e22bec32fc 100644 --- a/scripts/configure_invokeai.py +++ b/scripts/configure_invokeai.py @@ -1,11 +1,9 @@ #!/usr/bin/env python # Copyright (c) 2022 Lincoln D. Stein (https://github.com/lstein) -# Before running stable-diffusion on an internet-isolated machine, -# run this script from one with internet connectivity. The -# two machines must share a common .cache directory. import warnings from ldm.invoke.config import configure_invokeai if __name__ == '__main__': + warnings.warn("configire_invokeai.py is deprecated, please run 'invoke'", DeprecationWarning) configure_invokeai.main() diff --git a/scripts/invoke.py b/scripts/invoke.py index cfe6b06114..710cea3830 100755 --- a/scripts/invoke.py +++ b/scripts/invoke.py @@ -2,9 +2,6 @@ import sys import os -if sys.platform == 'darwin': - os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1" import ldm.invoke.CLI ldm.invoke.CLI.main() - diff --git a/scripts/load_models.py b/scripts/load_models.py deleted file mode 100755 index 89ae5d7588..0000000000 --- a/scripts/load_models.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2022 Lincoln D. Stein (https://github.com/lstein) -# Before running stable-diffusion on an internet-isolated machine, -# run this script from one with internet connectivity. The -# two machines must share a common .cache directory. - -import warnings -import ldm.invoke.configure_invokeai as configure_invokeai - -if __name__ == '__main__': - configure_invokeai.main() - diff --git a/scripts/preload_models.py b/scripts/preload_models.py deleted file mode 100755 index 89ae5d7588..0000000000 --- a/scripts/preload_models.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2022 Lincoln D. Stein (https://github.com/lstein) -# Before running stable-diffusion on an internet-isolated machine, -# run this script from one with internet connectivity. The -# two machines must share a common .cache directory. - -import warnings -import ldm.invoke.configure_invokeai as configure_invokeai - -if __name__ == '__main__': - configure_invokeai.main() - diff --git a/setup.py b/setup.py deleted file mode 100644 index da90c3967b..0000000000 --- a/setup.py +++ /dev/null @@ -1,100 +0,0 @@ -import sys -import os -import re -from setuptools import setup, find_packages - -def list_files(directory): - listing = list() - for root, dirs, files in os.walk(directory,topdown=False): - pair = (root,[os.path.join(root,f) for f in files]) - listing.append(pair) - return listing - - -def get_version()->str: - from ldm.invoke import __version__ as version - return version - -# The canonical version number is stored in the file ldm/invoke/_version.py -VERSION = get_version() -DESCRIPTION = ('An implementation of Stable Diffusion which provides various new features' - ' and options to aid the image generation process') -LONG_DESCRIPTION = ('This version of Stable Diffusion features a slick WebGUI, an' - ' interactive command-line script that combines text2img and img2img' - ' functionality in a "dream bot" style interface, and multiple features' - ' and other enhancements.') -HOMEPAGE = 'https://github.com/invoke-ai/InvokeAI' -FRONTEND_FILES = list_files('frontend/dist') -FRONTEND_FILES.append(('assets',['assets/caution.png'])) -print(FRONTEND_FILES) - -REQUIREMENTS=[ - 'accelerate', - 'albumentations', - 'diffusers', - 'eventlet', - 'flask_cors', - 'flask_socketio', - 'flaskwebgui', - 'getpass_asterisk', - 'imageio-ffmpeg', - 'pyreadline3', - 'realesrgan', - 'send2trash', - 'streamlit', - 'taming-transformers-rom1504', - 'test-tube', - 'torch-fidelity', - 'torch', - 'torchvision', - 'transformers', - 'picklescan', - 'clip', - 'clipseg', - 'gfpgan', - 'k-diffusion', - 'pypatchmatch', -] - -setup( - name='InvokeAI', - version=VERSION, - description=DESCRIPTION, - long_description=LONG_DESCRIPTION, - author='The InvokeAI Project', - author_email='lincoln.stein@gmail.com', - url=HOMEPAGE, - license='MIT', - packages=find_packages(exclude=['tests.*']), - install_requires=REQUIREMENTS, - dependency_links=['https://download.pytorch.org/whl/torch_stable.html'], - python_requires='>=3.9, <3.11', - classifiers=[ - 'Development Status :: 4 - Beta', - 'Environment :: GPU', - 'Environment :: GPU :: NVIDIA CUDA', - 'Environment :: MacOS X', - 'Intended Audience :: End Users/Desktop', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: POSIX :: Linux', - 'Operating System :: MacOS', - 'Operating System :: Microsoft :: Windows', - 'Programming Language :: Python :: 3 :: Only,' - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Topic :: Artistic Software', - 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application', - 'Topic :: Internet :: WWW/HTTP :: WSGI :: Server', - 'Topic :: Multimedia :: Graphics', - 'Topic :: Scientific/Engineering :: Artificial Intelligence', - 'Topic :: Scientific/Engineering :: Image Processing', - ], - scripts = ['scripts/invoke.py','scripts/configure_invokeai.py', 'scripts/sd-metadata.py', - 'scripts/images2prompt.py','scripts/merge_embeddings.py', - 'scripts/textual_inversion_fe.py','scripts/textual_inversion.py' - ], - data_files=FRONTEND_FILES, - include_package_data=True, -)