def create_model(session, forward_only):
 dtype = (tf.float16 if FLAGS.use_fp16 else tf.float32)
 model = seq2seq_model.Seq2SeqModel(FLAGS.from_vocab_size, FLAGS.to_vocab_size, _buckets, FLAGS.size, FLAGS.num_layers, FLAGS.max_gradient_norm, FLAGS.batch_size, FLAGS.learning_rate, FLAGS.learning_rate_decay_factor, forward_only=forward_only, dtype=dtype)
 ckpt = tf.train.get_checkpoint_state(FLAGS.train_dir)
 if (ckpt and tf.train.checkpoint_exists(ckpt.model_checkpoint_path)):
  print(('Reading model parameters from %s' % ckpt.model_checkpoint_path))
  model.saver.restore(session, ckpt.model_checkpoint_path)
 else:
  print('Created model with fresh parameters.')
  session.run(tf.global_variables_initializer())
 return model

def create_model ( session , forward_only ) : dtype = ( tf . float16 if FLAGS . use_fp16 else tf . float32 ) model = seq2seq_model . Seq2SeqModel ( FLAGS . from_vocab_size , FLAGS . to_vocab_size , _buckets , FLAGS . size , FLAGS . num_layers , FLAGS . max_gradient_norm , FLAGS . batch_size , FLAGS . learning_rate , FLAGS . learning_rate_decay_factor , forward_only = forward_only , dtype = dtype ) ckpt = tf . train . get_checkpoint_state ( FLAGS . train_dir ) if ( ckpt and tf . train . checkpoint_exists ( ckpt . model_checkpoint_path ) ) : print ( ( 'Reading model parameters from %s' % ckpt . model_checkpoint_path ) ) model . saver . restore ( session , ckpt . model_checkpoint_path ) else : print ( 'Created model with fresh parameters.' ) session . run ( tf . global_variables_initializer ( ) ) return model
creates a model .