class_docstr: seq2seq recurrent neural network, implemented using TFLearn.
class_docstr_tok: ["seq2seq","recurrent","neural","network",",","implemented","using","TFLearn","."]
docstr: 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.
docstr_tok: ["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","."]
code: def setup_model(self, mode, model_params=None, weights_input_fn=None):
      """
      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.
      """
      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
  
imports: from __future__ import division, print_function
  import os
  import sys
  import tflearn
  import argparse
  import json
  import numpy
  import tensorflow.compat.v1
  from tensorflow.contrib.legacy_seq2seq.python.ops import seq2seq
  from tensorflow.python.ops import rnn_cell
label_desc: Use image node_id 8 for calling the TFLearnSeq2Seq obj's underlying member method code with example usage: obj.setup_model(mode, model_params, weights_input_fn) and returns: model