AutoTrain - Part 1: Ingredients
- First we are creating a new registry called
download_function
- The function is created with a decorator
- The function itself is wrapped to return the main function of interest, because we want our
project.data.download object to be a callable function and not some static variable.
from torch_snippets.registry import registry
registry.create('download_function')
@registry.download_function.register("download_mnist")
def wrapper(base, source_url):
def fastdownloader():
import fastdownload
downloader = fastdownload.FastDownload(
base=base,
data='./',
module=fastdownload)
return downloader.get(source_url)
return fastdownloader
custom_functions.py