This commit is contained in:
Disty0
2024-01-09 16:07:43 +03:00
parent b206612069
commit 42845b344c
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -105,7 +105,7 @@ class FaceIDItem(BaseModel):
structure: float = Field(title="Structure", default=1, gt=0, le=1, description="Structure to use, must be between 0 and 1.")
rank: float = Field(title="Rank", default=128, ge=4, le=256, description="Rank to use, must be between 4 and 256.")
override_sampler: bool = Field(title="Override Sampler", default=True, description="Should the sampler be overriden?")
tokens: int = Field("Tokens", default=4, ge=1, le=16, description="Amount of tokens to use, must be between 1 and 16.")
tokens: int = Field(title="Tokens", default=4, ge=1, le=16, description="Amount of tokens to use, must be between 1 and 16.")
cache_model: bool = Field(title="Cache", default=True, description="Should the model be cached?")
+2 -2
View File
@@ -124,7 +124,7 @@ def torch_bmm_32_bit(input, mat2, *, out=None):
)
else:
return original_torch_bmm(input, mat2, out=out)
torch.xpu.synchronize()
torch.xpu.synchronize(input.device)
return hidden_states
original_scaled_dot_product_attention = torch.nn.functional.scaled_dot_product_attention
@@ -173,5 +173,5 @@ def scaled_dot_product_attention_32_bit(query, key, value, attn_mask=None, dropo
)
else:
return original_scaled_dot_product_attention(query, key, value, attn_mask=attn_mask, dropout_p=dropout_p, is_causal=is_causal)
torch.xpu.synchronize()
torch.xpu.synchronize(query.device)
return hidden_states
+2 -2
View File
@@ -149,7 +149,7 @@ class SlicedAttnProcessor: # pylint: disable=too-few-public-methods
hidden_states[start_idx:end_idx, start_idx_2:end_idx_2] = attn_slice
del attn_slice
torch.xpu.synchronize()
torch.xpu.synchronize(query.device)
else:
query_slice = query[start_idx:end_idx]
key_slice = key[start_idx:end_idx]
@@ -284,7 +284,7 @@ class AttnProcessor:
hidden_states[start_idx:end_idx] = attn_slice
del attn_slice
torch.xpu.synchronize()
torch.xpu.synchronize(query.device)
else:
attention_probs = attn.get_attention_scores(query, key, attention_mask)
hidden_states = torch.bmm(attention_probs, value)