class_docstr: Tower Generator base class for Phoenix.
class_docstr_tok: ["Tower","Generator","base","class","for","Phoenix","."]
docstr: Builds the neural network from an existing checkpoint.
  
  This function builds or replicates the model network given a model_dir with
  a checkpoint.
  
  Args:
    model_dir: a string holding the directory of the model. Must have a
      checkpoint in it.
    trial_mode: the TrialMode for the current Phoenix trial.
    logits_dimension: An int holding the dimension of the logits (number of
      classes for the multi class problem).
    is_training: a boolean indicating if we are in training.
  
  Returns:
    A list of LogitsSpec, and a list of architectures (I.e., one LogitsSpec
    and one architecture per tower that the generator creates).
docstr_tok: ["Builds","the","neural","network","from","an","existing","checkpoint",".","This","function","builds","or","replicates","the","model","network","given","a","model_dir","with","a","checkpoint",".","Args",":","model_dir",":","a","string","holding","the","directory","of","the","model",".","Must","have","a","checkpoint","in","it",".","trial_mode",":","the","TrialMode","for","the","current","Phoenix","trial",".","logits_dimension",":","An","int","holding","the","dimension","of","the","logits","(","number","of","classes","for","the","multi","class","problem",")",".","is_training",":","a","boolean","indicating","if","we","are","in","training",".","Returns",":","A","list","of","LogitsSpec",",","and","a","list","of","architectures","(","I.e.",",","one","LogitsSpec","and","one","architecture","per","tower","that","the","generator","creates",")","."]
code: def _build_from_existing_checkpoint(
      self, model_dir, trial_mode, logits_dimension, is_training
  ):
      """Builds the neural network from an existing checkpoint.
  
      This function builds or replicates the model network given a model_dir with
      a checkpoint.
  
      Args:
        model_dir: a string holding the directory of the model. Must have a
          checkpoint in it.
        trial_mode: the TrialMode for the current Phoenix trial.
        logits_dimension: An int holding the dimension of the logits (number of
          classes for the multi class problem).
        is_training: a boolean indicating if we are in training.
  
      Returns:
        A list of LogitsSpec, and a list of architectures (I.e., one LogitsSpec
        and one architecture per tower that the generator creates).
      """
  
      del trial_mode  # Unused. Only used in subclasses.
  
      logging.info("Building from existing checkpoint.")
      num_towers = architecture_utils.get_number_of_towers(
          model_dir, self.generator_name()
      )
      towers = []
      for i in range(num_towers):
          tower_name = self.generator_name() + "_{}".format(str(i))
          tower_ = tower.Tower.load(
              phoenix_spec=self._phoenix_spec,
              original_tower_name=tower_name,
              new_tower_name=tower_name,
              model_directory=model_dir,
              new_model_directory=model_dir,
              is_training=is_training,
              logits_dimension=logits_dimension,
              force_freeze=False,
              allow_auxiliary_head=self._allow_auxiliary_head,
              skip_initialization=True,
          )
          towers.append(tower_)
  
      architecture_utils.set_number_of_towers(
          self.generator_name(), num_towers
      )
      return towers
  
file_path: model_search/model_search/generators/base_tower_generator.py
imports: import abc
  import os
  import time
  from typing import List
  from absl import logging
  from model_search.architecture import architecture_utils
  from model_search.architecture import tower
  import tensorflow.compat.v2
label_desc: Use image node_id 5 for calling the BaseTowerGenerator obj's underlying member method code with example usage: obj._build_from_existing_checkpoint(model_dir, trial_mode, logits_dimension, is_training) and returns: towers