mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
cleanup: remove unused scripts, cruft
App runs & tests pass.
This commit is contained in:
@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2022 Lincoln D. Stein (https://github.com/lstein)
|
||||
|
||||
import warnings
|
||||
|
||||
from invokeai.frontend.install.invokeai_configure import run_configure as configure
|
||||
|
||||
if __name__ == "__main__":
|
||||
warnings.warn(
|
||||
"configure_invokeai.py is deprecated, running 'invokeai-configure'...", DeprecationWarning, stacklevel=2
|
||||
)
|
||||
configure()
|
@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
"""This script reads the "Invoke" Stable Diffusion prompt embedded in files generated by invoke.py"""
|
||||
|
||||
import sys
|
||||
|
||||
from PIL import Image
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: file2prompt.py <file1.png> <file2.png> <file3.png>...")
|
||||
print(
|
||||
"This script opens up the indicated invoke.py-generated PNG file(s) and prints out the prompt used to generate them."
|
||||
)
|
||||
exit(-1)
|
||||
|
||||
filenames = sys.argv[1:]
|
||||
for f in filenames:
|
||||
try:
|
||||
im = Image.open(f)
|
||||
try:
|
||||
prompt = im.text["Dream"]
|
||||
except KeyError:
|
||||
prompt = ""
|
||||
print(f"{f}: {prompt}")
|
||||
except FileNotFoundError:
|
||||
sys.stderr.write(f"{f} not found\n")
|
||||
continue
|
||||
except PermissionError:
|
||||
sys.stderr.write(f"{f} could not be opened due to inadequate permissions\n")
|
||||
continue
|
@ -1,22 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# Copyright (c) 2022 Kyle Schouviller (https://github.com/kyle0654)
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
logging.getLogger("xformers").addFilter(lambda record: "A matching Triton is not available" not in record.getMessage())
|
||||
|
||||
|
||||
def main():
|
||||
# Change working directory to the repo root
|
||||
os.chdir(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
||||
|
||||
# TODO: Parse some top-level args here.
|
||||
from invokeai.app.cli_app import invoke_cli
|
||||
|
||||
invoke_cli()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
from invokeai.frontend.install.model_install import main
|
||||
|
||||
main()
|
@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
This script is used at release time to generate a markdown table describing the
|
||||
starter models. This text is then manually copied into 050_INSTALL_MODELS.md.
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from omegaconf import OmegaConf
|
||||
|
||||
|
||||
def main():
|
||||
initial_models_file = Path(__file__).parent / "../invokeai/configs/INITIAL_MODELS.yaml"
|
||||
models = OmegaConf.load(initial_models_file)
|
||||
print("|Model Name | HuggingFace Repo ID | Description | URL |")
|
||||
print("|---------- | ---------- | ----------- | --- |")
|
||||
for model in models:
|
||||
repo_id = models[model].repo_id
|
||||
url = f"https://huggingface.co/{repo_id}"
|
||||
print(f"|{model}|{repo_id}|{models[model].description}|{url} |")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import requests
|
||||
|
||||
from invokeai.version import __version__
|
||||
|
||||
local_version = str(__version__).replace("-", "")
|
||||
package_name = "InvokeAI"
|
||||
|
||||
|
||||
def get_pypi_versions(package_name=package_name) -> list[str]:
|
||||
"""Get the versions of the package from PyPI"""
|
||||
url = f"https://pypi.org/pypi/{package_name}/json"
|
||||
response = requests.get(url).json()
|
||||
versions: list[str] = list(response["releases"].keys())
|
||||
return versions
|
||||
|
||||
|
||||
def local_on_pypi(package_name=package_name, local_version=local_version) -> bool:
|
||||
"""Compare the versions of the package from PyPI and the local package"""
|
||||
pypi_versions = get_pypi_versions(package_name)
|
||||
return local_version in pypi_versions
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if local_on_pypi():
|
||||
print(f"Package {package_name} is up to date")
|
||||
else:
|
||||
print(f"Package {package_name} is not up to date")
|
@ -1,61 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""
|
||||
Scan the models directory and print out a new models.yaml
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from omegaconf import OmegaConf
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Model directory scanner")
|
||||
parser.add_argument("models_directory")
|
||||
parser.add_argument(
|
||||
"--all-models",
|
||||
default=False,
|
||||
action="store_true",
|
||||
help="If true, then generates stanzas for all models; otherwise just diffusers",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
directory = args.models_directory
|
||||
|
||||
conf = OmegaConf.create()
|
||||
conf["_version"] = "3.0.0"
|
||||
|
||||
for root, dirs, files in os.walk(directory):
|
||||
parents = root.split("/")
|
||||
subpaths = parents[parents.index("models") + 1 :]
|
||||
if len(subpaths) < 2:
|
||||
continue
|
||||
base, model_type, *_ = subpaths
|
||||
|
||||
if args.all_models or model_type == "diffusers":
|
||||
for d in dirs:
|
||||
conf[f"{base}/{model_type}/{d}"] = {
|
||||
"path": os.path.join(root, d),
|
||||
"description": f"{model_type} model {d}",
|
||||
"format": "folder",
|
||||
"base": base,
|
||||
}
|
||||
|
||||
for f in files:
|
||||
basename = Path(f).stem
|
||||
format = Path(f).suffix[1:]
|
||||
conf[f"{base}/{model_type}/{basename}"] = {
|
||||
"path": os.path.join(root, f),
|
||||
"description": f"{model_type} model {basename}",
|
||||
"format": format,
|
||||
"base": base,
|
||||
}
|
||||
|
||||
OmegaConf.save(config=dict(sorted(conf.items())), f=sys.stdout)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
@ -1,23 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
from invokeai.backend.image_util import retrieve_metadata
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: file2prompt.py <file1.png> <file2.png> <file3.png>...")
|
||||
print("This script opens up the indicated invoke.py-generated PNG file(s) and prints out their metadata.")
|
||||
exit(-1)
|
||||
|
||||
filenames = sys.argv[1:]
|
||||
for f in filenames:
|
||||
try:
|
||||
metadata = retrieve_metadata(f)
|
||||
print(f"{f}:\n", json.dumps(metadata["sd-metadata"], indent=4))
|
||||
except FileNotFoundError:
|
||||
sys.stderr.write(f"{f} not found\n")
|
||||
continue
|
||||
except PermissionError:
|
||||
sys.stderr.write(f"{f} could not be opened due to inadequate permissions\n")
|
||||
continue
|
Reference in New Issue
Block a user