性能优化

性能优化20261030-submit
This commit is contained in:
2026-10-30 15:38:33 +08:00
parent 064e3d2132
commit 6738bff892
4 changed files with 310 additions and 61 deletions
+6
View File
@@ -30,6 +30,12 @@ import threading
import torch
# cuDNN benchmark 模式:首次遇到某卷积形状时自动搜索最快算法,后续复用。
# 对本项目意义:DiT / VAE 含大量 Conv2d,tile 尺寸在单次运行内固定,
# benchmark 缓存命中率高,可带来 5~15% 卷积加速。代价是首次推理多几秒预热。
if torch.cuda.is_available():
torch.backends.cudnn.benchmark = True
# 全局注册表:本项目创建的所有 ModelPatcher
_PATCHERS: list["ModelPatcher"] = []