Comments (6)
@qcolombet I'm not sure we need to profile on the backend we will use. I think we can make it work by lowering all operators for profiling on the interpreter. Doing so means we get maximum profiling info about all components of lowered operators. Then if a backend does not want to lower something it can reconstruct what quantization parameters should be used for the unlowered operator from the profile of its components.
As a simple example, right now we profile an FC as unlowered. This means when we quantize we apply the same quantization params to the matmul and the add when lowering it. Instead, we could lower it to matmul and add for profiling so we do get their quantization params. Then if a backend wants to not lower the FC, or use the same quantization params for both, then it can do so. But this way we don't lose information.
from glow.
The idea is to run profiling once per network (use the quantization profile node) and then reuse the profiled data for different backends to quantize the network properly. I think it does not really matter who is going to execute profiling (one backend is enough). There is no plan to support this in other backends, certainly not on the accelerator.
In a long-term, graph profiling for quantization will be just a utility and Glow will load pre-quantized models. But even if we profile ourselves performance efficiency is not a big issue here.
from glow.
In a long-term, graph profiling for quantization will be just a utility and Glow will load pre-quantized models.
I think we may have some precision issues here for input operators that we lower. For example, let's say we get a quantized LSTM unit as input. The quantization parameters for the LSTM that are passed to Glow give us poor information about the best parameters for each individual component of the lowered LSTM.
One alternative would be to have ONNX lower the LSTM itself and give us the components of the LSTM itself all quantized. However, what if a backend wants to not lower the LSTM? We could try to pattern match and recreate it, but it may be imperfect/difficult.
Perhaps we could design this such that the quantized LSTM unit is passed unlowered into Glow along with quantization parameters for the internal components of the LSTM. I have no idea how easy or feasible this might be. But we could then lower it and know how to quantize its component parts, while still allowing a backend to decide not to lower it in the first place.
from glow.
There is no plan to support this in other backends, certainly not on the accelerator.
@rdzhabarov Okay, so just supporting this in the interpreter is enough.
@jfix71 raised an interesting issue and it sounds like we would want to run the profiling on the backend we want to use. What is the plan then?
from glow.
Makes sense to me assuming reconstructing the information is indeed possible.
from glow.
All right, there is nothing to do here.
Thanks for the feedbacks!
from glow.
Related Issues (20)
- [Bug] error on compiling an ONNX model
- Request release - This pull request was **exported** from Phabricator. Differential Revision: [D39456245](https://www.internalfb.com/diff/D39456245) HOT 1
- model-compiler missing HOT 1
- BatchedReduceAdd and BatchedReduceProd multi-axis support
- Where Glow invokes llvm ? HOT 2
- build_Debug error HOT 1
- Multiple tensorflow-lite models in one application
- Glow cmsis support on aarch64
- Typed pointers support will be dropped in LLVM 17 HOT 1
- Compile error when building glow HOT 6
- Error occurred during the compilation of Glow
- FAILED: bin/image-classifier during building glow
- Unable to access glow model HOT 3
- Adding a library for a new backend, CMSIS. HOT 1
- Adding Support for ELU Activation functions
- Evaluate Profile-Guided Optimization (PGO)
- How to build glow for Buildroot based Linux?
- Sunsetting Glow Active Development HOT 1
- Error building on Mac Ventura
- Cannot open connection when downloading pb file
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 glow.