Skip to content
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

Add additional hyperopt callbacks #1388

Merged
merged 2 commits into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ludwig/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@ def on_cmdline(self, cmd, *args):
def on_hyperopt_init(self, experiment_name):
pass

def on_hyperopt_finish(self, experiment_name):
pass

def on_hyperopt_trial_start(self, parameters):
pass

def on_hyperopt_trial_end(self, parameters):
pass

def on_train_init(
self,
base_config,
Expand Down
4 changes: 4 additions & 0 deletions ludwig/hyperopt/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,10 @@ def run_experiment(
random_seed=random_seed,
debug=debug,
)

for callback in callbacks or []:
callback.on_hyperopt_trial_end(parameters)

return train_stats, eval_stats


Expand Down
4 changes: 4 additions & 0 deletions ludwig/hyperopt/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,10 @@ def hyperopt(
save_hyperopt_stats(hyperopt_stats, output_directory)
logger.info('Hyperopt stats saved to: {}'.format(output_directory))

if callbacks:
for callback in callbacks:
callback.on_hyperopt_finish(experiment_name)

logger.info('Finished hyperopt')

return hyperopt_results
Expand Down