-
Notifications
You must be signed in to change notification settings - Fork 364
🐛 [Bug] isBool() INTERNAL ASSERT FAILED while compiling Sequence Generator #1697
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
Comments
Can you share the logs from the failure? |
Here are the full_logs. |
Looking at the logs, it seems like this error pops up during graph splitting. @peri044 Can you take a look or delegate this to someone? |
Looks like we some converter args failure. @bowang007 Can you take a look at this ? |
sure. Let me check what's going on |
Hey @Csinclair0 This bug was fixed by this PR: #1691 |
Thanks for looking into it! I am unfortunately still seeing the same error. |
Hey @Csinclair0 , even though the shown error is the same, but if you take a look at the new log you'll find there is less segmented blocks and now these blocks are valid. Moreover, based on the log you provided:
|
can you try fx btw? @Csinclair0 |
I am running into other issues using fx with unsupported operators, will look more modifying the code to potentially support it. Regarding your install issue, the solution here seems to be to update pip. |
@Csinclair0 I'm now trying to reproduce your error in our latest container but I have this error:
I spent some time for this but didn't find anything useful. I think this is because of torch, we are now having torch 2.0 for our latest torch-tensorrt container. Have you run into this issue? |
Yes, that is indeed due to the torch 2.0 upgrade. A solution I've found that works is to remove the @torch.no_grad decorator from the forward method in TritonGenerator. |
Hi @Csinclair0 - as an update on this issue, there were some recent fixes for conditional logic in TorchScript, including #1933 and #1859, which may help with this bug. I have created a branch |
I was able to script + begin compilation on this model and with #1933, the initial error seems to be resolved, and I am now seeing the following (using torch.jit.Error: The following operation failed in the TorchScript interpreter.
Traceback of TorchScript (most recent call last):
File "~/convert.py", line 69, in forward
net_input = {"net_input": {"src_tokens": input_data, "src_lengths": src_lengths}}
out = self.generator._generate(net_input)
~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
idx: int = 0
File "/root/fairseq/fairseq/sequence_generator.py", line 274, in _generate
# compute the encoder output for each beam
with torch.autograd.profiler.record_function("EnsembleModel: forward_encoder"):
encoder_outs = self.model.forward_encoder(net_input)
~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
# placeholder of indices for bsz * beam_size to hold tokens and accumulative scores
File "/root/fairseq/fairseq/sequence_generator.py", line 801, in forward_encoder
if not self.has_encoder():
return None
return [model.encoder.forward_torchscript(net_input) for model in self.models]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
File "/root/fairseq/fairseq/models/fairseq_encoder.py", line 50, in forward_torchscript
"""
if torch.jit.is_scripting():
return self.forward(
~~~~~~~~~~~~ <--- HERE
src_tokens=net_input["src_tokens"],
src_lengths=net_input["src_lengths"],
File "/root/fairseq/fairseq/models/transformer/transformer_encoder.py", line 165, in forward
Only populated if *return_all_hiddens* is True.
"""
return self.forward_scriptable(
~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
src_tokens, src_lengths, return_all_hiddens, token_embeddings
)
File "/root/fairseq/fairseq/models/transformer/transformer_encoder.py", line 294, in forward_scriptable
encoder_padding_mask_out = processing_mask if has_pads else None
for layer in self.layers:
lr = layer(x, encoder_padding_mask=encoder_padding_mask_out)
~~~~~ <--- HERE
if isinstance(lr, tuple) and len(lr) == 2:
File "/root/fairseq/fairseq/modules/transformer_layer.py", line 350, in forward
residual = x
if self.normalize_before:
x = self.self_attn_layer_norm(x)
~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
x, _ = self.self_attn(
query=x,
RuntimeError: This Python function is annotated to be ignored and cannot be run |
Thanks for looking into it! I think you are correct in that recent fixes have helped with this bug. I am actually using a fork of fairseq that doesn't have this issue. The dockerfile in the shared drive has info on it. With the most recent updates, I am getting past the bulk of operations but running into a separate issue while finalizing the generated outputs. I believe it has to do with the inputs defaulting to be all zeros, and I'm assuming that is not configurable. I'll look for a workaround and provide any updates. |
I investigated this issue further in the Torch-TensorRT Dynamo path and have a few updates to share: Initial Investigation of Tracing
|
This issue has not seen activity for 90 days, Remove stale label or comment or this will be closed in 10 days |
Bug Description
I am receving this error when compling a torchscript module. The module is a light wrapper around a SequenceGenerator from fairseq.
To Reproduce
I am currently executing sequence generation in torch, using the compile spec.
Expected behavior
no compile errors
Environment
building docker image from Dockerfile in repo.
The text was updated successfully, but these errors were encountered: