-
Notifications
You must be signed in to change notification settings - Fork 215
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
Full support for dynamic If #1062
Comments
Link #1038, covering two first tasks |
@kali do you have any plans for implementing task 4 and 5 anytime soon :)? If possible, could you please leave some hints on how it can be implemented, I'd like to give it a try. Thank you. |
I think it should start with 5. There is a huge amount of code in Scan to declutter it (decluttering is actually implementing the high level optimization in tract terminology). I think most of what we do in Scan can be mapped to ifte but the Scan code is not generic. Plus we have an ongoing epic that aims at "flattening" Scan, inlining the loop body inside the main model to normalize the node connections so a lot of the Scan declutter code will probably go away or be drastically simplified. So if you start working on ifte and perform similar simplifications, we will later on have to go the same path and flattening the ifte too, making a lot of these efforts redundant. So if you want to work on ifte decluttering, I think you should keep it use-case driven, not implementing the whole thing before we get more clarity about what is happening with Scan. Does it make sense ? If so, we should probably move this to a different issue, and target optimising the silero vad use-case, at least as a starting point. Refresh my memory. Are we in a position where we can look at a model dump (in the command line) enough to identify possible bottlenecks yet ? |
@kali Thanks for the response. It does make sense. I think you are referring to this PR #1090 probably? About the bottlenecks I don't think we got to that point, since running the latest
|
@7r3nzy yes, I'm referring to 1090 (and a couple of them that will follow). Is it not just again a problem of |
@kali Thanks for pointing that out :), It moved to next step I think but I am now getting:
|
Ok this looks more serious, you can use "--pass analyse" to see the network before it crashes. it looks like the "then" and "else" branch have a different rank here, with an extra dimension in the else... |
It produced the following output without any crash:
|
Ha. And we don't see the then and else branch, it's not plugged in. Can you link me the onnx file again so I can have a look ? |
Yep, here it is https://github.com/snakers4/silero-vad/archive/refs/tags/v4.0.tar.gz Path inside the archive: |
Please have a look at #1102 . It's... complicated, but I guess the network is. I hope you can figure out where the discrep is. |
The PR just fixes the dump format so that If branch are shown in the graph. |
Thank you so much for this, I used
┃┃┃ [loop|loop] ┏ 2 Source input_data1
I think the important thing to note from the onnx if operator specs is: The I am also leaving the onnx if operator specs here for easy access: If If conditional This version of the operator has been available since version 19 of the default ONNX operator set. Other versions of this operator: 1, 11, 13, 16 else_branch : graph (required) Inputs cond : B Outputs (1 - ∞) outputs (variadic, heterogeneous) : V |
Wow. Different shapes? ONNX spec is borderline crazy here. I can manage to support different shapes of the same rank with symbols, but supporting different ranks is an absolute no for tract. Can you distill down the use-case for me for different ranks ? I can't even imagine how that could be useful. I would assume it's nearly immediately followed by a Reshape right ? Can we push this Reshape up into the branches ? |
It is immediately followed by
The problem is, I don't think silero-vad devs have mentioned/published their sources they used to train this model, so even if we change the model I'd be stuck on training it :(
My knowledge about the network is very limited, but I'll give it a try and get back to you if I find anything :) |
What kind of shapes is netron reporting ? I am surprised that the convolution can deal with the two axes configuration, as its weights have to be of the same rank than the input. Unless they altering the weight shapes too ? We need to understand what they are doing, which operator collapse the two axes configuration into one. From there we can try and push back the change to unify the branches configuration inside the If. Do not worry too much yet about the sources and training, we can alter the model onnx file with a python script, probably just inserting a reshape/squeeze/unsqeeze in the right place to make the axes consistent, before handing it to tract. |
It may also be a tract bug while inferring shapes in one of the branches. Let's hope the Silero team can help us understanding what we are looking at. |
More details on the tract output: These are just plain outputs without any analysis, I'll get back to you with more details. |
Guess dropping the "sonos" name in the issue at Silero generated some confusion and/or wrong expectations :) |
ONNX If only works has a loading macro expansion: the condition must be known and fixed at loading time, the right branch is substituted in the type phase. This blocks Silero VAD v4 (see #1029).
The text was updated successfully, but these errors were encountered: