def METHOD_NAME(
    main_model_type, pt_model_type, finetune_dic
):
    idim, odim, ilens, olens = get_default_scope_inputs()
    batch = pytorch_prepare_inputs(idim, odim, ilens, olens)
    if pt_model_type == "lm":
        pt_args = get_rnnt_args() if main_model_type == "rnnt" else get_rnn_args()
        pt_model = get_lm(pt_args.dlayers, pt_args.dunits, pt_args.char_list)
        prefix_tmppath = "_rnnlm"
    else:
        if pt_model_type == "rnn":
            from espnet.nets.pytorch_backend.e2e_asr import E2E
            pt_args = get_rnn_args()
        else:
            from espnet.nets.pytorch_backend.e2e_asr_transducer import E2E
            pt_args = get_rnnt_args()
        pt_model = E2E(idim, odim, pt_args)
        prefix_tmppath = ""
        loss = pt_model(*batch)
        loss.backward()
    if not os.path.exists(".pytest_cache"):
        os.makedirs(".pytest_cache")
    tmppath = tempfile.mktemp() + prefix_tmppath
    torch_save(tmppath, pt_model)
    # create dummy model.json for saved model to go through
    # get_model_conf(...) called in load_trained_modules method.
    model_conf = os.path.dirname(tmppath) + "/model.json"
    with open(model_conf, "wb") as f:
        f.write(
            json.dumps(
                (idim, odim, vars(pt_args)),
                indent=4,
                ensure_ascii=False,
                sort_keys=True,
            ).encode("utf_8")
        )
    if finetune_dic["enc_init"] is not None:
        finetune_dic["enc_init"] = tmppath
    if finetune_dic["dec_init"] is not None:
        finetune_dic["dec_init"] = tmppath
    if main_model_type == "rnn":
        main_args = get_rnn_args(**finetune_dic)
    else:
        main_args = get_rnnt_args(**finetune_dic)
    main_model = load_trained_modules(idim, odim, main_args)
    loss = main_model(*batch)
    loss.backward()
    if main_model_type == "rnnt":
        beam_search = BeamSearchTransducer(
            decoder=main_model.dec,
            joint_network=main_model.transducer_tasks.joint_network,
            beam_size=1,
            lm=None,
            lm_weight=0.0,
            search_type="default",
            max_sym_exp=2,
            u_max=10,
            nstep=1,
            prefix_alpha=1,
            score_norm=False,
        )
        with torch.no_grad():
            in_data = np.random.randn(10, idim)
            main_model.recognize(in_data, beam_search)
    else:
        with torch.no_grad():
            in_data = np.random.randn(10, idim)
            main_model.recognize(in_data, main_args, main_args.char_list)