Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webui fix bug of AttrError shared.opt.onediff_compiler_cache_path #989

Merged
merged 3 commits into from
Jul 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions onediff_sd_webui_extensions/onediff_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
def all_compiler_caches_path():
import modules.shared as shared

# for webui <= 1.8, the function will be called before ui initialized
# At that time, shared opts doesn't have attribute `onediff_compiler_caches_path`
if not hasattr(shared.opts, "onediff_compiler_caches_path"):
return None

caches_path = Path(shared.opts.onediff_compiler_caches_path)
if not caches_path.exists():
caches_path.mkdir(parents=True)
Expand All @@ -65,6 +70,9 @@ def get_all_compiler_caches():
def refresh_all_compiler_caches(path: Path = None):
global all_compiler_caches
path = path or all_compiler_caches_path()
if path is None:
return

all_compiler_caches = [f.stem for f in Path(path).iterdir() if f.is_file()]


Expand Down