diff --git a/.github/ISSUE_TEMPLATE/question.yaml b/.github/ISSUE_TEMPLATE/question.yaml deleted file mode 100644 index 3c79454..0000000 --- a/.github/ISSUE_TEMPLATE/question.yaml +++ /dev/null @@ -1,10 +0,0 @@ -name: Question -description: Write a question -labels: - - question - -body: - - type: textarea - attributes: - label: Question - description: Please do not write bug reports or feature requests here. diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..ffa7ba6 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,22 @@ +name: Empirical Implementation of JDD + +on: + pull_request: + types: + - opened + +jobs: + lint: + permissions: + pull-requests: write + runs-on: ubuntu-latest + + steps: + - uses: peter-evans/create-or-update-comment@v4 + with: + issue-number: ${{ github.event.pull_request.number }} + body: | + ![Imgur](https://i.imgur.com/ESow3BL.png) + + LGTM + reactions: hooray diff --git a/.github/workflows/notlint.yml b/.github/workflows/notlint.yml deleted file mode 100644 index faa3343..0000000 --- a/.github/workflows/notlint.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Not Lint - -on: - pull_request: - types: - - opened - -jobs: - lint: - runs-on: ubuntu-latest - - steps: - - uses: wow-actions/auto-comment@v1 - with: - GITHUB_TOKEN: ${{ github.token }} - pullRequestOpened: | - ![Imgur](https://i.imgur.com/ESow3BL.png) - - LGTM diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c3b0f8d..20cd974 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,6 +10,7 @@ repos: - id: check-merge-conflict - id: check-case-conflict - id: check-ast + - id: check-yaml - id: trailing-whitespace args: [--markdown-linebreak-ext=md] - id: end-of-file-fixer diff --git a/CHANGELOG.md b/CHANGELOG.md index 70572b9..8481da1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 2024-04-17 + +- v24.4.2 +- `params.txt` 파일이 없을 때 에러가 발생하지 않도록 수정 +- 파이썬 3.9 이하에서 유니온 타입 에러 방지 + ## 2024-04-14 - v24.4.1 diff --git a/aaaaaa/helper.py b/aaaaaa/helper.py index 2bcda32..27dd6a9 100644 --- a/aaaaaa/helper.py +++ b/aaaaaa/helper.py @@ -2,7 +2,7 @@ from __future__ import annotations from contextlib import contextmanager from copy import copy -from typing import TYPE_CHECKING, Any +from typing import TYPE_CHECKING, Any, Union import torch @@ -21,7 +21,7 @@ else: StableDiffusionProcessingTxt2Img, ) -PT = StableDiffusionProcessingTxt2Img | StableDiffusionProcessingImg2Img +PT = Union[StableDiffusionProcessingTxt2Img, StableDiffusionProcessingImg2Img] @contextmanager diff --git a/adetailer/__version__.py b/adetailer/__version__.py index de57016..5068bd4 100644 --- a/adetailer/__version__.py +++ b/adetailer/__version__.py @@ -1 +1 @@ -__version__ = "24.4.1" +__version__ = "24.4.2" diff --git a/scripts/!adetailer.py b/scripts/!adetailer.py index 0ec861d..b3fb1c6 100644 --- a/scripts/!adetailer.py +++ b/scripts/!adetailer.py @@ -4,7 +4,6 @@ import platform import re import sys import traceback -from contextlib import suppress from copy import copy from functools import partial from pathlib import Path @@ -71,6 +70,8 @@ from modules.shared import cmd_opts, opts, state if TYPE_CHECKING: from fastapi import FastAPI +PARAMS_TXT = "params.txt" + no_huggingface = getattr(cmd_opts, "ad_no_huggingface", False) adetailer_dir = Path(paths.models_path, "adetailer") safe_mkdir(adetailer_dir) @@ -409,9 +410,15 @@ class AfterDetailerScript(scripts.Script): p, p.all_prompts, p.all_seeds, p.all_subseeds, None, 0, 0 ) + def read_params_txt(self) -> str: + params_txt = Path(paths.data_path, PARAMS_TXT) + if params_txt.exists(): + return params_txt.read_text(encoding="utf-8") + return "" + def write_params_txt(self, content: str) -> None: - params_txt = Path(paths.data_path, "params.txt") - with suppress(Exception): + params_txt = Path(paths.data_path, PARAMS_TXT) + if params_txt.exists() and content: params_txt.write_text(content, encoding="utf-8") @staticmethod @@ -783,7 +790,7 @@ class AfterDetailerScript(scripts.Script): pp.image = ensure_pil_image(pp.image, "RGB") init_image = copy(pp.image) arg_list = self.get_args(p, *args_) - params_txt_content = Path(paths.data_path, "params.txt").read_text("utf-8") + params_txt_content = self.read_params_txt() if need_call_postprocess(p): dummy = Processed(p, [], p.seed, "")