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
Signficant differences between measurements and predictions on Pixel 4 #83
Comments
I guess --warmup_runs and --num_runs are causing the problem. In fact, when debugging the code I found that when training the predictor nn_meter/builder/backends/tflite/tflite_profiler.py adb.shell executes a command like "taskset 70 <path/to/benchmark_ model model> --num_threads=1 --num_runs=50 --warmup_runs=10 --graph=<path/to/tflite/model> --enable_op_profiling=true --use_gpu=false" By the way, my attempt to “nn-meter predict --predictor cortexA76cpu_tflite21 --predictor-version 1.0 --tensorflow pb_models/resnet18_0.pb” reported the error as follows (resnet18_0.pb was from pb_models): (nn-Meter) Failed to get shape of node conv1.conv/Conv2D. Could you use "python3 -m pip freeze" to show the package version. And I want to know the code you use to convert .pb into .tflite. Thanks & Regards |
Hi @AIxyz . In my observation, using a larger value of
For running predictors, I only installed the source code
Regarding the code for converting .pb to .tflite, since the provided .pb models are generated in TF1, I have to use the API from TF1
|
Hi, Thanks for your interests of nn-Meter. There are many factors that can affect the measurement latency, such as the CPU affinity, CPU frequency, and the compiling benchmark model. Maybe you could try to apply our provided benchmark models to profile models or set a fixed CPU frequency for the calling CPU cores by commands like: cd sys/devices/system/cpu/cpu4/cpufreq
echo "userspace" > scaling_governor
echo 2419200 > scaling_max_freq
echo 2419200 > scaling_min_freq
echo 2419200 > scaling_setspeed I hope the information could help you get the consistent latency with our predicted values. And hi @AIxyz , thanks for join the discussion! I try to reproduce the bug you mentioned by running
Could you please provide the environment information, such as the version of python/nn-meter/tensorflow, to help me debug this? Thanks a lot! Best regards, |
@JiahangXu Thanks for sharing more information about the experimental setup. For fixing CPU frequency, I wonder whether it needs to first root the phone to acquire permission. CPU, TFLite v2.1
|
Hi, Our customized benchmark models are compiled in about year 2020. We have not specified to use Aarch64 for model profiling, which is an optional argument at that moment. After the code of nn-Meter released, we found that the compiled benchmark model without Aarch64 will cause all profiling latency larger than that with Aarch64. However, for the consistency with our paper, we didn't modify our released benchmark model. Best regards, |
Hi, @JiahangXu , this is my logs in docker container from ubuntu:focal (3bc6e9f30f51), but now I can't repeat the error in a new container. It's like everything suddenly got better, but the result of "python3 -m pip freeze" didn't change. And 'git log' in nn-Meter as follows: commit 4c10c002715e6df4649f015c9187dc8b28bfcc11 (HEAD -> xyz, origin/dev/dataset-generator, main)
Author: Jiahang Xu <jiahangxu@microsoft.com>
Date: Fri Jul 1 11:07:10 2022 +0800
Update version info after v2.0 (#75) 'diff -r /home/john/Python/env_py36X/lib/python3.6/site-packages/nn_meter /home/john/Work/nn-Meter/nn_meter' only show the pychche. My container logs as follows:
Thanks & Regards |
@JiahangXu Thanks for the clarification. |
Hi,
I am trying to reproduce the results of nn-Meter by comparing the measurements on Pixel 4 with the results from the pre-trained predictors (i.e., cortexA76cpu_tflite21 and adreno640gpu_tflite21). However, I observed significant differences between the measurements and predictions.
I converted the provided TensorFlow pb models (i.e., pb_models) into .tflite format, and built the binary benchmark_model from TFLite v2.1 source. I benchmarked all the models with the following commands on Pixel 4 (Snapdragon 855 and Adreno 640):
For example, the measurement of resnet18_0 on CPU shows:
but the prediction on cortexA76cpu_tflite21 is:
with error 81% (i.e., 216.19 v.s. 119.41).
Similarly, for resnet50_0 on GPU, the measurement is:
and the predictor produces the following:
with error 57% (i.e., 91.73 v.s. 58.35).
I am wondering whether I set up the same experimental environment as the one for training the predictors. I can provide more information (e.g., the tflite models) if needed and look into the issue further.
Thank you!
The text was updated successfully, but these errors were encountered: