Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move ai-edge-model-explorer into devtools/install_requirements.sh #7675

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this will work, once ET moves to numpy>=2?
Does Google have a plan to upgrade to a newer numpy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# 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