Repository navigation
fix CI tests on main - #857
davidkoski wants to merge 1 commit into
Conversation
| try makeHybridAttentionKVCache( | ||
| parameters: parameters, slidingWindow: slidingWindow, | ||
| usesSlidingWindow: $0 == .slidingAttention) | ||
| usesSlidingWindow: $0 == .slidingAttention, headDim: headDim) |
| return try makeSlidingWindowKVCache(parameters: parameters, window: slidingWindow) | ||
| } | ||
| return try makeAttentionKVCache(parameters: parameters) | ||
| return try makeAttentionKVCache(parameters: parameters, headDim: headDim) |
|
|
||
| /// The layer compresses once it holds more than this many tokens. `nil` | ||
| /// when the layer does not compress. | ||
| /// when the layer does not compress or starts compressed. |
There was a problem hiding this comment.
Side effect of this fix (qwen3 behavior from #704 now in the reranker)
| if let configuration { | ||
| probeParameters?.kvCache = KVCacheConfiguration( | ||
| capacity: configuration.capacity, compatibility: configuration.compatibility, | ||
| rewind: configuration.rewind) | ||
| probeParameters?.maxKVSize = nil | ||
| probeParameters?.kvBits = nil | ||
| probeParameters?.kvScheme = nil | ||
| probeParameters?.kvGroupSize = 64 | ||
| probeParameters?.quantizedKVStart = 0 | ||
| } | ||
| let cache = try newCache(parameters: probeParameters) |
| #expect(abs(chunked.query - reference.query).max().item(Float.self) < 1e-4) | ||
| // TF32 matmuls (neural accelerators) leave ~1.2e-3 at step size 1; see MatmulPrecision. | ||
| expectClose(chunked.documents, reference.documents, atol: 1e-4, reducedAtol: 5e-3) | ||
| expectClose(chunked.query, reference.query, atol: 1e-4, reducedAtol: 5e-3) |
There was a problem hiding this comment.
Two NAX fixes, just use MatmulPrecision
|
Aarg, sorry about this one, I need to start avoiding optional params: #704's public enum KVCacheStart: Sendable {
/// The model's attention reads compressed caches from the first prefill.
case compressed(headDim: Int)
/// Prefill fills a full-precision cache and converts it afterwards.
case deferred
}
public func makeAttentionKVCache(
parameters: GenerateParameters?, start: KVCacheStart
) throws -> KVCache
@available(*, deprecated, message: "Pass start: explicitly")
public func makeAttentionKVCache(
parameters: GenerateParameters?, headDim: Int? = nil
) throws -> KVCache {
try makeAttentionKVCache(
parameters: parameters,
start: headDim.map { .compressed(headDim: $0) } ?? .deferred)
}@davidkoski what do you think? The same goes for |
|
No worries -- a lot of PRs in the same area, it is bound to happen. I suppose I should trigger a rebase before merging if I see some in the same area. Anyway, that is why it is not wise to deploy off Yes, I think non-optional might be the way to go here (with the deprecation) and the enum makes sense. Do you want to make the fix -- it is easier for me to review your change than get people on my side to review mine (people are out for conferences, vacation, etc). Feel free to lift any (or none) of this that you want. |
|
Thanks @davidkoski added in #858 , please note there are a lot of changes to conform to this new typed rule, this should help even when people just blindly use agents as this force the agent to think about a choice ... |
|
Replaced with #858 |
Proposed changes
Checklist
Put an
xin the boxes that apply.pre-commit run --all-filesto format my code / installed pre-commit prior to committing changesAI usage
accurately describes the code changes.