Hmm, I should have notice it earlier. Please implement the whole process with a training object as 

```python
train_obj = Train(**kwargs)
train_obj.main_loop()
```

And you'll be done! :)