Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't force dtype to torch.long in index_copy #244

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions ai_edge_torch/generative/layers/kv_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ def _update_kv_base_impl(
v_slice: torch.Tensor,
) -> KVCacheEntry:
"""Update the cache buffer without High Level Function Boundary annotation."""
k = cache.k_cache.index_copy(1, input_pos.to(torch.long), k_slice)
v = cache.v_cache.index_copy(1, input_pos.to(torch.long), v_slice)
k = cache.k_cache.index_copy(1, input_pos, k_slice)
v = cache.v_cache.index_copy(1, input_pos, v_slice)
updated_cache = KVCacheEntry(k, v)
return updated_cache

Expand Down
Loading