-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
rnn/lstm/gru dynamic quantization #5435
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
nihui
commented
Apr 18, 2024
•
edited
Loading
edited
- rnn
- rnn-arm
- lstm
- lstm-arm
- lstm-x86
- gru
- gru-arm
- fix over load s8
- coverage
- doc
- speed test
- rnn aq
- rnn-arm aq
- lstm aq
- lstm-arm aq
- lstm-x86 aq
- gru aq
- gru-arm aq
nihui
changed the title
[WIP] rnn/lstm/gru weight only quantization
rnn/lstm/gru weight only quantization
Apr 24, 2024
nihui
changed the title
rnn/lstm/gru weight only quantization
[WIP] rnn/lstm/gru weight only quantization
Apr 24, 2024
nihui
changed the title
[WIP] rnn/lstm/gru weight only quantization
[WIP] rnn/lstm/gru dynamic quantization
Apr 28, 2024
nihui
force-pushed
the
rnn-weight-quantize
branch
from
April 30, 2024 11:45
b85eb01
to
e0575ea
Compare
nihui
force-pushed
the
rnn-weight-quantize
branch
from
April 30, 2024 11:50
dba4755
to
1830257
Compare
This reverts commit 951ab60.
import torch
import torch.nn as nn
import torch.nn.functional as F
import pnnx
class Model(nn.Module):
def __init__(self):
super(Model, self).__init__()
self.rnn = nn.RNN(input_size=256, hidden_size=256, num_layers=30)
self.lstm = nn.LSTM(input_size=256, hidden_size=256, num_layers=30)
self.gru = nn.GRU(input_size=256, hidden_size=256, num_layers=30)
def forward(self, x):
out0, _ = self.rnn(x)
out1, _ = self.lstm(x)
out2, _ = self.gru(x)
return out0, out1, out2
net = Model().half().float()
net.eval()
torch.manual_seed(0)
x = torch.rand(300, 1, 256)
pnnx.export(net, "rnn.pt", x) ncnn2int8 rnn.ncnn.param rnn.ncnn.bin rnn-int8.ncnn.param rnn-int8.ncnn.bin /dev/null
|
|
nihui
changed the title
[WIP] rnn/lstm/gru dynamic quantization
rnn/lstm/gru dynamic quantization
May 8, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.