Merge branch 'master' into cpu-cmdline-opt

This commit is contained in:
brkirch
2022-10-04 07:42:53 -04:00
committed by GitHub
8 changed files with 109 additions and 80 deletions

View File

@@ -1,3 +1,5 @@
import contextlib
import torch
from modules import errors
@@ -56,3 +58,11 @@ def randn_without_seed(shape):
return torch.randn(shape, device=device)
def autocast():
from modules import shared
if dtype == torch.float32 or shared.cmd_opts.precision == "full":
return contextlib.nullcontext()
return torch.autocast("cuda")