aboutsummaryrefslogtreecommitdiffstats
path: root/modules/sd_hijack_checkpoint.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-11-27 12:19:59 +0300
committerAUTOMATIC <16777216c@gmail.com>2022-11-27 12:19:59 +0300
commitb48b7999c86fd6d7f006f76adf5a484175782c37 (patch)
tree35d77b6d617ba8dc713aafc208f2b1050d6af78a /modules/sd_hijack_checkpoint.py
parentb006382784a2f0887317bb60ea49d19b50a5dc7e (diff)
parent755df94b2aa62eabd96f900e0dd7ddc83c2f692c (diff)
downloadstable-diffusion-webui-gfx803-b48b7999c86fd6d7f006f76adf5a484175782c37.tar.gz
Merge remote-tracking branch 'flamelaw/master'
Diffstat (limited to 'modules/sd_hijack_checkpoint.py')
-rw-r--r--modules/sd_hijack_checkpoint.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/sd_hijack_checkpoint.py b/modules/sd_hijack_checkpoint.py
new file mode 100644
index 00000000..5712972f
--- /dev/null
+++ b/modules/sd_hijack_checkpoint.py
@@ -0,0 +1,10 @@
+from torch.utils.checkpoint import checkpoint
+
+def BasicTransformerBlock_forward(self, x, context=None):
+ return checkpoint(self._forward, x, context)
+
+def AttentionBlock_forward(self, x):
+ return checkpoint(self._forward, x)
+
+def ResBlock_forward(self, x, emb):
+ return checkpoint(self._forward, x, emb) \ No newline at end of file