code: def train_multi_task(
      train_tbl_data,
      valid_tbl_data,
      save_path,
      model,
      cat_cols,
      continuous_cols,
      feature_max_idx,
  ):
      column_info = {
          "cat_cols": cat_cols,
          "continuous_cols": continuous_cols,
          "feature_max_idx": feature_max_idx,
          "embed_cols": [],
          "embed_in_dims": [],
          "embed_out_dims": [],
          "label": ["duration", "click"],
      }
  
      config = {
          "column_info": column_info,
          "inter_op_parallelism": 4,
          "intra_op_parallelism": 8,
          "model_type": model,  # mmoe or ple
      }
  
      batch_size = 256
      estimator = Estimator.from_keras(
          model_creator=model_creator, verbose=False, config=config
      )
  
      train_count = train_tbl_data.size()
      print("Total number of train records: {}".format(train_count))
      total_steps = math.ceil(train_count / batch_size)
      steps_per_epoch = 50
      # To train the full dataset for an entire epoch
      epochs = math.ceil(total_steps / steps_per_epoch)
      val_count = valid_tbl_data.size()
      print("Total number of val records: {}".format(val_count))
      val_steps = math.ceil(val_count / batch_size)
      callbacks = [
          EarlyStopping(
              monitor="val_duration_mae",
              mode="min",
              verbose=1,
              patience=3,
          ),
          EarlyStopping(
              monitor="val_click_auc", mode="max", verbose=1, patience=3
          ),
      ]
  
      start = time()
      estimator.fit(
          data=train_tbl_data.df,
          epochs=epochs,
          batch_size=batch_size,
          steps_per_epoch=steps_per_epoch,
          validation_data=valid_tbl_data.df,
          validation_steps=val_steps,
          callbacks=callbacks,
          feature_cols=feature_cols(column_info),
          label_cols=label_cols(column_info),
      )
      end = time()
      print("Training time is: ", end - start)
      estimator.save(save_path)
      print("Save model to path: ", save_path)
  
file_path: BigDL/python/friesian/example/multi_task/run_multi_task.py
imports: import math
  from time import time
  from argparse import ArgumentParser
  from bigdl.dllib.utils.log4Error import invalidInputError
  from bigdl.orca import init_orca_context, stop_orca_context
  from bigdl.orca.learn.tf2.estimator import Estimator
  from bigdl.friesian.feature import FeatureTable
  from deepctr.feature_column import SparseFeat, DenseFeat
  from deepctr.models import MMOE, PLE
  from keras.callbacks import EarlyStopping
label_desc: Use image node_id 5 for calling a global function with example usage: train_multi_task(train_tbl_data, valid_tbl_data, save_path, model, cat_cols, continuous_cols, feature_max_idx) without return types