Skip to content

Commit d9552e8

Browse files
authored
adopt mlx-swift 0.25.4 (#313)
* adopt mlx-swift 0.25.4 * - fix #274 * - fix #273 * update imports per current mlx-swift structure * use boolean mask * add missing model config, debug switch layers with recent updates * add some simple eval tests -- make sure we can run values through a model, lora train * linear dimensions now account for quantization
1 parent f289633 commit d9552e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+350
-170
lines changed

Applications/LLMEval/ContentView.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import AsyncAlgorithms
44
import MLX
55
import MLXLLM
66
import MLXLMCommon
7-
import MLXRandom
87
import MarkdownUI
98
import Metal
109
import SwiftUI

Applications/LoRATrainingExample/ContentView.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import MLXLLM
55
import MLXLMCommon
66
import MLXNN
77
import MLXOptimizers
8-
import MLXRandom
98
import SwiftUI
109
import Tokenizers
1110

Applications/MNISTTrainer/ContentView.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import MLX
44
import MLXMNIST
55
import MLXNN
66
import MLXOptimizers
7-
import MLXRandom
87
import SwiftUI
98

109
struct TrainingView: View {

Applications/VLMEval/ContentView.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import AsyncAlgorithms
55
import CoreImage
66
import MLX
77
import MLXLMCommon
8-
import MLXRandom
98
import MLXVLM
109
import PhotosUI
1110
import SwiftUI

Libraries/Embedders/Bert.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright © 2024 Apple Inc.
22

33
import MLX
4-
import MLXFast
54
import MLXNN
65

76
extension MLXArray {

Libraries/Embedders/Load.swift

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import Foundation
44
@preconcurrency import Hub
55
import MLX
66
import MLXNN
7-
import MLXRandom
87
import Tokenizers
98

109
struct EmbedderError: Error {
@@ -119,26 +118,3 @@ public func loadModelContainer(
119118
return try await ModelContainer(
120119
hub: hub, modelDirectory: modelDirectory, configuration: configuration)
121120
}
122-
123-
// TODO remove once mlx-swift update is adopted
124-
func quantize(
125-
model: Module,
126-
filter: (String, Module) -> (groupSize: Int, bits: Int)?,
127-
apply: (Module, Int, Int) -> Module? = quantizeSingle(layer:groupSize:bits:)
128-
) {
129-
let updates =
130-
model
131-
.leafModules()
132-
.flattened()
133-
.compactMap { (path, m) -> (String, Module)? in
134-
if let (groupSize, bits) = filter(path, m) {
135-
if let quantized = apply(m, groupSize, bits) {
136-
return (path, quantized)
137-
}
138-
}
139-
140-
return nil
141-
}
142-
143-
model.update(modules: ModuleChildren.unflattened(updates))
144-
}

Libraries/Embedders/NomicBert.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import Foundation
44
import MLX
5-
import MLXFast
65
import MLXNN
76

87
class NomicEmbedding: Module {

Libraries/Embedders/Pooling.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import Foundation
44
import MLX
5-
import MLXFast
65
import MLXLinalg
76
import MLXNN
87

Libraries/MLXLLM/LLMModelFactory.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ public class LLMRegistry: AbstractModelRegistry, @unchecked Sendable {
236236
qwen3_1_7b_4bit,
237237
qwen3_4b_4bit,
238238
qwen3_8b_4bit,
239+
qwen3MoE_30b_a3b_4bit,
239240
smolLM_135M_4bit,
240241
mimo_7b_sft_4bit,
241242
glm4_9b_4bit,

Libraries/MLXLLM/LoraTrain.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import MLX
55
import MLXLMCommon
66
import MLXNN
77
import MLXOptimizers
8-
import MLXRandom
98
import Tokenizers
109

1110
/// Equivalent to `lora.py/iterate_batches()`. Used internally by ``LoRATrain``.

0 commit comments

Comments
 (0)