fix NaN issue when running without --precision half

This commit is contained in:
AUTOMATIC1111 2024-06-16 14:09:32 +03:00
parent 80f618ea95
commit 06d0a5ab4d
2 changed files with 3 additions and 3 deletions

View File

@ -262,8 +262,7 @@ class SDClipModel(torch.nn.Module, ClipTokenWeightEncoder):
def forward(self, tokens):
backup_embeds = self.transformer.get_input_embeddings()
device = backup_embeds.weight.device
tokens = torch.LongTensor(tokens).to(device)
tokens = torch.asarray(tokens, dtype=torch.int64, device=backup_embeds.weight.device)
outputs = self.transformer(tokens, intermediate_output=self.layer_idx, final_layer_norm_intermediate=self.layer_norm_hidden_state)
self.transformer.set_input_embeddings(backup_embeds)
if self.layer == "last":

View File

@ -149,6 +149,7 @@ class SD3Inferencer(torch.nn.Module):
return contextlib.nullcontext()
def get_learned_conditioning(self, batch: list[str]):
with devices.without_autocast():
return self.cond_stage_model(batch)
def apply_model(self, x, t, cond):