File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,23 @@ struct MLXServer: AsyncParsableCommand {
5959 let modelId = model
6060
6161 // ── Load model ──
62- let modelConfig = ModelConfiguration ( id: modelId)
62+ // Auto-detect: if --model points to an existing local directory, load
63+ // from disk directly (no download). Otherwise treat as HF repo ID.
64+ let modelConfig : ModelConfiguration
65+ let fileManager = FileManager . default
66+ if fileManager. fileExists ( atPath: modelId) {
67+ var isDir : ObjCBool = false
68+ fileManager. fileExists ( atPath: modelId, isDirectory: & isDir)
69+ if isDir. boolValue {
70+ print ( " [mlx-server] Loading from local directory: \( modelId) " )
71+ modelConfig = ModelConfiguration ( directory: URL ( filePath: modelId) )
72+ } else {
73+ modelConfig = ModelConfiguration ( id: modelId)
74+ }
75+ } else {
76+ modelConfig = ModelConfiguration ( id: modelId)
77+ }
78+
6379 let container = try await LLMModelFactory . shared. loadContainer (
6480 configuration: modelConfig
6581 ) { progress in
You can’t perform that action at this time.
0 commit comments