-
Notifications
You must be signed in to change notification settings - Fork 678
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
support LSTM #144
Comments
it seems that max_seq_length should be batch(input_tensor.shape[1]). since in torch, input shape would be:
|
@allenling Were you able to get this working? Would love to hear your approach |
not the best solution, but works for me only care about first output hope this could help you |
Thanks! Will give it a try |
Hey! Which version of PyTorch and Trt are you using? I'm getting some warnings and an error which I think means it failed to convert something
I'm on Python3.6, Pytorch 1.3, CUDA 10, Ubuntu 18, TrT 6.0.1, and the latest commit from this repo. I'm able to convert all the image models in the repo (alexnet, resnet, etc) |
A small update to forward fixed it for me: From this
To this:
|
When i use ths lstm op above, i meet a problem:
This is my code:
Can you help me @allenling @bfortuner |
lost dim after permute
seems cause by unsupported method squeeze
|
yes, this warn is also appear in my test. when i test cnn or rnn alone are successful, but when i run cnn, and use cnn output as lstm input, will error |
@allenling Does you know a way to replace the squeeze to a op trt supported? |
@allenling I notice tensorrt onnx parser support squeeze op. support op list |
@allenling I change squeeze to view, it works;
|
@allenling But i still have a problem, you can see see the error above. |
if i wanna change the shape of rnn, which is (1, 50, 256), to (1, 256, 50), you should:
if you miss b, and convert would cut h, and output._trt shape would be (T,), not (h, T)
so, be careful about the batch size, convert could cut the batch size, which is shape[0] |
@allenling Very tks.
Update: |
@allenling if i only want to get a 2-dim from view, how can i do? |
maybe make sure convert can reshape correctly by hacking converter? |
@allenling can i add your wechat, something wired? |
@allenling Is there a way to change the input size of lstm from 1, 50, 256 to 50,1,256 and not use batch_first=False |
I encountered a similar problem, is there any better solution now? |
If this is your first time converting an LSTM, I found it helpful to use the raw TensorRT API instead to make sure you understand what's happening underneath the surface. The torch2trt repo is good for basic stuff, but for anything non-trivial, you'll have to use the TensorRT API directly. I would start there. https://docs.nvidia.com/deeplearning/sdk/tensorrt-api/python_api/index.html It will take more time initially, but it will save you tons of time in the future. |
Guys, what if I want to input both input_tensor and the initial hidden state h_0 into a GRU or LSTM? |
I find the answer!
set the hidden_state directly:
reference: https://www.programmersought.com/article/22907561559/ |
Warning: Encountered known unsupported method torch.Tensor.data_ptr Have you solved these warnings? I also encountered these warnings. Although the model was exported, the reasoning failed |
i use pytorch to build my lstm network, it looks like
and lstm converter
max_seq_length should be input_tensor.shape[0]?
got a error
[TensorRT] ERROR: Parameter check failed at: ../builder/Network.cpp::addRNNCommon::397, condition: input.getDimensions().d[di.seqLen()] == maxSeqLen
and, how could i set a reverse weights?
please any help...
The text was updated successfully, but these errors were encountered: