Repository navigation
switch to MLXLogger #702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
switch to MLXLogger #702
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,10 +20,7 @@ import MLXLMCommon | |
| /// KV cache. | ||
| public enum GuidedGenerationLoop { | ||
|
|
||
| private static let logger = Logger( | ||
| subsystem: "com.apple.FoundationModels-MLX", | ||
| category: "GuidedGenerationLoop" | ||
| ) | ||
| private static let logger = MLXLogger(label: "GuidedGenerationLoop") | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, it seems Linux doesn't surface categories at all, so output from MLXLogger on Linux may be very nondescript.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would have the label only (it is just printfs). If we were to add an optional category then the printf logger could show that as well. |
||
|
|
||
| /// Result of a single generation step. | ||
| enum StepResult { | ||
|
|
||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ import Foundation | |
| import MLX | ||
| import MLXNN | ||
|
|
||
| private let logger = Logger(subsystem: "mlx-swift-lm", category: "paroquant") | ||
| private let logger = MLXLogger(label: "paroquant") | ||
|
|
||
| // MARK: - Detection | ||
|
|
||
|
|
@@ -790,8 +790,8 @@ public func loadParoQuantModel<T: LanguageModel>( | |
| phaseTimes | ||
| .map { String(format: "%@=%.2fs", $0.0, $0.1) } | ||
| .joined(separator: " ") | ||
| logger.notice( | ||
| "ParoQuant load phases: \(breakdown, privacy: .public) total=\(String(format: "%.2f", totalSeconds), privacy: .public)s" | ||
| logger.info( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I notice that the .info log level isn't saved to disk. If we think any of this stuff might be used for retrospective debugging, that's something to consider. There's a limitation in MLXLogger though - if we wanted to write these to disk, the next level up is "warning" which maps to OSLogType's .error, which is probably too strong. I'm not sure if it was intended that In any case, these are questions about MLXLogger itself. I don't think anything we're losing in persistent logging is too critical, except perhaps the "not enough disk space" one, that one could be interesting.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True and I think your last comment is correct: this is about MLXLogger (mostly) and what it supports. In this case I think
Anyway, good call out -- it is a change in behavior and I agree warning is not the right word here. |
||
| "ParoQuant load phases: \(breakdown) total=\(String(format: "%.2f", totalSeconds))s" | ||
| ) | ||
|
|
||
| // 12b. Persist the Prepared Checkpoint in the background when this load | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like because of how MLXLogger works, everything that uses it ends up in the
mlx-swiftsubsystem. I wonder, as more repos adopt MLXLogger, if this is going to get a bit messy.I see that we're using categories here, but there's no way, for example, to filter down to "everything from mlx-swift-lm". This isn't a major issue but may become annoying depending on the volume.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, and perhaps that would be a good enhancement for MLXLogger. It does match swift-log in that regard (just using a label).