-
Notifications
You must be signed in to change notification settings - Fork 150
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
Address doc comments in TrainingLoop Callbacks #670
Conversation
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.
Some feedback; GTG now but can give more later.
@@ -7,13 +7,13 @@ public enum CSVLoggerError: Error { | |||
|
|||
/// A handler for logging training and validation statistics to a CSV file. |
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.
I still don't know what a handler is. Still don't think this is a strong abstraction.
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's an observer callback where TrainingLoop is designed upon. https://docs.google.com/document/d/1CtVFhV8OcQ4E7CmNyfFeZu0IgnUPx86tfQGXiHJUXz0/edit?ts=5ebef977#heading=h.b2so9ayrnyyp
You proposed to make it a function in TrainingLoop. Here are some points I'm more in favor of making callbacks wrapped in a separate classes:
- Decouple from TrainingLoop
- Use stored properties to share callback settings
- Follow this pattern for all callbacks
Let's discuss more offline or in seminar meeting !?!
@@ -61,11 +60,17 @@ public class CSVLogger { | |||
} | |||
} | |||
|
|||
/// Writes column names to file header. | |||
/// | |||
/// Column names include "epoch", "batch" and `stats` `name`s. |
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.
/// Column names include "epoch", "batch" and `stats` `name`s. | |
/// Column names are "epoch", "batch" and the `name` of each element of `stats`, in that order. |
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.
Actually the ordering of dictionary elements, for a given dictionary value (its contents) is not deterministic and if this component isn't used in exactly the way you've tested it, it will be printing the wrong stats under a given column, or printing a column that contains statistic A in one row but statistic B in a second row.
I would accept an array of statistic names in the init()
of this component, which determines the column order.
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.
The order will preserve. I made stats
to be an array of tuples instead of dictionary.
0ab86ab
to
022fd81
Compare
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.
LGTM!
This change addressed the doc comments per requested in #668.
Two questions from there remains for further discussion:
extension TrainingLoopProtocol {
public mutating func printProgress(event: TrainingLoopEvent) throws { ... }
}