Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
__pycache__
output.png
output.png

*.egg-info

.idea
25 changes: 18 additions & 7 deletions DeepCache/extension/deepcache.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
class DeepCacheSDHelper(object):
def __init__(self, pipe=None):
if pipe is not None: self.pipe = pipe
if pipe is not None:
self.pipe = pipe
self._enabled = False

def enable(self, pipe=None):
assert self.pipe is not None
self.reset_states()
self.wrap_modules()
def enable(self):
if not self._enabled:
self.reset_states()
self.wrap_modules()
self._enabled = True
print("Enabling Deepcache")
else:
print("DeepCache is already enabled.")

def disable(self):
self.unwrap_modules()
self.reset_states()
if self._enabled:
self.unwrap_modules()
self.reset_states()
self._enabled = False
print("Disabling Deepcache")
else:
print("DeepCache is already disabled.")

def set_params(self,cache_interval=1, cache_branch_id=0, skip_mode='uniform'):
cache_layer_id = cache_branch_id % 3
Expand Down