Allennlp Optuna banner
himkt himkt

Allennlp Optuna

Development community

Description

⚡️ AllenNLP plugin for adding subcommands to use Optuna, making hyperparameter optimization easy

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

allennlp-optuna: Hyperparameter Optimization Library for AllenNLP

`allennlp-optuna` is [AllenNLP](https://github.com/allenai/allennlp) plugin for hyperparameter optimization using [Optuna](https://github.com/optuna/optuna).

Supported environments

Machine \ Device Single GPU Multi GPUs
Single Node :white_check_mark: Partial
Multi Nodes :white_check_mark: Partial

AllenNLP provides a way of distributed training (https://medium.com/ai2-blog/c4d7c17eb6d6). Unfortunately, `allennlp-optuna` doesn't fully support this feature. With multiple GPUs, you can run hyperparameter optimization. But you cannot enable a pruning feature. (For more detail, please see [himkt/allennlp-optuna#20](https://github.com/himkt/allennlp-optuna/issues/20) and [optuna/optuna#1990](https://github.com/optuna/optuna/issues/1990))

Alternatively, `allennlp-optuna` supports distributed optimization with multiple machines. Please read the [tutorial](https://allennlp-optuna.readthedocs.io/en/latest/tutorial/hyperparameter_optimization_at_scale.html) about distributed optimization in `allennlp-optuna`. You can also learn about a mechanism of Optuna in the [paper](https://arxiv.org/pdf/1907.10902.pdf) or [documentation](https://optuna.readthedocs.io/en/stable/).

Documentation

You can read the documentation on [readthedocs](https://allennlp-optuna.readthedocs.io/).

1. Installation

pip install allennlp_optuna

# Create .allennlp_plugins at the top of your repository or $HOME/.allennlp/plugins
# For more information, please see https://github.com/allenai/allennlp#plugins
echo 'allennlp_optuna' >> .allennlp_plugins

2. Optimization

2.1. AllenNLP config

Model configuration written in Jsonnet.

You have to replace values of hyperparameters with jsonnet function `std.extVar`. Remember casting external variables to desired types by `std.parseInt`, `std.parseJson`.

``