code: def _save_until_eos(ids, skip=False):
    
    ids = ids.flatten()
    if skip:
      return ids
    try:
      index = list(ids).index(text_encoder.EOS_ID)
      return ids[0:index]
    except ValueError:
      # No EOS_ID: return the array as-is.
      return ids
docs: Strips everything after the first <EOS> token, which is normally 1.