aboutsummaryrefslogtreecommitdiffstats
path: root/modules/sd_hijack_checkpoint.py
diff options
context:
space:
mode:
authorzhaohu xing <32668889+920232796@users.noreply.github.com>2022-11-30 02:13:17 +0000
committerGitHub <noreply@github.com>2022-11-30 02:13:17 +0000
commit0831ab476c626eb796b609acf8771177692bfab7 (patch)
treeebae98ea40ecc5b34497424bee19310e9fac4068 /modules/sd_hijack_checkpoint.py
parentee3f5ea3eeb31f1ed72e2f0cbed2c00a782497d8 (diff)
parent4b3c5bc24bffdf429c463a465763b3077fe55eb8 (diff)
downloadstable-diffusion-webui-gfx803-0831ab476c626eb796b609acf8771177692bfab7.tar.gz
stable-diffusion-webui-gfx803-0831ab476c626eb796b609acf8771177692bfab7.tar.bz2
stable-diffusion-webui-gfx803-0831ab476c626eb796b609acf8771177692bfab7.zip
Merge branch 'master' into 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