Open orgicus opened 7 months ago
@orgicus thus could be a path issue, could you please check the name of the cloned directory, if the name is not executorch then please rename it to executorch.
@cymbalrush Thanks for the the input.
The folder is indeed called executorch. Doesn't look like I need to rename it:
pwd
/Users/george.profenza/Documents/cv/executorch
(executorch) george.profenza@Georges-MacBook-Pro executorch % file extension/data_loader/file_data_loader.h
extension/data_loader/file_data_loader.h: C++ source text, ASCII text
Are there other paths to double check ? (e.g. the from which the compilation process runs relative to the extension/runtime/util folders )
Thank you, George
I'm checking in if there are updates on how could check/fix paths to get build_executor_runner.sh
to build successfully
@orgicus
We just released a new stable release.
Can you try with the latest instructions?
Namely, git clone --branch v0.2.0 https://github.com/pytorch/executorch.git
@mergennachin Thank you for the update.
I cloned the repo as a sibling to the previous clone (git clone --branch v0.2.0 https://github.com/pytorch/executorch.git executorch_v0.2.0
)
I then activated the existing executorch
conda environment and attempted to run the ./install_requirements.sh
script.
Unfortunately I ran into a pybind build error with inmemoryfs
:
Processing /Users/george.profenza/Documents/cv/executorch_v0.2.0/backends/apple/coreml/runtime/inmemoryfs
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/Users/george.profenza/Documents/cv/executorch_v0.2.0/backends/apple/coreml/runtime/inmemoryfs/setup.py", line 10, in <module>
from pybind11.setup_helpers import build_ext, Pybind11Extension
ModuleNotFoundError: No module named 'pybind11'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
ExecuTorch: Failed to install inmemoryfs extension.
ExecuTorch: Copying protobuf files.
I now notice it's trying to to install https://download.pytorch.org/whl/test/cpu/torch-2.3.0-cp310-none-macosx_11_0_arm64.whl when I have torch 2.2.0.dev20231010
(with MPS support).
Unfortunately I won't have the resources to read source code/debug properly and I hope you can help with a few pointers:
executorch
to avoid any confusion ?Thank you so much, George
a few things to try:
Also, there are two install_requirements. And you have to run both of them, in this order:
top-level: ./install_requirement.sh --pybind coreml
coreml specific: ./backends/apple/coreml/scripts/install_requirements.sh
I've followed your advice: thank you for that.
Unfortunately I'm running into another error using ./install_requirements.sh --pybind coreml
[ 27%] Building CXX object CMakeFiles/executorch_no_prim_ops.dir/runtime/platform/target/Posix.cpp.o
/Users/george.profenza/Documents/cv/executorch_v0.2.0/runtime/kernel/operator_registry.cpp:137:23: error: no member named 'MAX_SIZE' in 'torch::executor::KernelKey'
char buf[KernelKey::MAX_SIZE] = {0};
~~~~~~~~~~~^
/Users/george.profenza/Documents/cv/executorch_v0.2.0/runtime/kernel/operator_registry.cpp:160:23: error: no member named 'MAX_SIZE' in 'torch::executor::KernelKey'
char buf[KernelKey::MAX_SIZE] = {0};
~~~~~~~~~~~^
2 errors generated.
make[3]: *** [CMakeFiles/executorch_no_prim_ops.dir/runtime/kernel/operator_registry.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
/Users/george.profenza/Documents/cv/executorch_v0.2.0/runtime/platform/target/Posix.cpp:116:1: error: unknown type name 'et_tick_ratio_t'
et_tick_ratio_t et_pal_ticks_to_ns_multiplier(void) {
^
/Users/george.profenza/Documents/cv/executorch_v0.2.0/runtime/platform/target/Posix.cpp:118:10: error: excess elements in scalar initializer
return {1, 1};
^ ~~~~
2 errors generated.
make[3]: *** [CMakeFiles/executorch_no_prim_ops.dir/runtime/platform/target/Posix.cpp.o] Error 1
/Users/george.profenza/Documents/cv/executorch_v0.2.0/runtime/core/exec_aten/util/tensor_util_portable.cpp:58:7: error: use of undeclared identifier 'is_contiguous_dim_order'
is_contiguous_dim_order(t.dim_order().data(), t.dim_order().size()) ||
^
1 error generated.
make[3]: *** [CMakeFiles/executorch_no_prim_ops.dir/runtime/core/exec_aten/util/tensor_util_portable.cpp.o] Error 1
/Users/george.profenza/Documents/cv/executorch_v0.2.0/runtime/executor/program.cpp:184:12: error: no matching constructor for initialization of 'Program'
return Program(
^
/Users/george.profenza/Documents/cv/executorch_v0.2.0/../executorch/runtime/executor/program.h:253:3: note: candidate constructor not viable: requires 4 arguments, but 5 were provided
Program(
^
/Users/george.profenza/Documents/cv/executorch_v0.2.0/../executorch/runtime/executor/program.h:88:3: note: candidate constructor not viable: requires 1 argument, but 5 were provided
Program(Program&&) noexcept = default;
^
/Users/george.profenza/Documents/cv/executorch_v0.2.0/../executorch/runtime/executor/program.h:265:3: note: candidate constructor not viable: requires single argument 'rhs', but 5 arguments were provided
Program(const Program& rhs) = delete;
^
/Users/george.profenza/Documents/cv/executorch_v0.2.0/runtime/executor/program.cpp:193:12: error: no matching constructor for initialization of 'Program'
return Program(
^
/Users/george.profenza/Documents/cv/executorch_v0.2.0/../executorch/runtime/executor/program.h:253:3: note: candidate constructor not viable: requires 4 arguments, but 5 were provided
Program(
^
/Users/george.profenza/Documents/cv/executorch_v0.2.0/../executorch/runtime/executor/program.h:88:3: note: candidate constructor not viable: requires 1 argument, but 5 were provided
Program(Program&&) noexcept = default;
^
/Users/george.profenza/Documents/cv/executorch_v0.2.0/../executorch/runtime/executor/program.h:265:3: note: candidate constructor not viable: requires single argument 'rhs', but 5 arguments were provided
Program(const Program& rhs) = delete;
^
/Users/george.profenza/Documents/cv/executorch_v0.2.0/runtime/executor/program.cpp:271:30: error: out-of-line definition of 'get_constant_buffer_data' does not match any declaration in 'torch::executor::Program'
Result<const void*> Program::get_constant_buffer_data(
^~~~~~~~~~~~~~~~~~~~~~~~
/Users/george.profenza/Documents/cv/executorch_v0.2.0/runtime/executor/tensor_parser_portable.cpp:38:7: error: use of undeclared identifier 'isValid'
isValid(scalar_type) &&
^
/Users/george.profenza/Documents/cv/executorch_v0.2.0/runtime/executor/program.cpp:280:7: error: use of undeclared identifier 'constant_segment_data_'
if (constant_segment_data_.data() != nullptr) {
^
/Users/george.profenza/Documents/cv/executorch_v0.2.0/runtime/executor/tensor_parser_exec_aten.cpp:58:42: error: too many arguments to function call, expected single argument 'buffer_idx', have 2 arguments
s_tensor->constant_buffer_idx(), nbytes);
^~~~~~
/Users/george.profenza/Documents/cv/executorch_v0.2.0/../executorch/runtime/executor/program.h:96:23: note: 'get_constant_buffer_data' declared here
Result<const void*> get_constant_buffer_data(size_t buffer_idx) const;
^
/Users/george.profenza/Documents/cv/executorch_v0.2.0/runtime/executor/program.cpp:297:19: error: use of undeclared identifier 'constant_segment_data_'
size_t size = constant_segment_data_.size();
^
/Users/george.profenza/Documents/cv/executorch_v0.2.0/runtime/executor/method.cpp:1154:14: error: out-of-line definition of 'log_outputs' does not match any declaration in 'torch::executor::Method'
void Method::log_outputs() {
^~~~~~~~~~~
/Users/george.profenza/Documents/cv/executorch_v0.2.0/runtime/executor/method.cpp:1317:22: error: out-of-line definition of 'get_event_tracer' does not match any declaration in 'torch::executor::Method'
EventTracer* Method::get_event_tracer() {
^~~~~~~~~~~~~~~~
/Users/george.profenza/Documents/cv/executorch_v0.2.0/runtime/executor/program.cpp:309:43: error: use of undeclared identifier 'constant_segment_data_'
static_cast<const unsigned char*>(constant_segment_data_.data()) +
^
1 error generated.
make[3]: *** [CMakeFiles/executorch_no_prim_ops.dir/runtime/executor/tensor_parser_portable.cpp.o] Error 1
1 error generated.
make[3]: *** [CMakeFiles/executorch_no_prim_ops.dir/runtime/executor/tensor_parser_exec_aten.cpp.o] Error 1
2 errors generated.
make[3]: *** [CMakeFiles/executorch_no_prim_ops.dir/runtime/executor/method.cpp.o] Error 1
6 errors generated.
make[3]: *** [CMakeFiles/executorch_no_prim_ops.dir/runtime/executor/program.cpp.o] Error 1
make[2]: *** [CMakeFiles/executorch_no_prim_ops.dir/all] Error 2
make[1]: *** [CMakeFiles/portable_lib.dir/rule] Error 2
make: *** [portable_lib] Error 2
error: command '/Users/george.profenza/.pyenv/versions/mambaforge-22.9.0-3/envs/executorch/bin/cmake' failed with exit code 2
error: subprocess-exited-with-error
× Building wheel for executorch (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
full command: /Users/george.profenza/.pyenv/versions/mambaforge-22.9.0-3/envs/executorch/bin/python3.10 /Users/george.profenza/.pyenv/versions/mambaforge-22.9.0-3/envs/executorch/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /var/folders/fm/5zdm6gd15l7086j2jnr291xm0000gn/T/tmp_e0mrfbq
cwd: /Users/george.profenza/Documents/cv/executorch_v0.2.0
Building wheel for executorch (pyproject.toml) ... error
ERROR: Failed building wheel for executorch
Failed to build executorch
ERROR: Could not build wheels for executorch, which is required to install pyproject.toml-based projects
cc @shoumikhin - do you have any idea on this issue?
could your recent changes solve this issue?
I'm trying executorch for the first time and I am trying to follow these guide:
I have already built and ran the add.pte example following the getting-start-setup guide.
I'm running into a build error running build-run-coreml guide command:
sh examples/apple/coreml/scripts/build_executor_runner.sh
it doesn't seem to find the file_data_loader header:fatal error: 'executorch/extension/data_loader/file_data_loader.h' file not found
This is the full error:
I can see the file does exist (
./extension/data_loader/file_data_loader.h
). Perhaps this library wasn't build in a previous step ? What's the recommendation for clean build ?I am using OSX 14.1 with the recommended executorch setup (conda with Python 3.10.0, etc.)
Slightly off-topic, since I'm new to deploying PyTorch models on iOS, may I ask: what is the recommendation currently to reliable convert and run computer vision models (classifier/object detector/segmentation ViT models) ?
Context:
PyTorch > PyTorch Script > CoreML seems to be recommended path currently thought it can be quite fiddly to get right (sometimes with CoreML models that produce good results in Python, but not in XCode (preview) nor on device) 2.1. https://github.com/facebookresearch/playtorch (which seems nice for prototyping ML apps) is archived since October 2023. 2.2 https://github.com/pytorch/ios-demo-app is archived since November 2023 2.3. LibTorch-Lite
optimize_for_mobile
and_save_for_lite_interpreter
are in betaThank you so much, George