Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
799760ab
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
10 个月 前同步成功
通知
1747
Star
81
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
799760ab
编写于
7月 11, 2023
作者:
A
AUTOMATIC1111
提交者:
GitHub
7月 11, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #11722 from akx/mps-gc-fix
Fix MPS cache cleanup
上级
7b833291
b85fc718
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
2 deletion
+17
-2
modules/devices.py
modules/devices.py
+3
-2
modules/mac_specific.py
modules/mac_specific.py
+14
-0
未找到文件。
modules/devices.py
浏览文件 @
799760ab
...
...
@@ -54,8 +54,9 @@ def torch_gc():
with
torch
.
cuda
.
device
(
get_cuda_device_string
()):
torch
.
cuda
.
empty_cache
()
torch
.
cuda
.
ipc_collect
()
elif
has_mps
()
and
hasattr
(
torch
.
mps
,
'empty_cache'
):
torch
.
mps
.
empty_cache
()
if
has_mps
():
mac_specific
.
torch_mps_gc
()
def
enable_tf32
():
...
...
modules/mac_specific.py
浏览文件 @
799760ab
import
logging
import
torch
import
platform
from
modules.sd_hijack_utils
import
CondFunc
from
packaging
import
version
log
=
logging
.
getLogger
()
# before torch version 1.13, has_mps is only available in nightly pytorch and macOS 12.3+,
# use check `getattr` and try it for compatibility.
...
...
@@ -19,9 +23,19 @@ def check_for_mps() -> bool:
return
False
else
:
return
torch
.
backends
.
mps
.
is_available
()
and
torch
.
backends
.
mps
.
is_built
()
has_mps
=
check_for_mps
()
def
torch_mps_gc
()
->
None
:
try
:
from
torch.mps
import
empty_cache
empty_cache
()
except
Exception
:
log
.
warning
(
"MPS garbage collection failed"
,
exc_info
=
True
)
# MPS workaround for https://github.com/pytorch/pytorch/issues/89784
def
cumsum_fix
(
input
,
cumsum_func
,
*
args
,
**
kwargs
):
if
input
.
device
.
type
==
'mps'
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录