function for loading model.