class_docstr: A complete encoder-decoder model, with optional attention.
  
  A parent class which makes use of the contextual_embedding (such as a charlm)
  can make use of unsaved_modules when saving.
class_docstr_tok: ["A","complete","encoder-decoder","model",",","with","optional","attention",".","A","parent","class","which","makes","use","of","the","contextual_embedding","(","such","as","a","charlm",")","can","make","use","of","unsaved_modules","when","saving","."]
docstr: Predict with greedy decoding. 
docstr_tok: ["Predict","with","greedy","decoding","."]
code: def predict_greedy(self, src, src_mask, pos=None, raw=None):
      """Predict with greedy decoding."""
      enc_inputs, batch_size, src_lens, src_mask = self.embed(
          src, src_mask, pos, raw
      )
  
      # encode source
      h_in, (hn, cn) = self.encode(enc_inputs, src_lens)
  
      if self.edit:
          edit_logits = self.edit_clf(hn)
      else:
          edit_logits = None
  
      # greedy decode by step
      dec_inputs = self.embedding(self.SOS_tensor)
      dec_inputs = dec_inputs.expand(
          batch_size, dec_inputs.size(0), dec_inputs.size(1)
      )
  
      done = [False for _ in range(batch_size)]
      total_done = 0
      max_len = 0
      output_seqs = [[] for _ in range(batch_size)]
  
      while total_done < batch_size and max_len < self.max_dec_len:
          log_probs, (hn, cn) = self.decode(
              dec_inputs, hn, cn, h_in, src_mask, src=src
          )
          assert (
              log_probs.size(1) == 1
          ), "Output must have 1-step of output."
          _, preds = log_probs.squeeze(1).max(1, keepdim=True)
          dec_inputs = self.embedding(preds)  # update decoder inputs
          max_len += 1
          for i in range(batch_size):
              if not done[i]:
                  token = preds.data[i][0].item()
                  if token == constant.EOS_ID:
                      done[i] = True
                      total_done += 1
                  else:
                      output_seqs[i].append(token)
      return output_seqs, edit_logits
  
imports: import logging
  import torch
  from torch import nn
  import torch.nn.functional
  import numpy
  import stanza.models.common.seq2seq_constant
  from stanza.models.common import utils
  from stanza.models.common.seq2seq_modules import LSTMAttention
  from stanza.models.common.beam import Beam
label_desc: Use image node_id 10 for calling the Seq2SeqModel obj's underlying member method code with example usage: obj.predict_greedy(src, src_mask, pos, raw) and returns: output_seqs,  edit_logits