-
Notifications
You must be signed in to change notification settings - Fork 199
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
Multiple quantized parameters in the same layers #1122
Comments
The answer provided by the bot is wrong (no surprise there). brevitas/src/brevitas/nn/quant_rnn.py Lines 39 to 56 in 4617f7b
Then you can have your custom layer as: class NewLayer(torch.nn.Module):
def __init__(self, weight_quant_1 = Int8WeightPerTensorFloat, weight_quant_2 = Int8WeightPerChannelFloat):
self.parameter_1= GateWeight(...., weight_quant_1)
self.parameter_2 = GateWeight(...., weight_quant_2)
def forward(self, x):
quant_weight_1 = self.parameter_1.quant_weight() # or self.parameter_1()
quant_weight_2 = self.parameter_2.quant_weight() # or self.parameter_2() I didn't test this code, take it more as pseudocode but it should give you an idea of where to start |
Great! Thanks for your help! However, also the bot solution at least looks cool ;) |
I am working with custom layers which have two set of trainable parameters. They follow two different distributions, so it will be useful to have two different quantization scheme for both of them in order to reduce the quantization error.
Is it already possible in Brevitas? is there ant wolkaround that I can adopt?
The text was updated successfully, but these errors were encountered: