Add Keras Tuner integration page (#681)

This commit is contained in:
pollfly 2023-10-02 18:26:17 +03:00 committed by GitHub
parent 7071775813
commit 6bbc11a07e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 74 additions and 4 deletions

View File

@ -1,10 +1,9 @@
---
title: Keras Tuner
displayed_sidebar: mainSidebar
---
:::tip
If you are not already using ClearML, see [Getting Started](../getting_started/ds/ds_first_steps.md) for setup
If you are not already using ClearML, see [Getting Started](../../../getting_started/ds/ds_first_steps.md) for setup
instructions.
:::
@ -41,7 +40,7 @@ When the script runs, it logs:
## Scalars
ClearML logs the scalars from training each network. They appear in the project's page in the **ClearML web UI**, under
ClearML logs the scalars from training each network. They appear in the experiment's page in the **ClearML web UI**, under
**SCALARS**.
![image](../../../img/integration_keras_tuner_06.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -0,0 +1,71 @@
---
title: Keras Tuner
---
:::tip
If you are not already using ClearML, see [Getting Started](../getting_started/ds/ds_first_steps.md) for setup
instructions.
:::
[Keras Tuner](https://www.tensorflow.org/tutorials/keras/keras_tuner) is a library that helps you pick the optimal set
of hyperparameters for training your models. ClearML integrates seamlessly with `kerastuner` and automatically logs
experiment scalars, the output model, and hyperparameter optimization summary.
Integrate ClearML into your Keras Tuner optimization script by doing the following:
* Instantiate a ClearML Task:
```python
from clearml import Task
task = Task.init(task_name="<task_name>", project_name="<project_name>")
```
* Specify `ClearMLTunerLogger` as the Keras Tuner logger:
```python
from clearml.external.kerastuner import ClearmlTunerLogger
import keras_tuner as kt
# Create tuner object
tuner = kt.Hyperband(
build_model,
project_name='kt examples',
logger=ClearMLTunerLogger(), # specify ClearMLTunerLogger
objective='val_accuracy',
max_epochs=10,
hyperband_iterations=6
)
```
And thats it! This creates a [ClearML Task](../fundamentals/task.md) which captures:
* Output Keras model
* Optimization trial scalars - scalar plot showing metrics for all runs
* Hyperparameter optimization summary plot - Tabular summary of hyperparameters tested and their metrics by trial ID
* Source code and uncommitted changes
* Installed packages
* TensorFlow definitions
* Console output
* General details such as machine details, runtime, creation date etc.
* And more
You can view all the task details in the [WebApp](../webapp/webapp_exp_track_visual.md).
## WebApp
ClearML logs the scalars from training each network. They appear in the experiment's **SCALARS** tab in the Web UI.
![Optimization scalars](../img/integration_keras_tuner_06.png)
ClearML automatically logs the parameters of each experiment run in the hyperparameter search. They appear in tabular
form in the experiment's **PLOTS**.
![Optimization plot](../img/integration_keras_tuner_07.png)
ClearML automatically stores the output model. It appears in the experiment's **ARTIFACTS** **>** **Output Model**.
![output model](../img/integration_keras_tuner_03.png)
## Example
See Keras Tuner and ClearML in action in the [keras_tuner_cifar.py](../guides/frameworks/tensorflow/integration_keras_tuner.md)
example script.

View File

@ -62,7 +62,7 @@ module.exports = {
'integrations/autokeras',
'integrations/catboost', 'integrations/click', 'integrations/fastai',
'integrations/hydra',
'integrations/keras', 'guides/frameworks/tensorflow/integration_keras_tuner',
'integrations/keras', 'integrations/keras_tuner',
'integrations/lightgbm', 'integrations/matplotlib',
'integrations/megengine', 'integrations/monai', 'integrations/openmmv', 'integrations/optuna',
'integrations/python_fire', 'integrations/pytorch',