AutoTrain - Part 1: Ingredients

A Config First ApproachURL copied

As we have discussed in the [previous blog]({% post_url 2021-10-07-auto-train %}), our goal is to decouple moving parts from fixed parts so that a user can focus more time on tweaking parameters and hyperparameters of an experiment and less time setting up the code to train. The first step is going to create a framework that lets user condense, as much as possible, all important information for an experiment into a readable format.

To achieve this we have indentified and tweaked spacy-project's awesome parser. Let's dive straight into a sample configuration file

Below is sample file for storing information about downloading data for mnist -

[project]
version = 0.0.1
name = mnist
root = /home/me/projects/${project.name}

[project.data]
source = https://files.fast.ai/data/examples/mnist_tiny.tgz
root = ${root}/data/
config.ini

And here's the code to parse the data

from torch_snippets.registry import parse
from fastdownload import FastDownload
config = parse('config.ini')

print(config.project.version)    # 0.0.1
print(config.project.data.root)  # /home/me/projects/mnist/data