Skip to content

Commit f289633

Browse files
authored
Fix word variable mutability (#325)
1 parent 68548bc commit f289633

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Libraries/Embedders/Bert.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ private class BertEmbedding: Module {
4141
tokenTypeIds: MLXArray? = nil
4242
) -> MLXArray {
4343
let posIds = positionIds ?? broadcast(MLXArray.arange(inputIds.dim(1)), to: inputIds.shape)
44-
let words = wordEmbeddings(inputIds) + positionEmbeddings(posIds)
44+
var words = wordEmbeddings(inputIds) + positionEmbeddings(posIds)
4545
if let tokenTypeIds, let tokenTypeEmbeddings {
4646
words += tokenTypeEmbeddings(tokenTypeIds)
4747
}

Libraries/Embedders/NomicBert.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class NomicEmbedding: Module {
3535
_ inputIds: MLXArray, positionIds: MLXArray? = nil,
3636
tokenTypeIds: MLXArray? = nil
3737
) -> MLXArray {
38-
let words = wordEmbeddings(inputIds)
38+
var words = wordEmbeddings(inputIds)
3939

4040
if let tokenTypeIds, let tokenTypeEmbeddings {
4141
words += tokenTypeEmbeddings(tokenTypeIds)

0 commit comments

Comments
 (0)