diff --git a/ldm/simplet2i.py b/ldm/simplet2i.py index 49a9fd38c8..10720a7483 100644 --- a/ldm/simplet2i.py +++ b/ldm/simplet2i.py @@ -280,7 +280,14 @@ class T2I: ), 'can only work with strength in [0.0, 1.0]' width, height, _ = self._resolution_check(width, height, log=True) - scope = autocast if self.precision == 'autocast' else nullcontext + + # TODO: - Check if this is still necessary to run on M1 devices. + # - Move code into ldm.dream.devices to live alongside other + # special-hardware casing code. + if self.precision == 'autocast' and torch.cuda.is_available(): + scope = autocast + else: + scope = nullcontext if sampler_name and (sampler_name != self.sampler_name): self.sampler_name = sampler_name