'Setup a model instance, using the specified mode and model parameters.
Load the weights from the specified file, if it exists.
If weights_input_fn is an integer, use that the model name, and
the pattern name, to construct a canonical filename.'

def setup_model(self, mode, model_params=None, weights_input_fn=None):

    model_params = (model_params or {})
    model = (self.model_instance or self.model(mode=mode, **model_params))
    self.model_instance = model
    if weights_input_fn:
        if (type(weights_input_fn) == int):
            weights_input_fn = self.canonical_weights_fn(weights_input_fn)
        if os.path.exists(weights_input_fn):
            model.load(weights_input_fn)
            print(('[TFLearnSeq2Seq]    model    weights    loaded    from    %s' % weights_input_fn))
        else:
            print(('[TFLearnSeq2Seq]    MISSING    model    weights    file    %s' % weights_input_fn))
    return model
