We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
When trying to partially compile transformer encoder, you are met with the following error:
Expected to find type str for value why_not_sparsity_fast_path.76 but get nothing.
Steps to reproduce the behavior:
import torch import torch.nn as nn import torch_tensorrt class TransformerModel(nn.Module): def __init__(self, input_dim, hidden_dim, num_layers, num_heads): super(TransformerModel, self).__init__() # define embedding layer self.embedding = nn.Embedding(input_dim, hidden_dim) # define transformer encoder self.transformer_encoder = nn.TransformerEncoder( nn.TransformerEncoderLayer(d_model=hidden_dim, nhead=num_heads), num_layers=num_layers ) # define output layer self.fc = nn.Linear(hidden_dim, input_dim) def forward(self, x): # apply embedding layer x = self.embedding(x) # apply transformer encoder x = self.transformer_encoder(x) # apply output layer x = self.fc(x) return x model = TransformerModel(input_dim=100, hidden_dim=128, num_layers=2, num_heads=4) input_data = torch.randint(low=0, high=100, size=(32,10)) # sequence length of 10, batch size of 32 input_data = input_data.to("cuda").to(torch.int) model.to("cuda") output = model(input_data) model.eval() inputs = [ torch_tensorrt.Input( min_shape=[32,10], opt_shape=[32,10], max_shape=[32,10], dtype=torch.int, )] enabled_precisions = {torch.float, torch.half} # Run with fp16 with torch_tensorrt.logging.graphs(): trt_ts_module = torch_tensorrt.compile( model, inputs=inputs, enabled_precisions=enabled_precisions, require_full_compilation=True ) result = trt_ts_module(input_data) with open("../saved_models/trt_ts_module.ts", "wb") as f: torch.jit.save(trt_ts_module, f)
Build information about Torch-TensorRT can be found by turning on debug messages
PyTorch
conda
pip
libtorch
The text was updated successfully, but these errors were encountered:
fixed here: #1785
Sorry, something went wrong.
bowang007
Successfully merging a pull request may close this issue.
Bug Description
When trying to partially compile transformer encoder, you are met with the following error:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Environment
PyTorch
(conda
,pip
,libtorch
, source): sourceAdditional context
The text was updated successfully, but these errors were encountered: