mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-12-06 02:30:30 -08:00
Use devices.autocast instead of torch.autocast
This commit is contained in:
parent
21effd629d
commit
4d5f1691dd
5 changed files with 6 additions and 11 deletions
|
|
@ -148,8 +148,7 @@ class InterrogateModels:
|
|||
|
||||
clip_image = self.clip_preprocess(pil_image).unsqueeze(0).type(self.dtype).to(devices.device_interrogate)
|
||||
|
||||
precision_scope = torch.autocast if shared.cmd_opts.precision == "autocast" else contextlib.nullcontext
|
||||
with torch.no_grad(), precision_scope("cuda"):
|
||||
with torch.no_grad(), devices.autocast():
|
||||
image_features = self.clip_model.encode_image(clip_image).type(self.dtype)
|
||||
|
||||
image_features /= image_features.norm(dim=-1, keepdim=True)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue