Skip to content
2 changes: 1 addition & 1 deletion docs/website/docs/tutorials/setting_up_executorch.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
Copy link
Member Author

Choose a reason for hiding this comment

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

strangely enough pip install -e . was not finding exir for me :/

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok I think this is because there's something weird going on with the custom install instructions, will get back to this later


# 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
Expand Down
4 changes: 2 additions & 2 deletions examples/export/export_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member Author

@msaroufim msaroufim Jul 26, 2023

Choose a reason for hiding this comment

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

examples are not installed so either add it to setup.py or do this

Avoids error: ModuleNotFoundError: No module named 'executorch.examples'

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, but did you exclude example folder from installation via pip? if so how?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's already excluded since it's not here https://github.com/pytorch/executorch/blob/main/setup.py#L45



class MulModule(torch.nn.Module):
Expand Down Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

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

why this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

You can keep things as is if you change your setup.py to include

setup(
    package_dir={
        "executorch/backends": "backends",
        "executorch/exir": "exir",
        "executorch/schema": "schema",
        "executorch/extension": "extension",
        "executorch/examples": "examples",

    },

Otherwise when you pip install examples won't be available

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll fix this change in another PR, all the TARGETS files are assuming that examples is in the library and i don't have that much experience with buck right now


# Unfortunately lack of consistent interface on example models in this file
# and how we obtain oss models result in changes like this.
Expand Down
2 changes: 1 addition & 1 deletion exir/capture/_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
flatten_output,
Value,
)
from functorch.experimental import functionalize
from torch.func import functionalize
Copy link
Member Author

Choose a reason for hiding this comment

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

this was spamming warnings on the default hello world example

from torch import _guards
from torch._dispatch.python import enable_python_dispatcher
from torch._dynamo.eval_frame import Constraint
Expand Down
12 changes: 8 additions & 4 deletions extension/pytree/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# flake8: noqa: F401

import warnings
import logging

# Create a logger
logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)


try:
"""
Expand All @@ -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.")
Copy link
Member Author

@msaroufim msaroufim Jul 26, 2023

Choose a reason for hiding this comment

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

I think oss users dont need to see this warning



from torch.utils._pytree import (
_broadcast_to_and_flatten,
Expand Down
8 changes: 8 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
from setuptools.command.egg_info import egg_info
from setuptools.command.install import install

# Dependencies
Copy link
Member Author

Choose a reason for hiding this comment

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

docs/website/docs/tutorials/setting_up_executorch.md mentions most of these dependencies so might as well install them

required_packages = [
"numpy",
"zstd",
"flatbuffers",
# "torch_nightly" # This is not available on PyPI. Please install manually.
]

def custom_command():
src_dst_list = [
Expand Down Expand Up @@ -53,4 +60,5 @@ def run(self):
"develop": CustomDevelopCommand,
"egg_info": CustomEggInfoCommand,
},
install_requires=required_packages,
)