From 527271880fa95d547c8960b1ef3591d4b254c6ce Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 26 Jul 2023 10:03:41 -0700 Subject: [PATCH 01/11] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bfb1c71e881..2201fbd8ef9 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,9 @@ Compared to the legacy Lite Interpreter, there are some major benefits: ## Quick Links - [Basics: Terminology](/docs/website/docs/basics/terminology.md) -- [Exporting to Executorch](/docs/website/docs/tutorials/exported_to_executorch.md) +- [Exporting to Executorch](/docs/website/docs/tutorials/exporting_to_executorch.md) - [EXIR Spec](/docs/website/docs/ir_spec/00_exir.md) - - [Delegate to a backend](/docs/website/docs/tutorials/backends.md) + - [Delegate to a backend](/docs/website/docs/tutorials/backend_delegate.md) - [Wiki (internal-only)](https://www.internalfb.com/intern/wiki/PyTorch/Using_PyTorch/Executorch/) - [Static docs website (internal-only)](https://www.internalfb.com/intern/staticdocs/executorch/) - [Testing (internal-only)](https://www.internalfb.com/intern/staticdocs/executorch/docs/fb/poc/) From 2f3090a074332c3e756eeff9083f3af569f72c05 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 26 Jul 2023 10:18:24 -0700 Subject: [PATCH 02/11] Update setting_up_executorch.md --- docs/website/docs/tutorials/setting_up_executorch.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/website/docs/tutorials/setting_up_executorch.md b/docs/website/docs/tutorials/setting_up_executorch.md index c3b81df14b5..2aae8eb8404 100644 --- a/docs/website/docs/tutorials/setting_up_executorch.md +++ b/docs/website/docs/tutorials/setting_up_executorch.md @@ -29,7 +29,7 @@ git clone git@github.com:pytorch/executorch.git # [Runtime requirement] Run the following to get all submodules, only need for runtime setup git submodule update --init --recursive -pip install executorch +pip install . # cd into a directory that doesn't contain a `./executorch/exir` directory, since # otherwise python will try using it for `import executorch.exir...` instead of using the From 648a3ffef987e63d494df661ad8091152ec60aaf Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 26 Jul 2023 10:37:43 -0700 Subject: [PATCH 03/11] Update setup.py --- setup.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/setup.py b/setup.py index af70aa03149..9a662cc2966 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,13 @@ from setuptools.command.egg_info import egg_info from setuptools.command.install import install +# Dependencies +required_packages = [ + "numpy", + "zstd", + "flatbuffers", + # "torch_nightly" # This is not available on PyPI. Please install manually. +] def custom_command(): src_dst_list = [ @@ -53,4 +60,5 @@ def run(self): "develop": CustomDevelopCommand, "egg_info": CustomEggInfoCommand, }, + install_requires=required_packages, ) From 799a5831d55c86acdd53b98652fdaa9cdf238b7e Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 26 Jul 2023 10:54:24 -0700 Subject: [PATCH 04/11] remove warning spam from functorch --- exir/capture/_capture.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exir/capture/_capture.py b/exir/capture/_capture.py index 48236303701..152c60efc41 100644 --- a/exir/capture/_capture.py +++ b/exir/capture/_capture.py @@ -17,7 +17,7 @@ flatten_output, Value, ) -from functorch.experimental import functionalize +from torch.func import functionalize from torch import _guards from torch._dispatch.python import enable_python_dispatcher from torch._dynamo.eval_frame import Constraint From f4e168208742661106c26af7f0df16d4658b772d Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 26 Jul 2023 10:58:59 -0700 Subject: [PATCH 05/11] more notification spam --- extension/pytree/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/extension/pytree/__init__.py b/extension/pytree/__init__.py index 60030274f07..d6e11e28600 100644 --- a/extension/pytree/__init__.py +++ b/extension/pytree/__init__.py @@ -1,6 +1,11 @@ # flake8: noqa: F401 -import warnings +import logging + +# Create a logger +logger = logging.getLogger(__name__) +logger.setLevel(logging.WARNING) + try: """ @@ -22,9 +27,8 @@ TreeSpec as TreeSpec, ) except: - warnings.warn( - "Unable to import executorch.extension.pytree, using native torch pytree instead." - ) + logger.info("Unable to import executorch.extension.pytree, using native torch pytree instead.") + from torch.utils._pytree import ( _broadcast_to_and_flatten, From 3e0fde06ed6aefba645932cc5697f1e8d90c9cc4 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 26 Jul 2023 11:21:56 -0700 Subject: [PATCH 06/11] fix import in example --- examples/export/export_example.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/export/export_example.py b/examples/export/export_example.py index d25267e810c..2a70b549a8c 100644 --- a/examples/export/export_example.py +++ b/examples/export/export_example.py @@ -5,7 +5,7 @@ import executorch.exir as exir import torch -from executorch.examples.utils import _CAPTURE_CONFIG, _EDGE_COMPILE_CONFIG +from ..utils import _CAPTURE_CONFIG, _EDGE_COMPILE_CONFIG class MulModule(torch.nn.Module): From 354aff56b5b5bda6a46bfd32d88171c9fd58b37f Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 26 Jul 2023 11:26:29 -0700 Subject: [PATCH 07/11] 1 more --- examples/export/export_example.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/export/export_example.py b/examples/export/export_example.py index 2a70b549a8c..69036646985 100644 --- a/examples/export/export_example.py +++ b/examples/export/export_example.py @@ -89,7 +89,7 @@ def export_to_ff(model_name, model, example_inputs): ) if args.model_name == "mv3": - from executorch.examples.models.mobilenet_v3 import MV3Model + from ..models.mobilenet_v3 import MV3Model # Unfortunately lack of consistent interface on example models in this file # and how we obtain oss models result in changes like this. From e2bd3c4d2f5580cd3c47be34d405a4b1f6021b90 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 26 Jul 2023 13:54:26 -0700 Subject: [PATCH 08/11] make sure a file gets written in tutorial --- docs/website/docs/tutorials/setting_up_executorch.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/website/docs/tutorials/setting_up_executorch.md b/docs/website/docs/tutorials/setting_up_executorch.md index 2aae8eb8404..ce0ce623131 100644 --- a/docs/website/docs/tutorials/setting_up_executorch.md +++ b/docs/website/docs/tutorials/setting_up_executorch.md @@ -53,6 +53,7 @@ Or via python interpreter: >>> m = Mul() >>> print(exir.capture(m, m.get_random_inputs()).to_edge()) >>> exir.capture(m, m.get_random_inputs()).to_edge().to_executorch().buffer +>>> open("add.ff", "wb").write(exir.capture(m, m.get_random_inputs()).to_edge().to_executorch().buffer) ``` ## Runtime Setup From 0160e5175a004308877d5e6a937322271e4f3890 Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 26 Jul 2023 13:55:51 -0700 Subject: [PATCH 09/11] ignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 1b23e80469e..daeaba27b2b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ buck-out/ executorch.egg-info __pycache__/ +build/lib/ +exir/serialize/scalar_type.fbs +exir/serialize/schema.fbs \ No newline at end of file From 5d7c8c1aee7cba4356a313d86d9a01a401fb533b Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 26 Jul 2023 14:39:41 -0700 Subject: [PATCH 10/11] revert local diretory changes' --- examples/export/export_example.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/export/export_example.py b/examples/export/export_example.py index 69036646985..d25267e810c 100644 --- a/examples/export/export_example.py +++ b/examples/export/export_example.py @@ -5,7 +5,7 @@ import executorch.exir as exir import torch -from ..utils import _CAPTURE_CONFIG, _EDGE_COMPILE_CONFIG +from executorch.examples.utils import _CAPTURE_CONFIG, _EDGE_COMPILE_CONFIG class MulModule(torch.nn.Module): @@ -89,7 +89,7 @@ def export_to_ff(model_name, model, example_inputs): ) if args.model_name == "mv3": - from ..models.mobilenet_v3 import MV3Model + from executorch.examples.models.mobilenet_v3 import MV3Model # Unfortunately lack of consistent interface on example models in this file # and how we obtain oss models result in changes like this. From 46e8b0756db989bbaf7991c04261848f03d816fe Mon Sep 17 00:00:00 2001 From: Mark Saroufim Date: Wed, 26 Jul 2023 14:56:39 -0700 Subject: [PATCH 11/11] Update setting_up_executorch.md --- docs/website/docs/tutorials/setting_up_executorch.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/website/docs/tutorials/setting_up_executorch.md b/docs/website/docs/tutorials/setting_up_executorch.md index b0658908874..a247e7e2acb 100644 --- a/docs/website/docs/tutorials/setting_up_executorch.md +++ b/docs/website/docs/tutorials/setting_up_executorch.md @@ -52,7 +52,6 @@ Or via python interpreter: >>> from executorch.exir.tests.models import Mul >>> m = Mul() >>> print(exir.capture(m, m.get_random_inputs()).to_edge()) ->>> exir.capture(m, m.get_random_inputs()).to_edge().to_executorch().buffer >>> open("add.ff", "wb").write(exir.capture(m, m.get_random_inputs()).to_edge().to_executorch().buffer) ```