Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion optimum/executorch/attentions/custom_kv_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def from_legacy_cache(
dtype = legacy_cache.k_cache.dtype

# assert device is None or device == "cpu"
assert dtype is None or dtype == torch.float32
assert dtype is None or dtype in (torch.float32, torch.bfloat16, torch.float16)

# Use the legacy cache's max_seq_len if max_cache_len is not specified
if max_cache_len is None and hasattr(legacy_cache, "max_seq_len"):
Expand Down
4 changes: 0 additions & 4 deletions optimum/executorch/attentions/custom_sdpa.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@ def custom_sdpa_with_start_pos_forward(
key = key.transpose(1, 2)
value = value.transpose(1, 2)

# Convert the hell out of the inputs to fp32 and back
input_dtype = query.dtype
query = query.to(torch.float32)
key = key.to(torch.float32)
value = value.to(torch.float32)

# Ignore the causal flag from kwargs but use the one in module
kwargs.pop("is_causal", None)
Expand Down
Loading