Comments (6)
Thanks! Although I did not get to debug the benchmark tool with the command you provided, I succeeded by building it with:
bazel build //larq_compute_engine/tflite/benchmark:lce_benchmark_model --compilation_mode=dbg -s
Then I was able to properly read the stacktrace as you described and found the problem. I can now benchmark my model! Thanks again for the effort, I will close the issue now.
from compute-engine.
Thats a brilliant idea! That I did not think of this myself. Thanks, I guess for now this is the most straightforward method to get my model in the right form for the converter. I am able to produce a TFLite model now, although the benchmark seems to freeze for some reason for my model only. So far it seems that all operators in the TFLite model are supported, so not sure where this problem is originating. I will spend a bit of time investigating this and open a new issue if needed.
from compute-engine.
I am currently suspecting that it has to do with the pattern matching in
compute_engine/mlir/transforms
That is correct. The way it works is as follows: first the ste_sign
is transformed into a pair LceQuantize > LceDequantize
. Then in a separate step, LceDequantize > Pad > Conv2D
is converted into an LceBconv2d
. The end result is LceQuantize > LceBconv2d
.
I think that if you move the resize and transpose before the ste_sign
then it should work. Is that possible in your situation?
from compute-engine.
Thanks for your fast reply. I have found the pattern matching in prepare_patterns_common.td
As said I don't think I can manage to move these steps to the front in my tensorflow code. Therefore, my idea was to see if I can perhaps do some custom pattern matching so that LceDequantize > Resize > Transpose > Pad > Conv2D
gets converted into LceQuantize > LceBconv2d
. Do you think such a thing is possible?
from compute-engine.
The LceBconv2d
op only accepts NHWC
input, so if we would add extra pattern to the converter that "absorbs" the Transpose into the LceBconv2d
then it would not run at runtime. It might work if we make a pattern that moves the Transpose
in front of the LceDequantize
. Then the final result would be LceQuantize > Reshape > Transpose > LceBconv2d
.
That would be quite a bit of work, so its probably worth it to first try and fix it on the Python side by changing the model.
I don't know the details of your model, but perhaps it is possible to first train your model as you have it now (which does not convert properly). Then once it is trained you no longer need gradients so you could create an "inference-only version" of the same model where you move the transpose in front of the ste_sign
but load the weights of the original model. Is that something that could work? If not, maybe you can share a small snippet of the model code.
from compute-engine.
If you're able to share the .tflite
file (with randomized weights is fine) I'd be happy to run lce_benchmark
in a debugger to see why it freezes.
EDIT: You can do this as follows if you have bazel
installed:
First build a 'debug' version of the benchmark binary using bazel test
bazel test //larq_compute_engine/tflite/benchmark:lce_benchmark_model
Then run it in GDB like this:
gdb --args bazel-bin/larq_compute_engine/tflite/benchmark/lce_benchmark_model --graph=/path/to/your/model.tflite
In gdb
simply enter run<enter>
and when it crashes, enter backtrace<enter>
. That information should help us debug the problem.
from compute-engine.
Related Issues (20)
- Deployment on Cortex-M HOT 2
- Error on import HOT 2
- Select indirect BGEMM kernels - Benchmarking grouped binary convolutions HOT 3
- LCEInterpreter and converter design HOT 1
- core dumped when number of threads is larger than 2 HOT 3
- Benchmarking custom model HOT 3
- Int8 quantization for microcontroller HOT 13
- Failed import 'org.tensorflow.lite.DataType' on Android project HOT 8
- `convert_keras_model()` does not work as expected for BinaryDenseNet37 Dilated and XNORNet HOT 1
- DoReFa quantizer with higher number of MACs/Ops, Grouped convs as custom ops on LCE 0.7.0 HOT 3
- Get Operator-wise Profiling Results HOT 1
- Error while performing benchmarking HOT 53
- Bool input tensor HOT 7
- extra model size induced by non-parameter layer HOT 1
- Fix Android benchmarker build
- Larq Compute Engine seems incompatible with tensorflow-lite-task-vision on Android (using the latest tensorflow lite demo code) HOT 2
- Dorefa model size and behavior with full precision model and ste_sign model HOT 13
- Cannot save compressed binary or ternary weights, saved as float32 parameters HOT 12
- Error while building pip package on Fedora HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compute-engine.