-
Notifications
You must be signed in to change notification settings - Fork 150
Address doc comments in TrainingLoop Callbacks #670
Conversation
dabrahams
left a comment
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.
| case InvalidPath | ||
| } | ||
|
|
||
| /// 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 !?!
|
|
||
| /// 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
dabrahams
left a comment
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 { ... }
}