Skip to main content

ETRecord adapter package for Model Explorer

Project description

ETRecord Adapter for Model Explorer

etrecord-adapter-model-explorer is the standalone Model Explorer adapter for ExecuTorch .etrecord files.

This repository contains the ETRecord-specific adapter code, tests, and fixtures. For a combined install that wires the PTE adapter, ETRecord adapter, and ETDump data provider together, use the umbrella package executorch-extension-model-explorer.

Installation

Install the standalone adapter package:

pip install etrecord-adapter-model-explorer

The adapter expects an environment with the ExecuTorch Python packages available.

Usage

Run Model Explorer with the standalone ETRecord adapter enabled:

model-explorer --extensions=etrecord_adapter_model_explorer

Then open an .etrecord file.

Delegate visibility

Delegated ExecuTorch programs often collapse a backend-supported subgraph into an opaque executorch_call_delegate node. If an ETRecord is generated from the post-delegation edge graph, this adapter can only display that delegate call for the delegated region because the original edge operators are no longer present in the recorded edge graph.

To keep the original operators visible, generate the ETRecord with the pre-delegation EdgeProgramManager as edge_dialect_program and the delegated ExecutorchProgramManager as executorch_program:

import copy
import torch
from executorch.backends.arm import EthosUCompileSpec, EthosUPartitioner
from executorch.devtools import generate_etrecord
from executorch.exir import to_edge, to_edge_transform_and_lower

exported_program = torch.export.export(model.eval(), example_inputs)

edge_program = to_edge(exported_program)
edge_program_for_record = copy.deepcopy(edge_program)

compile_spec = EthosUCompileSpec("ethos-u55-128")
delegated_edge_program = to_edge_transform_and_lower(
    programs=exported_program,
    partitioner=[EthosUPartitioner(compile_spec)],
)
executorch_program = delegated_edge_program.to_executorch()

generate_etrecord(
    "model.etrecord",
    edge_dialect_program=edge_program_for_record,
    executorch_program=executorch_program,
)

Backends that emit delegate debug mapping can also let the adapter group those operators under a delegate namespace such as delegates/CoreMLBackend/partition_0. Backends that do not emit that mapping can still show the pre-delegation operators, but delegate grouping may be limited.

Development

Local ETRecord test fixtures live under src/etrecord_adapter_model_explorer/tests/fixtures/.

pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

etrecord_adapter_model_explorer-0.1.0.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file etrecord_adapter_model_explorer-0.1.0.tar.gz.

File metadata

File hashes

Hashes for etrecord_adapter_model_explorer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a47028c5a568890e95b0114f3cb13145069ba248d8848b7b3622dd02d5e22ed1
MD5 c27a730a84e06003147beb15545ce4af
BLAKE2b-256 f038bf67251a25327af2b62e2f9ad88cb4a0d16704d90832bb7191d5ec377587

See more details on using hashes here.

Provenance

The following attestation bundles were made for etrecord_adapter_model_explorer-0.1.0.tar.gz:

Publisher: ci.yml on arm/etrecord-adapter-model-explorer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file etrecord_adapter_model_explorer-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for etrecord_adapter_model_explorer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50f01999d105c292cf47b46d24558067613527062deefc5caa9697ac4aa9562b
MD5 e5a832df8c5543aba2cd96380e430912
BLAKE2b-256 d279ed954590d2610322cf5cf56d654c89b07c21e1f17fba0c9963e32824b04b

See more details on using hashes here.

Provenance

The following attestation bundles were made for etrecord_adapter_model_explorer-0.1.0-py3-none-any.whl:

Publisher: ci.yml on arm/etrecord-adapter-model-explorer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page