-
Notifications
You must be signed in to change notification settings - Fork 23
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
approach/setting to control search space of a specific attribute #69
Comments
One ad-hoc way would be to add something like nnsmith/nnsmith/abstract/op.py Line 1424 in 7b793ff
|
Recall that conv2d only accepts 4-dimension inputs. Because the graph generation is randomized in a way to start with a placeholder that has a random rank, as a result, it must be lucky enough to start with This should be fixed by adding an extra argument for configuring the rank (length of its shape dimensions) of the starter placeholder (WIP). For adding extra constraints, because we don't want to bother users by editing the source code, there is a way to systematically patch constraints at user level with the nnsmith/nnsmith/backends/tensorrt.py Line 151 in bdc2747
Probably something like: @patch_requires(${THE_FACTORY_TYPE}$.system_name, "core.Pool2d")
def RulePool2d(self: AbsOpBase, _: List[AbsTensor]) -> List[Union[z3.BoolRef, bool]]:
return [self.kernel_h_size <= 15, self.kernel_w_size <= 15] Meanwhile for some good randomness of shapes, try to use other gen = model_gen(
...
method: str = "symbolic-cinit", # or "concolic"
...
): My apologies for the incomplete documentation and will be improving the doc soon (prob. next mon). For the rank issue there will be a patch soon and I will offer a colab example later today. Meanwhile, for now please try to use the latest version with: pip install "git+https://github.com/ise-uiuc/nnsmith@main#egg=nnsmith[torch,onnx]" --upgrade This will provide a lot more features and possibly a better experience (in debugging etc.). Thanks! |
@jakc4103 You can try https://github.com/ise-uiuc/nnsmith/blob/main/doc/cli.md#add-extra-constraints with the latest nnsmith: pip install "git+https://github.com/ise-uiuc/nnsmith@main#egg=nnsmith[torch,onnx]" --upgrade |
Also, you might find the gist helpful: https://colab.research.google.com/drive/13LNQBvfpPFiaHWKnac6hxzvJY4LUAWWQ?usp=sharing |
Tks, this works. |
Feel free to reopen if you still encounter any issues on this. |
Is there any approach/setting to control the search space for value of some specific OP attributes?
For example, any approach to control kernel_size of Conv2d to be in range [1, 15]?
I tried to generate a model with conv2d and relu only, with max_nodes set to 100.
If the timeout_ms was set to 10000 (relativly small number) ms, the solver seems to find nothing, then model_gen failed with following errors.
If timeout_ms set to 3000000 (a large number) ms, the entire model_gen process takes a very long time to generate a single model
The text was updated successfully, but these errors were encountered: