Comments (5)
Hello,
You need to pass a QuantTensor to the QuantConv2d layer, which happens when you enable return_quant_tensor=True in the activation before that QuantConv2d layer. For the very first conv layer, you should insert a quantized identity (a quantized hard tanh) right at the beginning of the network.
As a side note, I see you are working on a quantized MelGAN implementation. GANs can be quite tricky to quantize. We have a working 8 bit version internally that we are going to release at some point in the next couple of months.
Alessandro
from brevitas.
@volcacius, yeah, i see. I was successful to quantize melgan to float16 on tflite, it's run 2x faster than realtime. On 8 bit, the accuracy drop much :)), there are many white noise :v. i'm still investigate ur implementation and tflite implementation. Somehow the output of tflite and your's framework is different on 8bit :D. (32bit and 16bit is almost same). If u know the difference of ur quantize and tflite procedure, pls let me know :'(. I thought it was because of the bias when i don't use fake-quantize aware for it, but remove bias didn't solved the problem :D
from brevitas.
It really depends on how you are setting up the quantized layers.
In general TFLite is a great tool for production-oriented quantization, while Brevitas is oriented towards research, which is why it provides many more options.
For what it's worth, our internal results at 8 bit with MelGAN on LJSpeech are on par with floating point quality. I'll be happy to share the details once the model is release.
from brevitas.
@volcacius Looking forward to ur model :D . Noticed that my result on LJspeech using 8bit (base on this framework) are on par with float32 too (use pytorch) but have some difference when convert to tflite :D. BTW, thanks for ur great implementation again :D.
from brevitas.
I see now, glad to hear about your good results and thanks for the positive feedback! Please cite us if you plan to release/publish them somewhere, I would really appreciate.
On the export side, unfortunately there aren't any plans for a TFLite compatible flow at the moment. We are working on a custom ONNX based flow, but it's going to target deployment on our own FPGAs.
from brevitas.
Related Issues (20)
- PTQ Tutorial
- Question: Unsigned Quantization HOT 3
- Implement context-manager based export
- Missing Proxy tests
- Export ONNX QOperator HOT 5
- Fix Value Tracer
- Activation Equalization co-optimize flag
- Update entrypoint for LLM
- Add squeeze / unsqueeze operations to quant invariant functions in `torch_handler.py` HOT 4
- Add support for minifloat ptq with fx backend on residual models
- Implement `torch.where` STE for minifloat clamping
- Remove maximum assumptions about NaN/inf values for minifloat configurations
- Change way of setting `NaN` and `inf` values for custom minifloat formats
- Update signature check
- Deprecate use of MacOS (Darwin) runners in CI
- Adding tests for "quantize" function for CNN PTQ HOT 7
- Call for better/more documentation
- Per-channel zero points but per-tensor scales HOT 2
- Documentation setup thoughts HOT 3
- update dependencies=2.0.1 requirement
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 brevitas.