async def load_compute_plan_from_path_on_device(
    path: str,
    compute_units: ComputeUnit = ComputeUnit.ALL,
    device: Optional[Device] = None,
) -> MLComputePlan:
    """
    Loads the compute plan of a compiled model on a remote or local device.

    The path must be the location of the ``mlmodelc`` directory.

    Parameters
    ----------
    path : str
        The path to the compiled model.

    Returns
    -------
    The plan for executing the model.

    Examples
    --------
    .. sourcecode:: python

        # Retrieve a development device.
        devices = Device.get_connected_development_devices(device_type=DeviceType.IPHONE)
        device = devices[0]
        # Prepare device for model debugging.
        device = await device.prepare_for_model_debugging()
        compute_plan = await coremltools.models.ml_program.experimental.compute_plan_utils.load_compute_plan_from_path_on_device(
            path=model.get_compiled_path(),
            device=device,
        )

        if compute_plan.model_structure.program is None:
            raise ValueError("Unexpected model type.")

        program = compute_plan.model_structure.program
        mainFunction = program.functions["main"]
        for operation in mainFunction.block.operations:
            # Get the compute device usage for the operation.
            compute_device_usage = (
                compute_plan.get_compute_device_usage_for_mlprogram_operation(operation)
            )
            # Get the estimated cost of executing the operation.
            estimated_cost = compute_plan.get_estimated_cost_for_mlprogram_operation(operation)
    """
    if device is None:
        return MLComputePlan.load_from_path(
            path=path,
            compute_units=compute_units,
        )
    else:
        if _MLComputePlanRemoteProxy is None:
            raise ValueError(
                "Remote device functionality for retrieving the compute plan is unavailable."
            )

        service = await _RemoteMLModelService.load_on_device(
            device=device,
            compiled_model_path=path,
            compute_units=compute_units,
            function_name=None,
        )

        compute_plan = await service.retrieve_compute_plan()
        model_structure = MLModelStructure.load_from_path(
            compiled_model_path=path,
        )
        remote_proxy = _MLComputePlanRemoteProxy(
            device=device,
            compute_plan=compute_plan,
            model_structure=model_structure,
        )

        return MLComputePlan(proxy=remote_proxy)

    Loads the compute plan of a compiled model on a remote or local device.

    The path must be the location of the ``mlmodelc`` directory.

    Parameters
    ----------
    path : str
        The path to the compiled model.

    Returns
    -------
    The plan for executing the model.

    Examples
    --------
    .. sourcecode:: python

        # Retrieve a development device.
        devices = Device.get_connected_development_devices(device_type=DeviceType.IPHONE)
        device = devices[0]
        # Prepare device for model debugging.
        device = await device.prepare_for_model_debugging()
        compute_plan = await coremltools.models.ml_program.experimental.compute_plan_utils.load_compute_plan_from_path_on_device(
            path=model.get_compiled_path(),
            device=device,
        )

        if compute_plan.model_structure.program is None:
            raise ValueError("Unexpected model type.")

        program = compute_plan.model_structure.program
        mainFunction = program.functions["main"]
        for operation in mainFunction.block.operations:
            # Get the compute device usage for the operation.
            compute_device_usage = (
                compute_plan.get_compute_device_usage_for_mlprogram_operation(operation)
            )
            # Get the estimated cost of executing the operation.
            estimated_cost = compute_plan.get_estimated_cost_for_mlprogram_operation(operation)
    
coremltools/models/ml_program/experimental/compute_plan_utils.py