from migrating_ignite import *

from fastai.vision.all import *

"""
Explanation: Tutorial - Migrating from Ignite

Incrementally adding fastai goodness to your Ignite training

We're going to use the MNIST training code from Ignite's examples directory (as at August 2020), converted to a module.

Note: 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 if you're using an online viewer such as Colab.
End of explanation
"""


data = DataLoaders(*get_data_loaders(64, 128)).cuda()

"""
Explanation: To use it in fastai, we first pull the DataLoaders from the module into a DataLoaders object:
End of explanation
"""


opt_func = partial(SGD, momentum=0.5)
learn = Learner(data, Net(), loss_func=nn.NLLLoss(), opt_func=opt_func, metrics=accuracy)
learn.fit_one_cycle(1, 0.01)

"""
Explanation: We can now create a Learner and fit:
End of explanation
"""


