Skip to content

Commit f4a19af

Browse files
author
gabrielrotbart
committed
fix scope being set to autocast even for m1
1 parent 3ee82d8 commit f4a19af

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ldm/simplet2i.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,10 @@ def process_image(image,seed):
280280
), 'can only work with strength in [0.0, 1.0]'
281281

282282
width, height, _ = self._resolution_check(width, height, log=True)
283-
scope = autocast if self.precision == 'autocast' else nullcontext
283+
if self.precision == 'autocast' and torch.cuda.is_available():
284+
scope = autocast
285+
else:
286+
scope = nullcontext
284287

285288
if sampler_name and (sampler_name != self.sampler_name):
286289
self.sampler_name = sampler_name

0 commit comments

Comments
 (0)