-
Notifications
You must be signed in to change notification settings - Fork 350
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
🐛 [Bug] [weight-stripped engine] doesn't work for torch.compile
#3216
Comments
Have you pulled the engines out to see what they look like? |
@narendasan It seems like the main difference between workflows of I pulled the engine out and outputs some attributes.
We can see that |
|
I'm calling three compiles like this: settings = {
"use_python_runtime": True,
"enabled_precisions": {torch.float},
"debug": False,
"min_block_size": 1,
"strip_engine_weights": True,
"refit_identical_engine_weights": False,
}
# 1. Compile with torch_trt.dynamo.compile
gm1 = torch_trt.dynamo.compile(
exp_program,
example_inputs,
**settings,
)
gm1_output = gm1(*example_inputs)
# 2. Compile with torch_trt.compile using dynamo backend
gm2 = torch_trt.compile(
pyt_model, ir="dynamo", inputs=example_inputs, **settings
)
gm2_output = gm2(*example_inputs)
# 3. Compile with torch.compile using tensorrt backend
gm3 = torch.compile(
pyt_model,
backend="tensorrt",
options=settings,
)
gm3_output = gm3(*example_inputs) I also output |
As discussions with @narendasan and @peri044,
This might explain why weight stripping is not working properly for torch.compile. We're going to throw a warning that it's not supported for torch.compile and then return the compiled module "with weights" |
Bug Description
There are three interfaces to compile a model: 1)
torch export + torch_trt.dynamo.compile
2)torch_trt.compile(ir="dynamo")
3)torch.compile(backend="tensorrt")
.The PR #3167 is supporting weight-stripped engines, which works for 1) and 2) but not 3). Not sure the reason.
I observed the issue in the test:
TensorRT/tests/py/dynamo/models/test_weight_stripped_engine.py
Lines 83 to 115 in 76bdf5e
The CI test reports the error:
Only
torch.compile
failed so I output the result ofgm3_output
, which is the same as the output of the weight-included engine. So I suspect the engine was not getting its weights stripped. I also triedtorch_trt.compile(ir="torch_compile")
which is just another way to calltorch.compile
so it failed as well. Not sure the reason.The text was updated successfully, but these errors were encountered: