-
Notifications
You must be signed in to change notification settings - Fork 119
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
[Converter] TFLite size is larger than expected #320
Comments
The model you posted has been inspected, in which the size of buffers is only 36KB. So, the only way to lower the size of the model is to rewrite the GRU operation using |
|
# separated_rnn_gate_calc=False
rzt_left = FC_i{r,z}(x)
rzt_right = FC_h{r,z}(h)
rzt_sum = rzt_left + rzt_right
rzt = sigmoid(rzt_sum)
rt, zt = split(rzt, 2)
# separated_rnn_gate_calc=True
rt_left = FC_ir(x)
rt_right = FC_hr(h)
rt_sum = rt_left + rt_right
rt = sigmoid(rzt_sum)
zt_left = FC_zr(x)
zt_right = FC_hz(h)
zt_sum = zt_left + zt_right
zt = sigmoid(zt_sum) So it will be optimized from 8 ops (10 tensors) to 5 ops (8 tensors) for each time step.
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/core/kernels/register.cc Unfortunately, it is a custom op as of now (May 30, 2024).
I don't know. It depends on your needs. It the target model with its size around 80-100K is desired, I guess |
Take a glance at the previous implementation of
I'm quite interested in translating such challengable builtin operators. Based on my current ability, may I ask what the procedure it will be to support |
Well, it is doable and not hard at all if only GRU is involved, but for a better design, it takes some time. |
One week is enough? I'm available 24/7 as long as it can be realized incrementally, lol. You can focus on your business first and any instruction is helpful to me when you free. P.S. not only float structure but also quantized gru with |
Well, I cannot guarantee on that. But I can do QA and guide you throughout the process.
This is just copy paste I think. The main difficulty is to add a new subgraph for the GRU operation, so doesn't bother. |
debug.zip
The text was updated successfully, but these errors were encountered: