Reputation: 11
Exact command to reproduce: toco --help
I am trying to run the codelab tutorial of tensorflow lite. After installing tf-nightly, when I try to run the command "toco --help", I get the error ModuleNotFoundError: No module named 'tensorflow.contrib.lite.toco.python'.
I have tried this on 3 computers( all Windows) and the same problem persists.
Source code / logs
C:\Users\HP\Downloads>toco --help
Traceback (most recent call last):
File "c:\programdata\anaconda3\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec)
File "c:\programdata\anaconda3\lib\runpy.py", line 85, in run_code exec(code, run_globals)
File "C:\ProgramData\Anaconda3\Scripts\toco.exe_main.py", line 5, in ModuleNotFoundError: No module named 'tensorflow.contrib.lite.toco.python'
Upvotes: 1
Views: 6379
Reputation: 433
The tensorflow library in Python36 has some missing files. My Python36 folder is in c:\Python36. So the toco will load "C:\Python36\Lib\site-packages\tensorflow\contrib\lite\python". Whoever coded the toco forgot to copy the whole folder into there.
You need to copy from your tensorflow folder to the lite folder. My tensorflow is at
"c:\tensorflow". The lite folder looks like this:
Copy all files from "C:\tensorflow\tensorflow\contrib\lite\python" to "C:\Python36\Lib\site-packages\tensorflow\contrib\lite\python".
Now, you need to make a test, "toco --help"
Upvotes: 0
Reputation: 1
Issue Solved Clone the tensorflow repository an copy the lite folder from tensorflow\tensorflow\contrib and paste it in the C:\Users\$USERNAME$\AppData\Local\Programs\Python\Python36\Lib\site-packages\tensorflow\contrib\lite
Upvotes: 0
Reputation: 16327
I solved it by downgrading tensorflow to 1.7
pip install --upgrade "tensorflow==1.7.*"
Upvotes: 1
Reputation: 21
I was getting the same error and apparently TOCO doesn't work on Windows machines, https://github.com/tensorflow/tensorflow/issues/16374
My alternative to optimize the model was to user TensorFlow Mobile, instead of TensorFlow Lite, and use 'optimize_for_inference'. You could also try on a linux environment.
Upvotes: 2