diff options
author | flamelaw <flamelaw.com3d2@gmail.com> | 2022-11-20 03:35:26 +0000 |
---|---|---|
committer | flamelaw <flamelaw.com3d2@gmail.com> | 2022-11-20 03:35:26 +0000 |
commit | bd68e35de3b7cf7547ed97d8bdf60147402133cc (patch) | |
tree | 248d3810f1f06530f19c9db7e8b0b6d2e22f7225 /modules/sd_hijack_checkpoint.py | |
parent | 47a44c7e421b98ca07e92dbf88769b04c9e28f86 (diff) | |
download | stable-diffusion-webui-gfx803-bd68e35de3b7cf7547ed97d8bdf60147402133cc.tar.gz stable-diffusion-webui-gfx803-bd68e35de3b7cf7547ed97d8bdf60147402133cc.tar.bz2 stable-diffusion-webui-gfx803-bd68e35de3b7cf7547ed97d8bdf60147402133cc.zip |
Gradient accumulation, autocast fix, new latent sampling method, etc
Diffstat (limited to 'modules/sd_hijack_checkpoint.py')
-rw-r--r-- | modules/sd_hijack_checkpoint.py | 10 |
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 |