Skip to content

Commit fc6b83e

Browse files
authored
Move ai-edge-model-explorer into devtools/install_requirements.sh (#7675)
Summary: From top-level requirements, move to devtools/install_requirement.sh instead. ai-edge-model-explorer is too new and currently requires numpy<2 which conflicts with our recent upgrade. Let's not take core dependency on this tool yet.
1 parent d1b33cb commit fc6b83e

6 files changed

+29
-3
lines changed

.lintrunner.toml

+1
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ include_patterns = [
294294
'build/**/*.py',
295295
'codegen/**/*.py',
296296
# 'devtools/**/*.py',
297+
'devtools/visualization/**/*.py',
297298
'docs/**/*.py',
298299
# 'examples/**/*.py',
299300
# 'exir/**/*.py',

devtools/install_requirements.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
# Conflict: this requires numpy<2 whereas ExecuTorch core requires numpy>=2
9+
# Follow https://github.com/google-ai-edge/model-explorer/issues/277 for potential
10+
# resolution
11+
pip install ai-edge-model-explorer>=0.1.16

devtools/visualization/visualization_utils.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@
88
import time
99

1010
from executorch.exir import EdgeProgramManager, ExecutorchProgramManager
11-
from model_explorer import config, consts, visualize_from_config # type: ignore
1211
from torch.export.exported_program import ExportedProgram
1312

13+
try:
14+
from model_explorer import config, consts, visualize_from_config # type: ignore
15+
except ImportError:
16+
print(
17+
"Error: 'model_explorer' is not installed. Install using devtools/install_requirement.sh"
18+
)
19+
raise
20+
1421

1522
class SingletonModelExplorerServer:
1623
"""Singleton context manager for starting a model-explorer server.

devtools/visualization/visualization_utils_test.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@
1717
visualize,
1818
)
1919
from executorch.exir import ExportedProgram
20-
from model_explorer.config import ModelExplorerConfig # type: ignore
20+
21+
try:
22+
from model_explorer.config import ModelExplorerConfig # type: ignore
23+
except ImportError:
24+
print(
25+
"Error: 'model_explorer' is not installed. Install using devtools/install_requirement.sh"
26+
)
27+
raise
2128

2229

2330
@pytest.fixture

install_requirements.py

-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ def python_is_compatible():
170170
"tomli", # Imported by extract_sources.py when using python < 3.11.
171171
"wheel", # For building the pip package archive.
172172
"zstd", # Imported by resolve_buck.py.
173-
"ai-edge-model-explorer>=0.1.16", # For visualizing ExportedPrograms
174173
]
175174

176175
# Assemble the list of requirements to actually install.

pytest.ini

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ addopts =
1414
# explicitly list out tests that are running successfully in oss
1515
examples/models/test
1616
devtools/
17+
--ignore=devtools/visualization/visualization_utils_test.py
1718
# examples
1819
examples/models/llama/tests
1920
examples/models/llama3_2_vision/preprocess

0 commit comments

Comments
 (0)