TypeError: 'tensorrt_bindings.tensorrt.ITensor' object is not iterable
Open
@peri044 is already working on this.
Since Oct 15, 2024.
bug
story: Operator Coverage & Converters
- Dominant language
- Python
- Stars
- 3k
- Forks
- 410
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 78
Description
Bug Description
when i use torch_tensorrt.compile transformer module with dynamic_shapes, it will occur this error,
To Reproduce
def test_compile_v1():
model = AutoModel.from_pretrained('bert-base-case', use_cache=False)
# Enabled precision for TensorRT optimization
enabled_precisions = {torch.half}
# Whether to print verbose logs
debug = False
# Workspace size for TensorRT
workspace_size = 20 << 30
# Maximum number of TRT Engines
# (Lower value allows more graph segmentation)
min_block_size = 7
# Operations to Run in Torch, regardless of converter support
torch_executed_ops = {}
input_ids = torch.randint(2, 100, (1, 16), device=DEVICE)
torch._dynamo.mark_dynamic(input_ids, 1, min=2, max=512)
trt_model = torch_tensorrt.compile(
model,
ir='torch_compile',
inputs=input_ids,
enabled_precisions=enabled_precisions,
debug=debug,
workspace_size=workspace_size,
min_block_size=min_block_size,
torch_executed_ops=torch_executed_ops,
)
out1 = trt_model(input_ids)
print(out1)
Environment
- Torch-TensorRT: 2.4.0
- PyTorch: 2.4.0
- transformers: 4.44.2
- CPU Architecture: x86_64 GNU
- OS: Linux
- How you installed PyTorch: pip
- Python: 3.11
- CUDA: 12.4
- GPU models and configuration: A100-SXM4-80
errors:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.