Skip to content
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

TypeError: 'tensorrt_bindings.tensorrt.ITensor' object is not iterable #3242

Open
liuzhiyong01 opened this issue Oct 15, 2024 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@liuzhiyong01
Copy link

liuzhiyong01 commented Oct 15, 2024

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:
image

@liuzhiyong01 liuzhiyong01 added the bug Something isn't working label Oct 15, 2024
@apbose
Copy link
Collaborator

apbose commented Oct 22, 2024

Is this the complete repro code? When I run the above it shows me
TypeError: forward() missing 1 required positional argument: 'L_self_modules_pooler_modules_dense_parameters_bias_' seems like it is missing some input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants