add code for training from loading docs and counters