What Happens When I Run EDflow¶
config¶
At the heart of every training or evaluation is the config file.
It is a dict that contains the keywords and values you specify in train.yaml.
Some keys are mandatory, like:
- dataset package link to the data set class
- model package link to the model class
- iterator package link to the iterator class
- batch_size how large a batch should be
- num_steps or num_epochs how long should the training be
EDFlow is able to handle multiple config files but typically it is recommended to have a base config file, which is included with the -b option and separate training and evaluation configs can be included on top of that, if needed.
Test_mode is set to true (e.g. for dropout)
Workflow¶
When you have successfully built your model your model with:
edflow -t your_model/train.yaml
This triggers EDFlow’s signature workflow:
The
ProjectManageris initialized
It creates the folder structure, takes a snapshot of the code and keeps track directory addresses through attributes
It is still to decide on the best way to take the snapshot, feel free to participate and contribute
All processes are initialized
if
-toption is given, a training process is startedfor each
-eoption an evaluation process is called
The training process
Loggeris initialized
Datasetis initializedThe batches are built
modelis initialized
#TODO initialize a dummy if no model is given
Trainer/Iteratoris initializedif
--checkointis given, load checkpointIf
--retrainis given, reset global step (begin training with pre-trained model)
Iterator.iterateis called
This is the data loop, only argument is the batched data
tqdm tqdm.github.io is called: for epoch in epochs, for batch in batches
initialize
fetches
nested
dictleaves must be functions i.e.
{global_step:get_global_step()}
feedsare initialized as a copy of batch (this allows to manipulate the feed)all
hooks’before_step(global_step, fetches, feeds, batch)is called
hooks can add data, manipulate feeds(i.e. make numpy arrays tf objects), log batch data…
self.run(fetches, feeds)is called
every function in fetches is called with feeds as argument
global_stepis incrementedall
hooks’after_step(global_step, fetches, feeds, batch)is called
Note
here goes a nice gif of edflow in action