{ "cells": [ { "metadata": {}, "cell_type": "markdown", "source": [ "# Tuning\n", "\n", "Via [pytorch-lightning](https://lightning.ai/docs/pytorch/stable/api/lightning.pytorch.tuner.tuning.Tuner.html) `mml` offers automatic tuning of the initial learning rate as well as the batch size. To activate this behaviour simply refer `tune.lr=true` and `tune.bs=true` respectively. Note that learning rate tuning is activated by default!\n" ], "id": "dec35ad56dc0e6ac" }, { "metadata": {}, "cell_type": "code", "outputs": [], "execution_count": null, "source": "", "id": "df4dd60695d15023" }, { "metadata": {}, "cell_type": "markdown", "source": "To provide more granular access to lightnings tuning options you may use the `tune.lr_kwargs` (or `tune.bs_kwargs`) e.g.", "id": "e6dcdbd41697799a" }, { "metadata": {}, "cell_type": "code", "source": "!mml train tasks=fake tune.lr=true +tune.lr_kwargs.mode=linear +tune.lr_kwargs.early_stop_threshold=2.0 trainer.max_epochs=1", "id": "47bab51af00459b1", "outputs": [], "execution_count": null }, { "metadata": {}, "cell_type": "markdown", "source": "", "id": "182780dd55a1db34" } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.6" } }, "nbformat": 4, "nbformat_minor": 5 }