Skip to content
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

How to make tracer account for arbitrary restrictions such as making a particular dim divisible by 4? #375

Open
saravanabalagi opened this issue Apr 25, 2024 · 1 comment

Comments

@saravanabalagi
Copy link

In my model, I check for shape during the forward function with something like:

if x.shape[1] % 4 != 0:
    raise ValueError(
        "Cannot use sin/cos positional encoding with "
        "odd dimension (got dim={:d})".format(x.shape[1])
    )

It is ok to prune as long as x.shape[1] is divisible by 4, but since this information is not available to the tracer, it prunes to match the specified pruning ratio. How can I make sure this restriction is accounted for during pruning?

@saravanabalagi
Copy link
Author

Related to #38. Although it is entirely different with regards to its objective, the solution can in part solve this one as well. But the param round_to will round it for all layers, if I am not wrong. Is there another/better way to solve this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant