Skip to content

Commit

Permalink
webui fix bug of AttrError shared.opt.onediff_compiler_cache_path (#989)
Browse files Browse the repository at this point in the history
  • Loading branch information
marigoold authored Jul 1, 2024
1 parent 31f1601 commit 3ac193e
Showing 1 changed file with 8 additions and 0 deletions.
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

0 comments on commit 3ac193e

Please sign in to comment.