code: def migrate2to3(d: dict):
      solver_mapper = {
          "ADAM_SOLVER": "Adam",
          "MOMENTUM_SOLVER": "SGD",
      }
      model = d.get("model", {})
      network = model.get("network", {})
      backend = network.get("backend", {})
      codec = model.get("codec", {})
      data_preprocessor = model.get("dataPreprocessor", {})
      text_preprocessor = model.get("textPreprocessor", {})
      text_postprocessor = model.get("textPostprocessor", {})
  
      converted_pre_processors = convert_image_processor(
          data_preprocessor
      ) + convert_text_processor(text_preprocessor)
  
      converted_pre_processors.append(
          {
              "name": "PrepareSampleProcessor",
              "modes": ["prediction", "training", "evaluation"],
          }
      )
  
      converted_post_processors = convert_text_processor(
          text_postprocessor
      )
      converted_post_processors.insert(
          0, {"name": "CTCDecoderProcessor"}
      )
      converted_post_processors.insert(
          0, {"name": "ReshapeOutputsProcessor"}
      )
  
      # migrate to dict based on tfaip
      return {
          "random_seed": backend.get("randomSeed", 0),
          "optimizer_params": {
              "optimizer": solver_mapper[
                  network.get("solver", "MOMENTUM_SOLVER")
              ],
              "clip_grad": network.get("clippingNorm", 0),
              "momentum": network.get("momentum", 0),
          },
          "learning_rate_params": {
              "lr": network.get("learningRate", 0),
          },
          "scenario_params": {
              "scenario_base_path_": inspect.getfile(CalamariScenario),
              "scenario_module_": CalamariScenario.__module__,
              "model_params": {
                  "layers": [
                      convert_layer(l)
                      for l in network.get("layers", [])
                  ],
                  "dropout": network.get("dropout", 0),
                  "classes": network.get("classes", 0),
                  "ctc_merge_repeated": network.get(
                      "ctcMergeRepeated", False
                  ),
              },
              "data_params": {
                  "preproc_max_tasks_per_child": 250,
                  "resource_base_path_": ".",
                  "skip_invalid_gt_": d.get("skipInvalidGt", False),
                  "input_channels": model.get("channels", 1),
                  "line_height_": model.get("lineHeight"),
                  "codec": convert_codec(codec),
                  "pre_processors_": {
                      "run_parallel": True,
                      "sample_processors": converted_pre_processors,
                  },
                  "post_processors_": {
                      "run_parallel": True,
                      "sample_processors": converted_post_processors,
                  },
                  "scenario_module_": "calamari_ocr.ocr.backends.scenario",
                  "tfaip_commit_hash_": "b234c8ce1428b33d6830a7a4a3d7bc13fedd69ba",
                  "tfaip_version_": "1.0.0",
              },
          },
      }
  
imports: import inspect
  import os
  from typing import Optional
  import logging
  import h5py
  from tensorflow import keras
  from tensorflow.python.keras.saving.hdf5_format import load_weights_from_hdf5_group
  from tfaip.util.tfaipargparse import post_init
  from calamari_ocr.ocr.savedmodel.migrations.version3_4to5 import migrate3to5
  from calamari_ocr.ocr.scenario import CalamariScenario
  from calamari_ocr.ocr.training.params import TrainerParams
label_desc: Use image node_id 9 for calling a global function with example usage: migrate2to3(d) and returns: dict