fix scope being set to autocast even for m1

This commit is contained in:
gabrielrotbart 2022-09-02 14:55:24 +03:00
parent 3ee82d8a3b
commit f4a19af04f

View File

@ -280,7 +280,10 @@ class T2I:
), 'can only work with strength in [0.0, 1.0]' ), 'can only work with strength in [0.0, 1.0]'
width, height, _ = self._resolution_check(width, height, log=True) width, height, _ = self._resolution_check(width, height, log=True)
scope = autocast if self.precision == 'autocast' else nullcontext if self.precision == 'autocast' and torch.cuda.is_available():
scope = autocast
else:
scope = nullcontext
if sampler_name and (sampler_name != self.sampler_name): if sampler_name and (sampler_name != self.sampler_name):
self.sampler_name = sampler_name self.sampler_name = sampler_name