Skip to content

Commit 2d6b2b4

Browse files
author
Aegis-AI
committed
test: fix swift 6 strict concurrency Sendable error in safetensors test
1 parent a7d3f50 commit 2d6b2b4

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Tests/MLXLMTests/CorruptSafetensorsTests.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,17 @@ struct CorruptSafetensorsTests {
3333

3434
let dst = MLXArray.zeros([256, 1024])
3535
dst.eval()
36+
37+
struct SendableArray: @unchecked Sendable {
38+
let array: MLXArray
39+
}
40+
let sendableDst = SendableArray(array: dst)
3641

3742
let errState = ThreadSafeError()
3843

3944
DispatchQueue.concurrentPerform(iterations: 16) { i in
4045
errState.catchError {
41-
MLXFast.preadIntoOffset(dst, safetensorsPath: path, tensorName: "weight", expertIndex: UInt32(i), dstOffset: i * 1024 * 4)
46+
MLXFast.preadIntoOffset(sendableDst.array, safetensorsPath: path, tensorName: "weight", expertIndex: UInt32(i), dstOffset: i * 1024 * 4)
4247
}
4348
}
4449

0 commit comments

Comments
 (0)