Update node_cache.py

Do not filter the load device
This commit is contained in:
efwfe 2024-05-24 16:43:50 +08:00 committed by GitHub
parent bb4d37551d
commit 160246643f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -57,13 +57,13 @@ def checkpoint_cache_decorator(func):
# get matched ckpt, vae, controlnet queue
cache_mapper = caches_mapping.get(dir_name, None)
if cache_mapper is not None and device in (None, torch.device("cpu"), {}):
if cache_mapper is not None:
if cache_mapper.get_cache(ckpt) is not None:
return cache_mapper.get_cache(ckpt)
sd = func(ckpt, *args, device=device, **kwargs)
if cache_mapper is not None and device in (None, torch.device("cpu"), {}):
if cache_mapper is not None:
cache_mapper.add_cache(ckpt, sd)
print(f"[==Cache==] Add {dir_name} {model_name} to cache")
cache_mapper.clear_cache()