Skip to content

Commit

Permalink
Fix bug on mis-match of quantization block size.
Browse files Browse the repository at this point in the history
  • Loading branch information
liuliu committed Aug 1, 2024
1 parent 1ae29f1 commit e2dad36
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nnc/Store.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2273,7 +2273,7 @@ private let q4pEncodeWithExternalStore:
let length = encodedSize[0] - MemoryLayout<UInt32>.size
let offset = store.writeBytes(encoded + MemoryLayout<UInt32>.size, length: length)
encodedSize[0] = 8 + 8 + 8 // Block size, start offset, length.
encoded.storeBytes(of: UInt32(1024), as: UInt32.self)
encoded.storeBytes(of: UInt32(512), as: UInt32.self)
(encoded + MemoryLayout<UInt64>.size).storeBytes(of: UInt64(offset), as: UInt64.self)
(encoded + MemoryLayout<UInt64>.size * 2).storeBytes(of: UInt64(length), as: UInt64.self)
if let identifier = identifier {
Expand All @@ -2300,7 +2300,7 @@ private let q5pEncodeWithExternalStore:
let length = encodedSize[0] - MemoryLayout<UInt32>.size
let offset = store.writeBytes(encoded + MemoryLayout<UInt32>.size, length: length)
encodedSize[0] = 8 + 8 + 8 // Block size, start offset, length.
encoded.storeBytes(of: UInt32(2048), as: UInt32.self)
encoded.storeBytes(of: UInt32(1024), as: UInt32.self)
(encoded + MemoryLayout<UInt64>.size).storeBytes(of: UInt64(offset), as: UInt64.self)
(encoded + MemoryLayout<UInt64>.size * 2).storeBytes(of: UInt64(length), as: UInt64.self)
if let identifier = identifier {
Expand Down

0 comments on commit e2dad36

Please sign in to comment.