code: def prepare_initial_acoustic_model(
      dir, run_opts, srand=-1, input_model=None
  ):
      """This function adds the first layer; It will also prepare the acoustic
      model with the transition model.
      If 'input_model' is specified, no initial network preparation(adding
      the first layer) is done and this model is used as initial 'raw' model
      instead of '0.raw' model to prepare '0.mdl' as acoustic model by adding the
      transition model.
      """
      if input_model is None:
          common_train_lib.prepare_initial_network(
              dir, run_opts, srand=srand
          )
  
      # The model-format for a 'chain' acoustic model is just the transition
      # model and then the raw nnet, so we can use 'cat' to create this, as
      # long as they have the same mode (binary or not binary).
      # We ensure that they have the same mode (even if someone changed the
      # script to make one or both of them text mode) by copying them both
      # before concatenating them.
      common_lib.execute_command(
          """{command} {dir}/log/init_mdl.log \
                  nnet3-am-init {dir}/0.trans_mdl {raw_mdl} \
                  {dir}/0.mdl""".format(
              command=run_opts.command,
              dir=dir,
              raw_mdl=(
                  input_model
                  if input_model is not None
                  else "{0}/0.raw".format(dir)
              ),
          )
      )
  
file_path: espnet/egs2/puebla_nahuatl/st1/steps/libs/nnet3/train/chain_objf/acoustic_model.py
imports: from __future__ import division
  from __future__ import print_function
  import logging
  import math
  import os
  import sys
  import libs.common
  import libs.nnet3.train.common
label_desc: Use image node_id 8 for calling a global function with example usage: prepare_initial_acoustic_model(dir, run_opts, srand, input_model) without return types