From 9ac7f3771a2b8b488609709ffbf559d8c88ffd01 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sat, 29 Apr 2023 19:30:26 -0400 Subject: [PATCH] update cmdflags --- .github/workflows/on_pull_request.yaml | 7 ++++--- TODO.md | 5 ++--- launch.py | 5 ++--- modules/cmd_args.py | 1 + modules/img2img.py | 4 ++-- modules/txt2img.py | 2 +- setup.py | 3 +-- 7 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/on_pull_request.yaml b/.github/workflows/on_pull_request.yaml index b9e0eb7db..6cb1005b0 100644 --- a/.github/workflows/on_pull_request.yaml +++ b/.github/workflows/on_pull_request.yaml @@ -24,10 +24,11 @@ jobs: python-version: 3.10.6 cache: pip cache-dependency-path: requirements.txt - - name: Install dependencies + - name: Test Startup run: | - python launch.py --test - - name: Analysing the code with pylint + export COMMANDLINE_ARGS="--debug --test" + python launch.py + - name: Linting run: | python -m pip install --upgrade pip pip install pylint diff --git a/TODO.md b/TODO.md index 167a823ec..0a5b0e99d 100644 --- a/TODO.md +++ b/TODO.md @@ -4,10 +4,7 @@ Stuff to be fixed... -- Run VAE with hires at 1280 -- Transformers version - Move Restart Server from WebUI to Launch and reload modules -- Follow-up on `p.script_args` - Mdularize `cli` scripts ## Features @@ -16,9 +13,11 @@ Stuff to be added... - Update README - Add Gradio theme maker +- Transformers version - Create new GitHub hooks/actions for CI/CD - Redo Extensions tab: see - Stream-load models as option for slow storage +- Auto-test `torch.layer_norm` for FP16 ## Investigate diff --git a/launch.py b/launch.py index 995f61894..8df3f787c 100644 --- a/launch.py +++ b/launch.py @@ -101,6 +101,5 @@ if __name__ == "__main__": setup.log.info("Test only") import webui exit(0) - else: - import webui - webui.webui() + import webui + webui.webui() diff --git a/modules/cmd_args.py b/modules/cmd_args.py index 3bca9b357..9b8438800 100644 --- a/modules/cmd_args.py +++ b/modules/cmd_args.py @@ -74,6 +74,7 @@ def compatibility_args(opts, args): parser.add_argument("--sub-quad-q-chunk-size", help=argparse.SUPPRESS, default=opts.sub_quad_q_chunk_size) parser.add_argument("--sub-quad-kv-chunk-size", help=argparse.SUPPRESS, default=opts.sub_quad_kv_chunk_size) parser.add_argument("--sub-quad-chunk-threshold", help=argparse.SUPPRESS, default=opts.sub_quad_chunk_threshold) + parser.add_argument('--debug', default = False, action='store_true', help = "Run installer with debug logging, default: %(default)s") opts.use_old_emphasis_implementation = False opts.use_old_karras_scheduler_sigmas = False diff --git a/modules/img2img.py b/modules/img2img.py index fc7165751..de889d4b7 100644 --- a/modules/img2img.py +++ b/modules/img2img.py @@ -60,7 +60,7 @@ def process_batch(p, input_dir, output_dir, inpaint_mask_dir, args): if processed_image.mode == 'RGBA': processed_image = processed_image.convert("RGB") processed_image.save(os.path.join(output_dir, filename)) - if cmd_opts.get('debug', False): + if cmd_opts.debug: log.info(f'Processed: {len(images)} Memory: {memory_stats()} batch') @@ -146,6 +146,6 @@ def img2img(id_task: str, mode: int, prompt: str, negative_prompt: str, prompt_s processed = process_images(p) p.close() generation_info_js = processed.js() - if cmd_opts.get('debug', False): + if cmd_opts.debug: log.info(f'Processed: {len(processed.images)} Memory: {memory_stats()} img') return processed.images, generation_info_js, plaintext_to_html(processed.info), plaintext_to_html(processed.comments) diff --git a/modules/txt2img.py b/modules/txt2img.py index 45541749b..17e5ce909 100644 --- a/modules/txt2img.py +++ b/modules/txt2img.py @@ -46,6 +46,6 @@ def txt2img(id_task: str, prompt: str, negative_prompt: str, prompt_styles, step processed = process_images(p) p.close() generation_info_js = processed.js() - if cmd_opts.get('debug', False): + if cmd_opts.debug: log.info(f'Processed: {len(processed.images)} Memory: {memory_stats()} txt') return processed.images, generation_info_js, plaintext_to_html(processed.info), plaintext_to_html(processed.comments) diff --git a/setup.py b/setup.py index 649718bd0..906eaf136 100644 --- a/setup.py +++ b/setup.py @@ -487,8 +487,7 @@ def check_timestamp(): def add_args(): - if vars(parser)['_option_string_actions'].get('--debug', None) is None: - parser.add_argument('--debug', default = False, action='store_true', help = "Run installer with debug logging, default: %(default)s") + parser.add_argument('--debug', default = False, action='store_true', help = "Run installer with debug logging, default: %(default)s") parser.add_argument('--reset', default = False, action='store_true', help = "Reset main repository to latest version, default: %(default)s") parser.add_argument('--upgrade', default = False, action='store_true', help = "Upgrade main repository to latest version, default: %(default)s") parser.add_argument('--noupdate', default = False, action='store_true', help = "Skip update of extensions and submodules, default: %(default)s")