def METHOD_NAME(model_context, wrapper_name, wrapper_config):
    """
    args:
        wrapper_config:
            replacement_map: the map from node name to the distributed implementation's name,
                each distributed implementation must specifies an input_spec and an output_spec
            process_groups: process groups to be initialized
            replaced_specs: input and output specs for nodes after replacement.
                see atorch.auto.opt_lib.auto_tensor_parallel_strategies.base_strategy for details
            changed_local_nodes: local nodes that specs changed according to input nodes
            process_group_assignment: a dict describing where to place every parallel operators
            gm: the graph module to be used if pipeline is enabled
            leaf_modules: this controls the leaf modules for tracer
            defer_init: whether to defer tp initialization, used when TP is mixed with FSDP/Pipeline
    return:
        A tensor parallel model
    """
    try:
        compiler_configs = wrapper_config
        gm = compiler_configs.get("gm", None)
        defer_init = compiler_configs.get("defer_init", False)
        leaf_modules = compiler_configs.get("leaf_modules", list(_SHARDABLE_OPERATORS.values()))
        # In case of mixed parallel mode, gm is created and preprocessed by MP.
        gm = gm if gm else model_context.export_graph_module(backend="meta_fx", leaf_modules=leaf_modules)
        if defer_init and not is_meta(gm):
            # If we have to defer init, we must move everything onto META, this is required by FSDP
            if (
                torch.distributed.is_initialized() and int(local_rank()) == 0
            ) or not torch.distributed.is_initialized():
                if not os.path.isdir(_MetaModeContext.offload_path):
                    os.makedirs(_MetaModeContext.offload_path)
                else:
                    try:
                        shutil.rmtree(_MetaModeContext.offload_path)
                        os.makedirs(_MetaModeContext.offload_path)
                    except OSError as e:
                        logger.warning(f"failed to remove offload directory, with error: {e}")
            empty_param(gm)
            recursive_empty_param(gm)
            torch.distributed.barrier()
        tp_model = tp_compiler(gm, copy.deepcopy(compiler_configs))
        # If pipeline parallelism also enabled, wait until pipe stage init
        # to move stage model into GPU.
        if not defer_init:
            device = torch.device(type="cuda", index=local_rank())
            materialize_modules_to_device(tp_model, device)
            tp_model.to(device)
        model_context.model = tp_model
        model_context.update_tp_status(True)
        logger.info("Successfully transformed the model into tensor parallel model")
    except Exception as e:
        traceback.print_exc()
        logger.warning(f"Failed to transform the model into a parallel model, with error: {e}")