tpaul1611 / python_tflite_for_amazonlinux

Python TensorFlow Lite (tflite) for amazonlinux/aws lambda.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to find file 'interpreter_wrapper/interpreter_wrapper.i'

philmassie opened this issue · comments

Hello.
Thanks so much for this, I've been struggling to compile TFlite for lambda, and your repo brings me so close.
Not certain what the best way to ask questions is, I hope contacting you here is ok. Wondering if you had any other steps involved?

For me the sh ./tensorflow/tensorflow/lite/tools/pip_package/build_pip_package.sh call ends in the following error:

building 'tflite_runtime._interpreter_wrapper' extension swigging interpreter_wrapper/interpreter_wrapper.i to interpreter_wrapper/interpreter_wrapper_wrap.cpp swig -python -c++ -I/root/tensorflow/tensorflow/lite/tools/pip_package/../../../.. -module interpreter_wrapper -outdir tflite_runtime -o interpreter_wrapper/interpreter_wrapper_wrap.cpp interpreter_wrapper/interpreter_wrapper.i Unable to find file 'interpreter_wrapper/interpreter_wrapper.i'. error: command 'swig' failed with exit status 1

Do you have any thoughts perhaps? I'm kind of a newb in building so I dont know how to interpret the error.
Thanks, sorry to trouble you.

Hello @philmassie,
I just ran my Dockerfile and it worked, usually with Docker, if it works for me it should work for everybody, but I am sure there are exceptions. But you can find the compiled TFlite for lambda in my repo under TFlite for lambda
If you are trying to create a different version than 2.1.0 tell me what changes you made to my Dockerfile and I will have a look at it.

Thanks @tpaul1611, for responding.
It's so frustrating, I made no changes to your dockerfile at all (well, I did afterwards, but initially not).
If you have cloned the tf repo locally, I wonder if I can ask a favour. Does your repo include the file /tensorflow/tensorflow/lite/python/interpreter_wrapper/interpreter_wrapper.i?
Seems so unlikely, but perhaps the current master is missing the files - long shot.

Thanks again

The interpreter_wrapper.i is not part of the tensorflow repo, .i files are build artefacts from the make command inside the build_pip_package.sh. Maybe something went wrong on one of your docker layers which is now cached, have you tried running everything again without cache?

Example:
docker build --no-cache -t tflite_amazonlinux .

I had cached layer myself, without cache i get the same issue.
The problem is the constant updates on the master branch, to make the building stable we should check out a specific tag. This was an issue I expected initially but did not anticipate that it is changing so rapidly. I experimented with some tags and the only one I got working in this short time was v2.2.0-rc0. I have updated the project accordingly.

Thank you so so much for all this info, I'll pick through it tomorrow, and try the caching suggestion. I'm certain that using the correct branch will work though.

I posted on the TF github repo and they had this to say:
tensorflow/tensorflow#37639 (comment)
"in e638577, interpreter_wrapper/interpreter_wrapper.i was removed because now interpreter_wrapper functions are exported from C++ to Python with pybind11 instead of swig. It seems corresponding changes were not made in the shell script and related files."

I'm not 100% clear what this means, but I had read about a change from swig to pybind elsewhere. I will see if they point me to another solution and let you know the outcome, just so it's somewhere.

Thanks so much for your time and assistance.