Code Monkey home page Code Monkey logo

Comments (6)

lazycal avatar lazycal commented on June 27, 2024 1

For example, any approach to control kernel_size of Conv2d to be in range [1, 15]?

One ad-hoc way would be to add something like cons.append(nnsmith_le(kernel_h_size, 15)) around here

cons.append(nnsmith_ge(mimic_kh, 1))

from nnsmith.

ganler avatar ganler commented on June 27, 2024 1

Also, you might find the gist helpful: https://colab.research.google.com/drive/13LNQBvfpPFiaHWKnac6hxzvJY4LUAWWQ?usp=sharing

from nnsmith.

jakc4103 avatar jakc4103 commented on June 27, 2024 1

@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

Tks, this works.

from nnsmith.

ganler avatar ganler commented on June 27, 2024

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 4 to be able to generate conv2d.

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 patch_requires decorator. See the TensorRT example:

@patch_requires(TRTFactory.system_name, "core.Pool2d")

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 method="symbolic-cinit" in model_gen:

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!

from nnsmith.

ganler avatar ganler commented on June 27, 2024

@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

from nnsmith.

ganler avatar ganler commented on June 27, 2024

Feel free to reopen if you still encounter any issues on this.

from nnsmith.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.