Core
Core Building blocks for AutoML Tasks
AutoBackend
¶
optimization_objective(self, config, trainer_config, gpu=0.0)
¶
Defines lightning_objective function which is used by tuner to minimize/maximize the metric.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config |
dict |
key value pair of hyperparameters. |
required |
trainer_config |
dict |
configurations passed directly to Lightning Trainer. |
required |
gpu |
Optional[float] |
GPU per trial |
0.0 |
Backend (Enum)
¶
An enumeration.
AutoModel (BaseAutoModel, ABC)
¶
Base model that defines hyperparameter search methods and initializes Ray
.
All other tasks are implementation of AutoModel
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
datamodule |
flash.DataModule |
DataModule from Flash or PyTorch Lightning |
required |
max_epochs |
[int] |
Maximum number of epochs for which model will train |
required |
max_steps |
Optional[int] |
Maximum number of steps for each epoch. Defaults None. |
required |
optimization_metric |
str |
Value on which hyperparameter search will run. |
required |
n_trials |
int |
Number of trials for HPO |
required |
suggested_conf |
Dict |
Any extra suggested configuration |
required |
timeout |
int |
HPO will stop after timeout |
required |
prune |
bool |
Whether to stop unpromising training. |
required |
backend |
Optional[str] |
Training backend - PL / torch / fastai. Default is PL |
required |
hp_tune(self, name=None, ray_config=None, trainer_config=None, mode=None, gpu=0, cpu=None, resume=False)
¶
Search Hyperparameter and builds model with the best params
automodel = AutoClassifier(data) # implements `AutoModel`
automodel.hp_tune(name="gflow-example", gpu=1)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Optional[str] |
name of the experiment. |
None |
ray_config |
dict |
configuration passed to |
None |
trainer_config |
dict |
configuration passed to |
None |
mode |
Optional[str] |
Whether to maximize or minimize the |
None |
gpu |
Optional[float] |
Amount of GPU resource per trial. |
0 |
cpu |
float |
CPU cores per trial |
None |
resume |
bool |
Whether to resume the training or not. |
False |