Skip to content

Conversation

@borisfom
Copy link
Contributor

@borisfom borisfom commented Oct 16, 2024

Description

Added trt_compile() support for Lists and Tuples in arguments for forward() - needed for MAISI.
Did not add support for grouping return results yet - MAISI worked with explicit workaround unrolling the return results.

Notes

To successfully export MAISI, either latest Torch nightly is needed, or this patch needs to be applied to 24.09-based container:

--- /usr/local/lib/python3.10/dist-packages/torch/onnx/symbolic_opset14.bak     2024-10-09 01:38:04.920316673 +0000                                                   
+++ /usr/local/lib/python3.10/dist-packages/torch/onnx/symbolic_opset14.py      2024-10-09 01:38:25.228053951 +0000                                                   
@@ -148,7 +148,6 @@                                                                                                                                                   
         is_causal and symbolic_helper._is_none(attn_mask)                                                                                                            
     ), "is_causal and attn_mask cannot be set at the same time"                                                                                                      
                                                                                                                                                                      
-    scale = symbolic_helper._maybe_get_const(scale, "f")                                                                                                             
     if symbolic_helper._is_none(scale):                                                                                                                              
         scale = _attention_scale(g, query)                                                                                                                           

Types of changes

  • Non-breaking change (fix or new feature that would not break existing functionality).

borisfom and others added 30 commits August 4, 2024 23:17
Signed-off-by: Boris Fomitchev <[email protected]>
Signed-off-by: Boris Fomitchev <[email protected]>
Signed-off-by: Boris Fomitchev <[email protected]>
Signed-off-by: Boris Fomitchev <[email protected]>
Signed-off-by: Boris Fomitchev <[email protected]>
Signed-off-by: Boris Fomitchev <[email protected]>
Signed-off-by: Boris Fomitchev <[email protected]>
Signed-off-by: Boris Fomitchev <[email protected]>
Signed-off-by: Boris Fomitchev <[email protected]>
Signed-off-by: Boris Fomitchev <[email protected]>
Signed-off-by: Boris Fomitchev <[email protected]>
Signed-off-by: Boris Fomitchev <[email protected]>
Signed-off-by: Boris Fomitchev <[email protected]>
@KumoLiu
Copy link
Contributor

KumoLiu commented Nov 13, 2024

/build

@KumoLiu
Copy link
Contributor

KumoLiu commented Nov 14, 2024

/build

@KumoLiu KumoLiu merged commit 746a97a into Project-MONAI:dev Nov 14, 2024
28 checks passed
yiheng-wang-nv added a commit to Project-MONAI/model-zoo that referenced this pull request Dec 12, 2024
### Description
TRT optimization support for MAISI. 
Depends on Project-MONAI/MONAI#8153

To successfully export MAISI, either 24.11 PyTorch container (or latest
public Torch nightly) is needed, or this patch needs to be applied to
24.10-based container:

```
--- /usr/local/lib/python3.10/dist-packages/torch/onnx/symbolic_opset14.bak     2024-10-09 01:38:04.920316673 +0000                                                   
+++ /usr/local/lib/python3.10/dist-packages/torch/onnx/symbolic_opset14.py      2024-10-09 01:38:25.228053951 +0000                                                   
@@ -148,7 +148,6 @@                                                                                                                                                   
         is_causal and symbolic_helper._is_none(attn_mask)                                                                                                            
     ), "is_causal and attn_mask cannot be set at the same time"                                                                                                      
                                                                                                                                                                      
-    scale = symbolic_helper._maybe_get_const(scale, "f")                                                                                                             
     if symbolic_helper._is_none(scale):                                                                                                                              
         scale = _attention_scale(g, query)

---------

Signed-off-by: Boris Fomitchev <[email protected]>
Signed-off-by: Yiheng Wang <[email protected]>
Co-authored-by: Yiheng Wang <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants