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
|
|
@ -82,7 +82,7 @@ class PersonalizedBase(Dataset):
|
|||
torchdata = torch.from_numpy(npimage).permute(2, 0, 1).to(device=device, dtype=torch.float32)
|
||||
latent_sample = None
|
||||
|
||||
with torch.autocast("cuda"):
|
||||
with devices.autocast():
|
||||
latent_dist = model.encode_first_stage(torchdata.unsqueeze(dim=0))
|
||||
|
||||
if latent_sampling_method == "once" or (latent_sampling_method == "deterministic" and not isinstance(latent_dist, DiagonalGaussianDistribution)):
|
||||
|
|
@ -101,7 +101,7 @@ class PersonalizedBase(Dataset):
|
|||
entry.cond_text = self.create_text(filename_text)
|
||||
|
||||
if include_cond and not (self.tag_drop_out != 0 or self.shuffle_tags):
|
||||
with torch.autocast("cuda"):
|
||||
with devices.autocast():
|
||||
entry.cond = cond_model([entry.cond_text]).to(devices.cpu).squeeze(0)
|
||||
|
||||
self.dataset.append(entry)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue