Skip to content

Instantly share code, notes, and snippets.

@himkt
Created July 22, 2020 06:00
Show Gist options
  • Save himkt/08fedc4bd532a8ccb440fd286084ce0c to your computer and use it in GitHub Desktop.
Save himkt/08fedc4bd532a8ccb440fd286084ce0c to your computer and use it in GitHub Desktop.
from optuna.integration import AllenNLPExecutor
import optuna
def objective(trial: optuna.Trial) -> float:
trial.suggest_float("embedding_dropout", 0.0, 0.5)
executor = AllenNLPExecutor(trial, "./config.jsonnet", "result", include_package="allennlp_models")
return executor.run()
if __name__ == "__main__":
study = optuna.create_study()
study.optimize(objective, n_trials=10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment