fix: include str ivalue type conversion by bowang007 · Pull Request #1785 · pytorch/TensorRT (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation19 Commits1 Checks0 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

bowang007

Description

Fixes #1756

Type of change

Please delete options that are not relevant and/or add your own.

Checklist:

[github-actions[bot]](/apps/github-actions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

[github-actions[bot]](/apps/github-actions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

[github-actions[bot]](/apps/github-actions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

[github-actions[bot]](/apps/github-actions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

[github-actions[bot]](/apps/github-actions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

[github-actions[bot]](/apps/github-actions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

[github-actions[bot]](/apps/github-actions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

[github-actions[bot]](/apps/github-actions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

gs-olive

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just made a style recommendation, and I've verified that this resolves the error being displayed in #1756. I do see another error now when running that model, however, also during partitioning:

/usr/local/lib/python3.8/dist-packages/torch/jit/_recursive.py:266: UserWarning: 'batch_first' was found in ScriptModule constants, but was not actually set in init. Consider removing it. warnings.warn("'{}' was found in ScriptModule constants, " Traceback (most recent call last): File "issue_1756.py", line 56, in trt_ts_module = torch_tensorrt.compile( File "/TensorRT/py/torch_tensorrt/_compile.py", line 125, in compile return torch_tensorrt.ts.compile( File "/TensorRT/py/torch_tensorrt/ts/_compiler.py", line 136, in compile compiled_cpp_mod = _C.compile_graph(module._c, _parse_compile_spec(spec)) RuntimeError: Expected Tensor but got Uninitialized

gs-olive

@@ -208,6 +208,8 @@ void getSegmentsOutputByRunning(
jit_inputs_ivalues.push_back(ivalues_maps[input].toGenericDict());
} else if (input->type()->kind() == torch::jit::TypeKind::DeviceObjType) {
jit_inputs_ivalues.push_back(ivalues_maps[input].toDevice());
} else if (input->type() == (torch::jit::StringType::get())) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider switching to input->type()->isSubtypeOf(torch::jit::StringType::get()), for consistency with the above operators (lines 188 - 197)

@bowang007

Looks good to me, just made a style recommendation, and I've verified that this resolves the error being displayed in #1756. I do see another error now when running that model, however, also during partitioning:

/usr/local/lib/python3.8/dist-packages/torch/jit/_recursive.py:266: UserWarning: 'batch_first' was found in ScriptModule constants, but was not actually set in init. Consider removing it. warnings.warn("'{}' was found in ScriptModule constants, " Traceback (most recent call last): File "issue_1756.py", line 56, in trt_ts_module = torch_tensorrt.compile( File "/TensorRT/py/torch_tensorrt/_compile.py", line 125, in compile return torch_tensorrt.ts.compile( File "/TensorRT/py/torch_tensorrt/ts/_compiler.py", line 136, in compile compiled_cpp_mod = _C.compile_graph(module._c, _parse_compile_spec(spec)) RuntimeError: Expected Tensor but got Uninitialized

Yes, I also noticed this one, Iet me cc you for that discussion

[github-actions[bot]](/apps/github-actions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

[github-actions[bot]](/apps/github-actions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

[github-actions[bot]](/apps/github-actions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

[github-actions[bot]](/apps/github-actions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

[github-actions[bot]](/apps/github-actions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines

[github-actions[bot]](/apps/github-actions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

@bowang007

[github-actions[bot]](/apps/github-actions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to C++ style guidelines

[github-actions[bot]](/apps/github-actions)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code conforms to Python style guidelines