-
Notifications
You must be signed in to change notification settings - Fork 52
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
feat: Allow for customized extra results to be written to results.csv.zip #612
Conversation
return tuner_kwargs | ||
|
||
|
||
def start_benchmark_local_backend( | ||
configuration: ConfigDict, | ||
methods: MethodDefinitions, | ||
benchmark_definitions: RealBenchmarkDefinitions, | ||
post_processing: Optional[PostProcessingType] = None, | ||
final_results: Optional[FinalResultsComposer] = None, |
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.
Replaces post_processing
. Instead of running some code at the end, we extract some extra results which are stored. This is more useful.
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.
Are there any known uses of customers using post_processing
?
I agree that final_results
is a great new feature -- just wondering before we remove post_processing
if there are any use-cases that will break from the removal.
Especially since this is in benchmarking
, I think it's very low-risk to update.
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.
Good point. I don't think anybody except me uses this right now.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #612 +/- ##
==========================================
- Coverage 65.11% 65.10% -0.02%
==========================================
Files 362 363 +1
Lines 26500 26532 +32
==========================================
+ Hits 17256 17274 +18
- Misses 9244 9258 +14
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
syne_tune/results_callback.py
Outdated
def _write_final_results(self): | ||
if self._final_results_composer is not None: | ||
final_results = self._final_results_composer(self._tuner) | ||
if final_results is not None: | ||
path = self._tuner.tuner_path / ST_FINAL_RESULTS_FILENAME | ||
dump_json_with_numpy(final_results, path) |
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.
How does this new method relate to this existing way of getting the final hyperparameters: https://github.com/awslabs/syne-tune/blob/main/examples/launch_plot_results.py#L69
tuning_experiment = load_experiment(tuner.name)
print(tuning_experiment)
print(f"best result found: {tuning_experiment.best_config()}")
Is this _final_results_composer
needed if it's already possible to call .best_config()
? Could we not re-use what .best_config()
is doing?
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.
Final results are not best parameters. They can be anything. In the example I have here, they are statistics recorded by the scheduler, so nothing that would even be in results.csv.zip
.
In the next PR, I am using this to record performance statistics for checkpoint removal. Again, this is not stored in results.csv
.
These final results are optional. If you can obtain your answer from the results.csv
, you should do that. But often, this is not possible.
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.
Did you consider adding the ability to optionally augment the information in results.csv.zip
to include the additional optional information that you want to extract? (Rather than creating a new separate output file, which might confuse users by creating two competing sources-of-truth.)
With the current implementation, I can foresee scenarios where people expect to be able to extract the best hyperparameters from final-results.json
, however they don't find them there. It may become confusing to understand when to look in final-results.json
versus results.csv.zip
.
Or, if we choose not to combine the files, maybe renaming it to something like extra-metadata.json
, so that it's clear that the primary output of tuning, the hyperparameters, will not be included in the 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.
You have a good point, I'll do that
@@ -66,7 +66,7 @@ | |||
|
|||
# Does not contain ASHABORE, because >10 secs on CI | |||
# TODO: Dig more, why is ASHABORE more expensive than BORE here? | |||
@pytest.mark.timeout(10) | |||
@pytest.mark.timeout(12) |
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.
Looks like writing the files to disk makes the test run longer? Is this with intermediate checkpoints enabled, or is this just writing final output to disk?
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 am not sure. I just increased this because I had this test failing. I do not think this has anything to do with the change here, to be honest. The change here is not activated in this test, right? Final results are only written when you activate the feature.
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.
We can bump the limit, but if it was passing reliably before this PR, and starts timing out with this PR, then it would be useful to know why.
Not necessarily a blocker but something interesting
I will rework this, so information is appended to the |
OK, this is totally rewritten. The extra results are now appended to the default ones, by extending the dataframe by additional columns. This has the advantage of not needing another file, and of getting time-stamped results. The disadvantage is we cannot write out final results of complex structure (e.g., lists or dicts). But that is OK. |
if __name__ == "__main__": | ||
logging.getLogger().setLevel(logging.INFO) | ||
|
||
random_seed = 31415927 |
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.
nice seed choice 🥧
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.
Very intuitive, looks good!
At the moment, we write time-stamped results to
results.csv.zip
(a dataframe), and the serialized tuner totuner.dill
.This PR allows to (optionally) write extra results to
results.csv.zip
. These are appended as new columns.An example use case is given.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.