docstr: Read from the data_iterator batch_size trees and turn them into N lists of parsing states
docstr_tok: ["Read","from","the","data_iterator","batch_size","trees","and","turn","them","into","N","lists","of","parsing","states"]
code: def build_batch_from_trees(self, batch_size, data_iterator):
      """
      Read from the data_iterator batch_size trees and turn them into N lists of parsing states
      """
      state_batch = []
      for _ in range(batch_size):
          gold_tree = next(data_iterator, None)
          if gold_tree is None:
              break
          state_batch.append(gold_tree)
  
      if len(state_batch) > 0:
          state_batch = [
              model.initial_state_from_gold_trees(state_batch)
              for model in self.models
          ]
          state_batch = list(zip(*state_batch))
      return state_batch
  
imports: import argparse
  import logging
  import os
  import torch
  from stanza.models.common import utils
  from stanza.models.common.foundation_cache import FoundationCache
  from stanza.models.constituency import parse_transitions
  from stanza.models.constituency import retagging
  from stanza.models.constituency import tree_reader
  from stanza.models.constituency.trainer import Trainer, run_dev_set, parse_text, parse_dir
  from stanza.models.constituency.utils import add_predict_output_args, postprocess_predict_output_args, retag_trees
  from stanza.resources.common import DEFAULT_MODEL_DIR
  from stanza.server.parser_eval import EvaluateParser, ParseResult, ScoredTree
  from stanza.utils.default_paths import get_default_paths
label_desc: Use image node_id 6 for calling the Ensemble obj's underlying member method code with example usage: obj.build_batch_from_trees(batch_size, data_iterator) and returns: state_batch