docstr: Loads each model in filenames
  
  If foundation_cache is None, we build one on our own,
  as the expectation is the models will reuse modules
  such as pretrain, charlm, bert
docstr_tok: ["Loads","each","model","in","filenames","If","foundation_cache","is","None",",","we","build","one","on","our","own",",","as","the","expectation","is","the","models","will","reuse","modules","such","as","pretrain",",","charlm",",","bert"]
code: def __init__(self, filenames, args, foundation_cache=None):
      """
      Loads each model in filenames
  
      If foundation_cache is None, we build one on our own,
      as the expectation is the models will reuse modules
      such as pretrain, charlm, bert
      """
      if foundation_cache is None:
          foundation_cache = FoundationCache()
  
      if isinstance(filenames, str):
          filenames = [filenames]
      logger.info(
          "Models used for ensemble:\n  %s", "\n  ".join(filenames)
      )
      self.models = [
          Trainer.load(
              filename,
              args,
              load_optimizer=False,
              foundation_cache=foundation_cache,
          ).model
          for filename in filenames
      ]
  
      for model_idx, model in enumerate(self.models):
          if (
              self.models[0].transition_scheme()
              != model.transition_scheme()
          ):
              raise ValueError(
                  "Models {} and {} are incompatible.  {} vs {}".format(
                      filenames[0],
                      filenames[model_idx],
                      self.models[0].transition_scheme(),
                      model.transition_scheme(),
                  )
              )
          if self.models[0].transitions != model.transitions:
              raise ValueError(
                  "Models %s and %s are incompatible: different transitions"
                  % (filenames[0], filenames[model_idx])
              )
          if self.models[0].constituents != model.constituents:
              raise ValueError(
                  "Models %s and %s are incompatible: different constituents"
                  % (filenames[0], filenames[model_idx])
              )
          if self.models[0].root_labels != model.root_labels:
              raise ValueError(
                  "Models %s and %s are incompatible: different root_labels"
                  % (filenames[0], filenames[model_idx])
              )
          if self.models[0].uses_xpos() != model.uses_xpos():
              raise ValueError(
                  "Models %s and %s are incompatible: different uses_xpos"
                  % (filenames[0], filenames[model_idx])
              )
          if (
              self.models[0].reverse_sentence()
              != model.reverse_sentence()
          ):
              raise ValueError(
                  "Models %s and %s are incompatible: different reverse_sentence"
                  % (filenames[0], filenames[model_idx])
              )
  
      self._reverse_sentence = self.models[0].reverse_sentence()
  
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 1 to create a new Ensemble object  with example: obj = Ensemble(filenames, args, foundation_cache)