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

Fix cross attention + prefix cacher v2 support #1006

Merged
merged 1 commit into from
Dec 27, 2024
Merged
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
12 changes: 3 additions & 9 deletions mistralrs-core/src/prefix_cacher_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,10 @@ impl PrefixCacheManagerV2 {
let mut n_on_device = 0;
for cache in self.caches.values() {
let first_non_none = cache.iter().find_or_first(|x| x.is_some());
let Some(first_non_none) = first_non_none else {
let Some(Some(first_non_none)) = first_non_none else {
continue;
};
let cache_device = first_non_none
.as_ref()
.unwrap()
.k
.all_data()
.as_ref()
Expand All @@ -124,12 +122,10 @@ impl PrefixCacheManagerV2 {
break;
}
let first_non_none = cache.iter().find_or_first(|x| x.is_some());
let Some(first_non_none) = first_non_none else {
let Some(Some(first_non_none)) = first_non_none else {
continue;
};
let cache_device = first_non_none
.as_ref()
.unwrap()
.k
.all_data()
.as_ref()
Expand All @@ -151,12 +147,10 @@ impl PrefixCacheManagerV2 {
// Intentionally evict the first ones first, as they are the oldest
for cache in self.caches.values_mut() {
let first_non_none = cache.iter().find_or_first(|x| x.is_some());
let Some(first_non_none) = first_non_none else {
let Some(Some(first_non_none)) = first_non_none else {
continue;
};
let cache_device = first_non_none
.as_ref()
.unwrap()
.k
.all_data()
.as_ref()
Expand Down
Loading