Skip to content

Commit

Permalink
Move ai-edge-model-explorer into devtools/install_requirements.sh (#7675
Browse files Browse the repository at this point in the history
)

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.
  • Loading branch information
mergennachin authored Jan 16, 2025
1 parent d1b33cb commit fc6b83e
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 3 deletions.
1 change: 1 addition & 0 deletions .lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ include_patterns = [
'build/**/*.py',
'codegen/**/*.py',
# 'devtools/**/*.py',
'devtools/visualization/**/*.py',
'docs/**/*.py',
# 'examples/**/*.py',
# 'exir/**/*.py',
Expand Down
11 changes: 11 additions & 0 deletions devtools/install_requirements.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

# Conflict: this requires numpy<2 whereas ExecuTorch core requires numpy>=2
# Follow https://github.com/google-ai-edge/model-explorer/issues/277 for potential
# resolution
pip install ai-edge-model-explorer>=0.1.16
9 changes: 8 additions & 1 deletion devtools/visualization/visualization_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@
import time

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

try:
from model_explorer import config, consts, visualize_from_config # type: ignore
except ImportError:
print(
"Error: 'model_explorer' is not installed. Install using devtools/install_requirement.sh"
)
raise


class SingletonModelExplorerServer:
"""Singleton context manager for starting a model-explorer server.
Expand Down
9 changes: 8 additions & 1 deletion devtools/visualization/visualization_utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@
visualize,
)
from executorch.exir import ExportedProgram
from model_explorer.config import ModelExplorerConfig # type: ignore

try:
from model_explorer.config import ModelExplorerConfig # type: ignore
except ImportError:
print(
"Error: 'model_explorer' is not installed. Install using devtools/install_requirement.sh"
)
raise


@pytest.fixture
Expand Down
1 change: 0 additions & 1 deletion install_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ def python_is_compatible():
"tomli", # Imported by extract_sources.py when using python < 3.11.
"wheel", # For building the pip package archive.
"zstd", # Imported by resolve_buck.py.
"ai-edge-model-explorer>=0.1.16", # For visualizing ExportedPrograms
]

# Assemble the list of requirements to actually install.
Expand Down
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ addopts =
# explicitly list out tests that are running successfully in oss
examples/models/test
devtools/
--ignore=devtools/visualization/visualization_utils_test.py
# examples
examples/models/llama/tests
examples/models/llama3_2_vision/preprocess
Expand Down

0 comments on commit fc6b83e

Please sign in to comment.