Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
8111b556
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
10 个月 前同步成功
通知
1752
Star
81
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
体验新版 GitCode,发现更多精彩内容 >>
提交
8111b556
编写于
1月 03, 2023
作者:
B
brkirch
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for PyTorch nightly and local builds
上级
3bd73776
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
29 addition
and
6 deletion
+29
-6
modules/devices.py
modules/devices.py
+23
-5
webui.py
webui.py
+6
-1
未找到文件。
modules/devices.py
浏览文件 @
8111b556
...
...
@@ -133,8 +133,26 @@ def numpy_fix(self, *args, **kwargs):
return
orig_tensor_numpy
(
self
,
*
args
,
**
kwargs
)
# PyTorch 1.13 doesn't need these fixes but unfortunately is slower and has regressions that prevent training from working
if
has_mps
()
and
version
.
parse
(
torch
.
__version__
)
<
version
.
parse
(
"1.13"
):
torch
.
Tensor
.
to
=
tensor_to_fix
torch
.
nn
.
functional
.
layer_norm
=
layer_norm_fix
torch
.
Tensor
.
numpy
=
numpy_fix
# MPS workaround for https://github.com/pytorch/pytorch/issues/89784
orig_cumsum
=
torch
.
cumsum
orig_Tensor_cumsum
=
torch
.
Tensor
.
cumsum
def
cumsum_fix
(
input
,
cumsum_func
,
*
args
,
**
kwargs
):
if
input
.
device
.
type
==
'mps'
:
output_dtype
=
kwargs
.
get
(
'dtype'
,
input
.
dtype
)
if
any
(
output_dtype
==
broken_dtype
for
broken_dtype
in
[
torch
.
bool
,
torch
.
int8
,
torch
.
int16
,
torch
.
int64
]):
return
cumsum_func
(
input
.
cpu
(),
*
args
,
**
kwargs
).
to
(
input
.
device
)
return
cumsum_func
(
input
,
*
args
,
**
kwargs
)
if
has_mps
():
if
version
.
parse
(
torch
.
__version__
)
<
version
.
parse
(
"1.13"
):
# PyTorch 1.13 doesn't need these fixes but unfortunately is slower and has regressions that prevent training from working
torch
.
Tensor
.
to
=
tensor_to_fix
torch
.
nn
.
functional
.
layer_norm
=
layer_norm_fix
torch
.
Tensor
.
numpy
=
numpy_fix
elif
version
.
parse
(
torch
.
__version__
)
>
version
.
parse
(
"1.13.1"
):
if
not
torch
.
Tensor
([
1
,
2
]).
to
(
torch
.
device
(
"mps"
)).
equal
(
torch
.
Tensor
([
1
,
1
]).
to
(
torch
.
device
(
"mps"
)).
cumsum
(
0
,
dtype
=
torch
.
int16
)):
torch
.
cumsum
=
lambda
input
,
*
args
,
**
kwargs
:
(
cumsum_fix
(
input
,
orig_cumsum
,
*
args
,
**
kwargs
)
)
torch
.
Tensor
.
cumsum
=
lambda
self
,
*
args
,
**
kwargs
:
(
cumsum_fix
(
self
,
orig_Tensor_cumsum
,
*
args
,
**
kwargs
)
)
orig_narrow
=
torch
.
narrow
torch
.
narrow
=
lambda
*
args
,
**
kwargs
:
(
orig_narrow
(
*
args
,
**
kwargs
).
clone
()
)
webui.py
浏览文件 @
8111b556
...
...
@@ -4,7 +4,7 @@ import threading
import
time
import
importlib
import
signal
import
threading
import
re
from
fastapi
import
FastAPI
from
fastapi.middleware.cors
import
CORSMiddleware
from
fastapi.middleware.gzip
import
GZipMiddleware
...
...
@@ -13,6 +13,11 @@ from modules import import_hook, errors
from
modules.call_queue
import
wrap_queued_call
,
queue_lock
,
wrap_gradio_gpu_call
from
modules.paths
import
script_path
import
torch
# Truncate version number of nightly/local build of PyTorch to not cause exceptions with CodeFormer or Safetensors
if
".dev"
in
torch
.
__version__
or
"+git"
in
torch
.
__version__
:
torch
.
__version__
=
re
.
search
(
r
'[\d.]+'
,
torch
.
__version__
).
group
(
0
)
from
modules
import
shared
,
devices
,
sd_samplers
,
upscaler
,
extensions
,
localization
,
ui_tempdir
import
modules.codeformer_model
as
codeformer
import
modules.extras
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录