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
abfa22c1
Commit
abfa22c1
authored
Nov 07, 2022
by
brkirch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "MPS Upscalers Fix"
This reverts commit 768b95394a8500da639b947508f78296524f1836.
parent
98947d17
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
12 deletions
+4
-12
modules/devices.py
modules/devices.py
+0
-9
modules/esrgan_model.py
modules/esrgan_model.py
+1
-1
modules/scunet_model.py
modules/scunet_model.py
+2
-1
modules/swinir_model.py
modules/swinir_model.py
+1
-1
No files found.
modules/devices.py
View file @
abfa22c1
...
...
@@ -94,12 +94,3 @@ def autocast(disable=False):
return
contextlib
.
nullcontext
()
return
torch
.
autocast
(
"cuda"
)
# MPS workaround for https://github.com/pytorch/pytorch/issues/79383
def
mps_contiguous
(
input_tensor
,
device
):
return
input_tensor
.
contiguous
()
if
device
.
type
==
'mps'
else
input_tensor
def
mps_contiguous_to
(
input_tensor
,
device
):
return
mps_contiguous
(
input_tensor
,
device
)
.
to
(
device
)
modules/esrgan_model.py
View file @
abfa22c1
...
...
@@ -199,7 +199,7 @@ def upscale_without_tiling(model, img):
img
=
img
[:,
:,
::
-
1
]
img
=
np
.
ascontiguousarray
(
np
.
transpose
(
img
,
(
2
,
0
,
1
)))
/
255
img
=
torch
.
from_numpy
(
img
)
.
float
()
img
=
devices
.
mps_contiguous_to
(
img
.
unsqueeze
(
0
),
devices
.
device_esrgan
)
img
=
img
.
unsqueeze
(
0
)
.
to
(
devices
.
device_esrgan
)
with
torch
.
no_grad
():
output
=
model
(
img
)
output
=
output
.
squeeze
()
.
float
()
.
cpu
()
.
clamp_
(
0
,
1
)
.
numpy
()
...
...
modules/scunet_model.py
View file @
abfa22c1
...
...
@@ -54,8 +54,9 @@ class UpscalerScuNET(modules.upscaler.Upscaler):
img
=
img
[:,
:,
::
-
1
]
img
=
np
.
moveaxis
(
img
,
2
,
0
)
/
255
img
=
torch
.
from_numpy
(
img
)
.
float
()
img
=
devices
.
mps_contiguous_to
(
img
.
unsqueeze
(
0
),
device
)
img
=
img
.
unsqueeze
(
0
)
.
to
(
device
)
img
=
img
.
to
(
device
)
with
torch
.
no_grad
():
output
=
model
(
img
)
output
=
output
.
squeeze
()
.
float
()
.
cpu
()
.
clamp_
(
0
,
1
)
.
numpy
()
...
...
modules/swinir_model.py
View file @
abfa22c1
...
...
@@ -111,7 +111,7 @@ def upscale(
img
=
img
[:,
:,
::
-
1
]
img
=
np
.
moveaxis
(
img
,
2
,
0
)
/
255
img
=
torch
.
from_numpy
(
img
)
.
float
()
img
=
devices
.
mps_contiguous_to
(
img
.
unsqueeze
(
0
),
devices
.
device_swinir
)
img
=
img
.
unsqueeze
(
0
)
.
to
(
devices
.
device_swinir
)
with
torch
.
no_grad
(),
precision_scope
(
"cuda"
):
_
,
_
,
h_old
,
w_old
=
img
.
size
()
h_pad
=
(
h_old
//
window_size
+
1
)
*
window_size
-
h_old
...
...
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