Add Trackio Callback for Optuna Registry#377
Open
ParagEkbote wants to merge 7 commits into
Open
Conversation
Member
|
@gen740 Could you review this PR? |
gen740
reviewed
May 31, 2026
gen740
reviewed
May 31, 2026
gen740
reviewed
May 31, 2026
Comment on lines
+93
to
+120
| import optuna | ||
| import optunahub | ||
|
|
||
|
|
||
| module = optunahub.load_module("callbacks/trackio") | ||
| TrackioCallback = module.TrackioCallback | ||
|
|
||
|
|
||
| def objective(trial): | ||
| x = trial.suggest_float("x", -10, 10) | ||
| return (x - 2) ** 2 | ||
|
|
||
|
|
||
| study = optuna.create_study( | ||
| study_name="trackio-demo", | ||
| ) | ||
|
|
||
| trackioc = TrackioCallback( | ||
| project="my-optuna-study", | ||
| ) | ||
|
|
||
| study.optimize( | ||
| objective, | ||
| n_trials=10, | ||
| callbacks=[trackioc], | ||
| ) | ||
|
|
||
| trackioc.finish() |
Member
There was a problem hiding this comment.
I tried running the example locally, and got:
RuntimeError: Call trackio.init() before trackio.log().
It works fine after adding trackio.init(), but maybe it would be more user-friendly to include that setup in the example?
Author
There was a problem hiding this comment.
There was an issue in the implementation of the callback where __call__() did not correctly initialize the trials for trackio. I have updated the callback implementation to fix this and re-tested with the examples which now work correctly.
Co-authored-by: Gen <54583542+gen740@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contributor Agreements
Please read the contributor agreements and if you agree, please click the checkbox below.
Tip
Please follow the Quick TODO list to smoothly merge your PR.
Motivation
As described in the PR, we port the trackio callback from optuna-integration to optuna-registry. A couple of new features have been introduced:
Automatic syncing of optuna trials with
trackio-syncBetter resume semantics for trials.
Could you please review the changes?
cc: @c-bata
Description of the changes
Included a
init.pyandcallback.pywhich are the core files of the packages, also included the relevant license and readme file to describe the working of the callback.TODO List towards PR Merge
Please remove this section if this PR is not an addition of a new package.
Otherwise, please check the following TODO list:
./template/to create your package<COPYRIGHT HOLDER>inLICENSEof your package with your nameREADME.mdin your package__init__.pyfrom __future__ import annotationsat the head of any Python files that include typing to support older Python versionsREADME.mdREADME.md