{ "cells": [ { "cell_type": "raw", "id": "e1890283", "metadata": {}, "source": [ "---\n", "skip_exec: true\n", "---" ] }, { "cell_type": "markdown", "id": "9f3e120d", "metadata": {}, "source": [ "# Ignite with fastai\n", "\n", "> Incrementally adding fastai goodness to your Ignite training" ] }, { "cell_type": "markdown", "id": "f6a4f086", "metadata": {}, "source": [ "We're going to use the MNIST training code from Ignite's examples directory (as at August 2020), converted to a module.\n", "\n", ":::{.callout-note}\n", "\n", "The source script for `migrating_ignite` is in the `examples` subdirectory of this folder if you checked out the `fastai` repo from git, or can be downloaded from [here](https://github.com/fastai/fastai/blob/master/nbs/examples/migrating_ignite.py) if you're using an online viewer such as Colab.\n", "\n", ":::" ] }, { "cell_type": "code", "execution_count": null, "id": "0d2f31b5", "metadata": {}, "outputs": [], "source": [ "from migrating_ignite import *\n", "\n", "from fastai.vision.all import *" ] }, { "cell_type": "markdown", "id": "c6e2a9d7", "metadata": {}, "source": [ "To use it in fastai, we first pull the DataLoaders from the module into a `DataLoaders` object:" ] }, { "cell_type": "code", "execution_count": null, "id": "c991d7cc", "metadata": {}, "outputs": [], "source": [ "data = DataLoaders(*get_data_loaders(64, 128)).cuda()" ] }, { "cell_type": "markdown", "id": "bbc4804d", "metadata": {}, "source": [ "We can now create a `Learner` and fit:" ] }, { "cell_type": "code", "execution_count": null, "id": "a9969f49", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| epoch | \n", "train_loss | \n", "valid_loss | \n", "accuracy | \n", "time | \n", "
|---|---|---|---|---|
| 0 | \n", "0.999266 | \n", "0.597913 | \n", "0.856200 | \n", "00:22 | \n", "