Open songzhibo1 opened 1 month ago
It looks like the error is in the customized TFLite compilation. You can follow the steps to find the error message:
You can run the commands one by one (these commands can be found in the building scripts):
generate the obfuscation model and modified source code of TFLite
python obfuscation.py --model_name=fruit --extra_layer=30 --shortcut=30
build the customized tflite from the modified source code, the problem is usually caused by this step. Note that if your machine has enough RAM (>32 GB), you can remove the option "--jobs=14", it defines the maximal nb. of compiling jobs:
cd ./tensorflow-2.9.1/
bazel build --jobs=14 //tensorflow/tools/pip_package:build_pip_package
generate python package
./bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
cd ..
uninstall the original TFLite
python -m pip uninstall -y tensorflow
install the customized TFLite
python -m pip install /tmp/tensorflow_pkg/tensorflow-2.9.1-cp38-cp38-linux_x86_64.whl
test
python test_model.py --model_name=fruit
When you identify the step causing the problem, you can post the error message here. And I can try my best to help you.
Hello, thank you very much for sharing the code. I encountered some errors while using Docker to pull the code and run
bash build_obf.sh
. I would like to ask for your guidance on how to resolve this issue. Your help would be greatly appreciated!Thank you again for your support!
ERROR: An error occurred during the fetch of repository 'tf_runtime': Traceback (most recent call last): File "/Code275/tensorflow-2.9.1/third_party/repo.bzl", line 64, column 33, in _tf_http_archive_impl ctx.download_and_extract( Error in download_and_extract: java.io.IOException: Error downloading [https://storage.googleapis.com/mirror.tensorflow.org/github.com/tensorflow/runtime/archive/093ed77f7d50f75b376f40a71ea86e08cedb8b80.tar.gz, https://github.com/tensorflow/runtime/archive/093ed77f7d50f75b376f40a71ea86e08cedb8b80.tar.gz] to /root/.cache/bazel/_bazel_root/a5a5071651a6c349d639f25e016288e1/external/tf_runtime/temp5368221067054860666/093ed77f7d50f75b376f40a71ea86e08cedb8b80.tar.gz: connect timed out ERROR: /Code275/tensorflow-2.9.1/WORKSPACE:11:14: fetching _tf_http_archive rule //external:tf_runtime: Traceback (most recent call last): File "/Code275/tensorflow-2.9.1/third_party/repo.bzl", line 64, column 33, in _tf_http_archive_impl ctx.download_and_extract( Error in download_and_extract: java.io.IOException: Error downloading [https://storage.googleapis.com/mirror.tensorflow.org/github.com/tensorflow/runtime/archive/093ed77f7d50f75b376f40a71ea86e08cedb8b80.tar.gz, https://github.com/tensorflow/runtime/archive/093ed77f7d50f75b376f40a71ea86e08cedb8b80.tar.gz] to /root/.cache/bazel/_bazel_root/a5a5071651a6c349d639f25e016288e1/external/tf_runtime/temp5368221067054860666/093ed77f7d50f75b376f40a71ea86e08cedb8b80.tar.gz: connect timed out ERROR: no such package '@tf_runtime//': java.io.IOException: Error downloading [https://storage.googleapis.com/mirror.tensorflow.org/github.com/tensorflow/runtime/archive/093ed77f7d50f75b376f40a71ea86e08cedb8b80.tar.gz, https://github.com/tensorflow/runtime/archive/093ed77f7d50f75b376f40a71ea86e08cedb8b80.tar.gz] to /root/.cache/bazel/_bazel_root/a5a5071651a6c349d639f25e016288e1/external/tf_runtime/temp5368221067054860666/093ed77f7d50f75b376f40a71ea86e08cedb8b80.tar.gz: connect timed out INFO: Elapsed time: 64.286s INFO: 0 processes. FAILED: Build did NOT complete successfully (0 packages loaded) Fetching @llvm-raw; fetching 56s Fetching ...vm-raw; Extracting /root/.cache/bazel/_bazel_root/a5a5071651a6c349d639f25e\ 016288e1/external/llvm-raw/temp17482780817171387685/1cb299165c859533e22f2ed05eb2abd5071544\ df.tar.gz 6s build.sh: line 3: ./bazel-bin/tensorflow/tools/pip_package/build_pip_package: No such file or directory [1000, 224, 224, 3] Data type of this model is float32 Estimated count of arithmetic ops: 0 ops, equivalently 0 MACs Found existing installation: tensorflow 2.9.1 Uninstalling tensorflow-2.9.1: Successfully uninstalled tensorflow-2.9.1 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv WARNING: Requirement '/tmp/tensorflow_pkg/tensorflow-2.9.1-cp38-cp38-linux_x86_64.whl' looks like a filename, but the file does not exist Processing /tmp/tensorflow_pkg/tensorflow-2.9.1-cp38-cp38-linux_x86_64.whl ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: '/tmp/tensorflow_pkg/tensorflow-2.9.1-cp38-cp38-linux_x86_64.whl'
Traceback (most recent call last): File "test_model.py", line 5, in
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'