Added offline training

Basic framework for the offline training