diff --git a/extensions-builtin/sd-extension-system-info b/extensions-builtin/sd-extension-system-info index 32e205d07..0794afa25 160000 --- a/extensions-builtin/sd-extension-system-info +++ b/extensions-builtin/sd-extension-system-info @@ -1 +1 @@ -Subproject commit 32e205d07442f866d46a7d5c767d19fa486726ef +Subproject commit 0794afa25c70857f3e14013ca7311ceb1e02019b diff --git a/modules/api/api.py b/modules/api/api.py index cb4cee07f..c8f4a20a8 100644 --- a/modules/api/api.py +++ b/modules/api/api.py @@ -6,7 +6,7 @@ import uvicorn import gradio as gr from threading import Lock from io import BytesIO -from gradio.processing_utils import decode_base64_to_file +from gradio_client.utils import decode_base64_to_file from fastapi import APIRouter, Depends, FastAPI, Request, Response from fastapi.security import HTTPBasic, HTTPBasicCredentials from fastapi.exceptions import HTTPException @@ -570,7 +570,7 @@ class Api: def create_hypernetwork(self, args: dict): try: shared.state.begin() - filename = create_hypernetwork(**args) # create empty embedding + filename = create_hypernetwork(**args) # create empty embedding # pylint: disable=E1111 shared.state.end() return CreateResponse(info = "create hypernetwork filename: {filename}".format(filename = filename)) except AssertionError as e: diff --git a/modules/errors.py b/modules/errors.py index dba20b6e4..ab6d90f90 100644 --- a/modules/errors.py +++ b/modules/errors.py @@ -4,27 +4,33 @@ import starlette import gradio from rich import print from rich.console import Console +from rich.theme import Theme from rich.pretty import install as pretty_install from rich.traceback import install as traceback_install -console = Console(log_time=True, log_time_format='%H:%M:%S-%f') +console = Console(log_time=True, log_time_format='%H:%M:%S-%f', theme=Theme({ + "traceback.border": "black", + "traceback.border.syntax_error": "black", + "inspect.value.border": "black", +})) pretty_install(console=console) traceback_install(console=console, extra_lines=1, width=console.width, word_wrap=False, indent_guides=False, suppress=[anyio, starlette, gradio]) already_displayed = {} +def install(): + pretty_install(console=console) + traceback_install(console=console, extra_lines=1, width=console.width, word_wrap=False, indent_guides=False, suppress=[anyio, starlette, gradio]) + def print_error_explanation(message): lines = message.strip().split("\n") - max_len = max([len(x) for x in lines]) - print('=' * max_len, file=sys.stderr) for line in lines: print(line, file=sys.stderr) - print('=' * max_len, file=sys.stderr) def display(e: Exception, task): print(f"{task or 'error'}: {type(e).__name__}", file=sys.stderr) - console.print_exception(show_locals=False, max_frames=2, extra_lines=1, suppress=[anyio, starlette, gradio], word_wrap=False, width=min([console.width, 200])) + console.print_exception(show_locals=False, max_frames=2, extra_lines=1, suppress=[anyio, starlette, gradio], theme="ansi_dark", word_wrap=False, width=min([console.width, 200])) def display_once(e: Exception, task): @@ -42,4 +48,4 @@ def run(code, task): def exception(): - console.print_exception(show_locals=False, max_frames=10, extra_lines=2, suppress=[anyio, starlette, gradio], word_wrap=False, width=min([console.width, 200])) + console.print_exception(show_locals=False, max_frames=10, extra_lines=2, suppress=[anyio, starlette, gradio], theme="ansi_dark", word_wrap=False, width=min([console.width, 200])) diff --git a/modules/shared.py b/modules/shared.py index ac0fe9c26..75ae443ad 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -15,6 +15,7 @@ import modules.devices as devices from modules import script_loading, errors, ui_components, shared_items, cmd_args, errors from modules.paths_internal import models_path, script_path, data_path, sd_configs_path, sd_default_config, sd_model_file, default_sd_model_file, extensions_dir, extensions_builtin_dir +errors.install() demo = None from setup import log as setup_log # pylint: disable=E0611 log = setup_log diff --git a/requirements.txt b/requirements.txt index b26d0ab1b..eb6b2ee23 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,6 +20,7 @@ future gdown gfpgan GitPython +gradio_client httpcore inflection jsonmerge @@ -54,10 +55,9 @@ transformers voluptuous yapf -diffusers==0.14.0 +diffusers==0.15.0 einops==0.4.1 -fastapi==0.94.0 -gradio==3.23.0 +gradio==3.26.0 numexpr==2.8.4 pandas==1.5.3 protobuf==3.20.3 diff --git a/setup.py b/setup.py index 9a125a7c3..632048ba9 100644 --- a/setup.py +++ b/setup.py @@ -29,11 +29,16 @@ def setup_logging(): logging.basicConfig(level=logging.DEBUG, format='%(asctime)s | %(levelname)s | %(pathname)s | %(message)s', filename='setup.log', filemode='a', encoding='utf-8', force=True) try: # we may not have rich on the first run from rich import print + from rich.theme import Theme from rich.logging import RichHandler from rich.console import Console from rich.pretty import install as pretty_install from rich.traceback import install as traceback_install - console = Console(log_time=True, log_time_format='%H:%M:%S-%f') + console = Console(log_time=True, log_time_format='%H:%M:%S-%f', theme=Theme({ + "traceback.border": "black", + "traceback.border.syntax_error": "black", + "inspect.value.border": "black", + })) pretty_install(console=console) traceback_install(console=console, extra_lines=1, width=console.width, word_wrap=False, indent_guides=False, suppress=[]) rh = RichHandler(show_time=True, omit_repeated_times=False, show_level=True, show_path=False, markup=False, rich_tracebacks=True, log_time_format='%H:%M:%S-%f', level=logging.DEBUG if args.debug else logging.INFO, console=console) @@ -372,7 +377,6 @@ def run_setup(quick = False): install_repositories() install_submodules() install_extensions() - install_requirements() if __name__ == "__main__": diff --git a/webui.py b/webui.py index b6657ac03..d55f68605 100644 --- a/webui.py +++ b/webui.py @@ -11,6 +11,7 @@ import logging logging.getLogger("xformers").addFilter(lambda record: 'A matching Triton is not available' not in record.getMessage()) from modules import paths, timer, errors +errors.install() startup_timer = timer.Timer() import torch