code: def model_creator(config):
      from tensorflow.keras.models import Model
      from tensorflow.keras.layers import Input, Dense, LSTM, Dropout
      import tensorflow as tf
  
      inp = Input(shape=(None, config["input_dim"]))
      if "lstm_1_units" in config and "lstm_2_units" in config:
          lstm_units = (config["lstm_1_units"], config["lstm_2_units"])
      else:
          lstm_units = config.get("lstm_units", [32, 32])
      if "dropout_1" in config and "dropout_2" in config:
          dropout_rates = (config["dropout_1"], config["dropout_2"])
      else:
          dropout_rates = config.get("dropouts", 0.2)
      lstm_units = (
          [lstm_units]
          if not isinstance(lstm_units, Iterable)
          else lstm_units
      )
      for i, unit in enumerate(lstm_units):
          return_sequences = True if i != len(lstm_units) - 1 else False
          dropout_rate = (
              dropout_rates[i]
              if isinstance(dropout_rates, Iterable)
              else dropout_rates
          )
          lstm_input = inp if i == 0 else dropout
          lstm = LSTM(units=unit, return_sequences=return_sequences)(
              lstm_input
          )
          dropout = Dropout(rate=dropout_rate)(lstm)
      out = Dense(config["output_dim"])(dropout)
      model = Model(inputs=inp, outputs=out)
      model.compile(
          loss=config.get("loss", "mse"),
          optimizer=getattr(
              tf.keras.optimizers, config.get("optim", "Adam")
          )(learning_rate=config.get("lr", 0.001)),
          metrics=[config.get("metric", "mse")],
      )
      return model
  
file_path: BigDL/python/chronos/src/bigdl/chronos/model/tf1/VanillaLSTM_keras.py
imports: from bigdl.orca.automl.model.base_keras_model import KerasBaseModel
  from collections.abc import Iterable
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: model_creator(config) and returns: model