TensorRT icon indicating copy to clipboard operation
TensorRT copied to clipboard

🐛 [Bug] FX intro example broken

Open ncomly-nvidia opened this issue 3 years ago • 5 comments

Bug Description

FX front-end simple example is broken due to API change. Reported by @jaybdub

File /opt/conda/lib/python3.8/site-packages/torch_tensorrt/_compile.py:116, in compile(module, ir, inputs, enabled_precisions, **kwargs) 114 lower_precision = LowerPrecision.FP16 115 elif torch.float32 in enabled_precisions or torch_tensorrt.dtype.float in enabled_precisions: --> 116 lower_precision = LowerPrecision.FP32 117 else: 118 raise ValueError(f"Precision {enabled_precisions} not supported on FX")

NameError: name 'LowerPrecision' is not defined

To Reproduce

Steps to reproduce the behavior:

  1. Run this example

Expected behavior

examples should be stable & in CI

Environment

Build information about Torch-TensorRT can be found by turning on debug messages

  • NGC 22.08

ncomly-nvidia avatar Aug 31 '22 15:08 ncomly-nvidia

@jaybdub, I suspect the installation has some problems. Could you try from torch_tensorrt.fx.utils import LowerPrecision? How about import torch_tensorrt.fx?

frank-wei avatar Aug 31 '22 18:08 frank-wei

Hi @frank-wei ,

Thanks for your reply!

Both of the commands you provided pass, but the example still fails.

I'm using the NGC 22.08 PyTorch container, which ships with torch_tensorrt.

Let me know if anything else needed.

Best, John

jaybdub avatar Aug 31 '22 18:08 jaybdub

Got it.

  1. How about other fx examples?
  2. Are you testing with master branch?

frank-wei avatar Aug 31 '22 18:08 frank-wei

CC: @narendasan @andi4191

Do we have test cases in DLFW for FX?

ncomly-nvidia avatar Sep 12 '22 19:09 ncomly-nvidia

I think the root cause for this failure is here: https://github.com/pytorch/TensorRT/blob/release/ngc/22.08/py/torch_tensorrt/_compile.py#L8-L10

@jaybdub: Please uncomment these lines and re-install. You should be able to run it correctly.

I see that this has been resolved in master branch already.

@ncomly-nvidia : We don't have fx frontend test cases in DLFW CI yet. @apbose : Please add fx examples to the DLFW CI tests.

andi4191 avatar Sep 13 '22 18:09 andi4191

This issue has not seen activity for 90 days, Remove stale label or comment or this will be closed in 10 days

github-actions[bot] avatar Dec 13 '22 00:12 github-actions[bot]

@apbose DLFW tests have been added, correct? Can we confirm this example is tested & works?

ncomly-nvidia avatar Dec 13 '22 16:12 ncomly-nvidia

@ncomly-nvidia FX tests have been added in DLFW and this example works in the latest containers (verified in 22.11).

peri044 avatar Dec 13 '22 23:12 peri044