Skip to content

Improve setup instructions #24

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

Closed
wants to merge 13 commits into from
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
buck-out/
executorch.egg-info
__pycache__/
build/lib/
exir/serialize/scalar_type.fbs
exir/serialize/schema.fbs
4 changes: 2 additions & 2 deletions 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 All @@ -52,7 +52,7 @@ 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)
```

## Runtime Setup
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,
)