Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
bb2e2c82
Commit
bb2e2c82
authored
Nov 11, 2022
by
AUTOMATIC1111
Committed by
GitHub
Nov 11, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4233 from thesved/patch-1
Make DDIM and PLMS work on Mac OS
parents
b8a2e387
86b7fc6e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
modules/sd_hijack_inpainting.py
modules/sd_hijack_inpainting.py
+18
-1
No files found.
modules/sd_hijack_inpainting.py
View file @
bb2e2c82
import
torch
import
modules.devices
as
devices
from
einops
import
repeat
from
omegaconf
import
ListConfig
...
...
@@ -314,6 +315,20 @@ class LatentInpaintDiffusion(LatentDiffusion):
self
.
masked_image_key
=
masked_image_key
assert
self
.
masked_image_key
in
concat_keys
self
.
concat_keys
=
concat_keys
# =================================================================================================
# Fix register buffer bug for Mac OS, Viktor Tabori, viktor.doklist.com/start-here
# =================================================================================================
def
register_buffer
(
self
,
name
,
attr
):
if
type
(
attr
)
==
torch
.
Tensor
:
optimal_type
=
devices
.
get_optimal_device
()
if
attr
.
device
!=
optimal_type
:
if
getattr
(
torch
,
'has_mps'
,
False
):
attr
=
attr
.
to
(
device
=
"mps"
,
dtype
=
torch
.
float32
)
else
:
attr
=
attr
.
to
(
optimal_type
)
setattr
(
self
,
name
,
attr
)
def
should_hijack_inpainting
(
checkpoint_info
):
...
...
@@ -326,6 +341,8 @@ def do_inpainting_hijack():
ldm
.
models
.
diffusion
.
ddim
.
DDIMSampler
.
p_sample_ddim
=
p_sample_ddim
ldm
.
models
.
diffusion
.
ddim
.
DDIMSampler
.
sample
=
sample_ddim
ldm
.
models
.
diffusion
.
ddim
.
DDIMSampler
.
register_buffer
=
register_buffer
ldm
.
models
.
diffusion
.
plms
.
PLMSSampler
.
p_sample_plms
=
p_sample_plms
ldm
.
models
.
diffusion
.
plms
.
PLMSSampler
.
sample
=
sample_plms
\ No newline at end of file
ldm
.
models
.
diffusion
.
plms
.
PLMSSampler
.
sample
=
sample_plms
ldm
.
models
.
diffusion
.
plms
.
PLMSSampler
.
register_buffer
=
register_buffer
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment