@@ -35,11 +35,12 @@ extension RunAnywhere {
3535
3636 // Log model info for debugging
3737 let logger = SDKLogger ( category: " ModelManagement " )
38- logger. info ( " Loading model: id= \( modelId) , framework= \( modelInfo. framework) , format= \( modelInfo. format) , localPath= \( modelInfo. localPath? . path ?? " nil " ) " )
38+ let localName = modelInfo. localPath? . lastPathComponent ?? " nil "
39+ logger. info ( " Loading model: id= \( modelId) , framework= \( modelInfo. framework) , format= \( modelInfo. format) , localPath= \( localName) " )
3940
4041 // Resolve actual model file path
4142 let modelPath = try resolveModelFilePath ( for: modelInfo)
42- logger. info ( " Resolved model path: \( modelPath. path ) " )
43+ logger. info ( " Resolved model path: \( modelPath. lastPathComponent ) " )
4344 try await CppBridge . LLM. shared. loadModel ( modelPath. path, modelId: modelId, modelName: modelInfo. name)
4445 }
4546
@@ -67,22 +68,22 @@ extension RunAnywhere {
6768
6869 // Check if there's a nested folder with the model name (from archive extraction)
6970 let nestedFolder = modelFolder. appendingPathComponent ( modelId)
70- logger. debug ( " Checking nested folder: \( nestedFolder. path ) " )
71+ logger. debug ( " Checking nested folder: \( nestedFolder. lastPathComponent ) " )
7172
7273 if FileManager . default. fileExists ( atPath: nestedFolder. path) {
7374 var isDir : ObjCBool = false
7475 if FileManager . default. fileExists ( atPath: nestedFolder. path, isDirectory: & isDir) , isDir. boolValue {
7576 // Check if this nested folder contains model files
7677 if hasONNXModelFiles ( at: nestedFolder) {
77- logger. info ( " Found ONNX model at nested path: \( nestedFolder. path ) " )
78+ logger. info ( " Found ONNX model at nested path: \( nestedFolder. lastPathComponent ) " )
7879 return nestedFolder
7980 }
8081 }
8182 }
8283
8384 // Check if model files exist directly in the model folder
8485 if hasONNXModelFiles ( at: modelFolder) {
85- logger. info ( " Found ONNX model at folder: \( modelFolder. path ) " )
86+ logger. info ( " Found ONNX model at folder: \( modelFolder. lastPathComponent ) " )
8687 return modelFolder
8788 }
8889
@@ -93,15 +94,15 @@ extension RunAnywhere {
9394 var isDir : ObjCBool = false
9495 if FileManager . default. fileExists ( atPath: item. path, isDirectory: & isDir) , isDir. boolValue {
9596 if hasONNXModelFiles ( at: item) {
96- logger. info ( " Found ONNX model in subdirectory: \( item. path ) " )
97+ logger. info ( " Found ONNX model in subdirectory: \( item. lastPathComponent ) " )
9798 return item
9899 }
99100 }
100101 }
101102 }
102103
103104 // Fallback to model folder
104- logger. warning ( " No ONNX model files found, falling back to: \( modelFolder. path ) " )
105+ logger. warning ( " No ONNX model files found, falling back to: \( modelFolder. lastPathComponent ) " )
105106 return modelFolder
106107 }
107108
@@ -138,37 +139,37 @@ extension RunAnywhere {
138139 format: model. format
139140 )
140141
141- logger. debug ( " Expected model path: \( expectedPath. path ) " )
142+ logger. debug ( " Expected model path: \( expectedPath. lastPathComponent ) " )
142143
143144 // If expected path exists, use it
144145 if FileManager . default. fileExists ( atPath: expectedPath. path) {
145- logger. info ( " Found model at expected path: \( expectedPath. path ) " )
146+ logger. info ( " Found model at expected path: \( expectedPath. lastPathComponent ) " )
146147 return expectedPath
147148 }
148149
149150 // Find files with the expected extension in model folder
150151 let expectedExtension = model. format. rawValue. lowercased ( )
151152 if let modelFile = findModelFile ( in: modelFolder, extensions: [ expectedExtension, " gguf " , " bin " ] ) {
152- logger. info ( " Found model file: \( modelFile. path ) " )
153+ logger. info ( " Found model file: \( modelFile. lastPathComponent ) " )
153154 return modelFile
154155 }
155156
156157 // Search in nested subdirectories (archives often create nested folders)
157- logger. debug ( " Searching nested directories in: \( modelFolder. path ) " )
158+ logger. debug ( " Searching nested directories in: \( modelFolder. lastPathComponent ) " )
158159 if let contents = try ? FileManager . default. contentsOfDirectory ( at: modelFolder, includingPropertiesForKeys: [ . isDirectoryKey] ) {
159160 for item in contents {
160161 var isDir : ObjCBool = false
161162 if FileManager . default. fileExists ( atPath: item. path, isDirectory: & isDir) , isDir. boolValue {
162163 if let modelFile = findModelFile ( in: item, extensions: [ expectedExtension, " gguf " , " bin " ] ) {
163- logger. info ( " Found model file in nested directory: \( modelFile. path ) " )
164+ logger. info ( " Found model file in nested directory: \( modelFile. lastPathComponent ) " )
164165 return modelFile
165166 }
166167 }
167168 }
168169 }
169170
170171 // Fallback to expected path
171- logger. warning ( " Model file not found, falling back to: \( expectedPath. path ) " )
172+ logger. warning ( " Model file not found, falling back to: \( expectedPath. lastPathComponent ) " )
172173 return expectedPath
173174 }
174175
@@ -243,7 +244,7 @@ extension RunAnywhere {
243244 // Resolve actual model path
244245 let modelPath = try resolveModelFilePath ( for: modelInfo)
245246 let logger = SDKLogger ( category: " RunAnywhere.STT " )
246- logger. info ( " Loading STT model from resolved path: \( modelPath. path ) " )
247+ logger. info ( " Loading STT model from resolved path: \( modelPath. lastPathComponent ) " )
247248 try await CppBridge . STT. shared. loadModel ( modelPath. path, modelId: modelId, modelName: modelInfo. name)
248249 }
249250
@@ -278,7 +279,7 @@ extension RunAnywhere {
278279 // Resolve actual model path
279280 let modelPath = try resolveModelFilePath ( for: modelInfo)
280281 let logger = SDKLogger ( category: " RunAnywhere.TTS " )
281- logger. info ( " Loading TTS voice from resolved path: \( modelPath. path ) " )
282+ logger. info ( " Loading TTS voice from resolved path: \( modelPath. lastPathComponent ) " )
282283 try await CppBridge . TTS. shared. loadVoice ( modelPath. path, voiceId: voiceId, voiceName: modelInfo. name)
283284 }
284285
0 commit comments