Skip to content

feat: PyTorch PT2 Model Generation#8547

Closed
whoisj wants to merge 14 commits into
mainfrom
jwyman/pt2/gen-models
Closed

feat: PyTorch PT2 Model Generation#8547
whoisj wants to merge 14 commits into
mainfrom
jwyman/pt2/gen-models

Conversation

@whoisj

@whoisj whoisj commented Nov 25, 2025

Copy link
Copy Markdown
Contributor

This change adds the generation of PT2 format serialized PyTorch model files to the QA model generation scripts.

Includes significant changes to the gen_qa_model_repository flow to improve debugability.

TRI-172

@whoisj
whoisj requested a review from yinggeh November 25, 2025 21:04
Comment thread qa/common/gen_qa_models.py Outdated
# Use a different model name for the non-batching variant
model_name = tu.get_model_name(
"libtorch_nobatch" if max_batch == 0 else "libtorch",
"libtorch_nobatch" if max_batch == 0 else "libtorch2" if torch2 else "libtorch",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please refactor and make the statement clear

@whoisj whoisj Nov 25, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done. also, apologies for the force push, hadn't realized that anyone had reviewed the changes already. won't happen again. thanks.

Comment thread qa/common/gen_qa_torch_aoti_model.py Outdated
with open(f"{config_path}/config.pbtxt", "w") as f:
f.write(
"""
backend: "pytorch"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Shouldn't it be pytorch2?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

trying to keep them as the same backend.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see. They differs by "platform"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Correct. That's the plan. Ideally we don't have competing "pytorch" and "pytorch_inductor" backends.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

renamed the platform to torch_aoti to better reflect what it is and does.

@whoisj
whoisj force-pushed the jwyman/pt2/gen-models branch from 55ebafa to 558c361 Compare November 25, 2025 23:27
@whoisj
whoisj requested review from pskiran1 and yinggeh December 3, 2025 20:29
@whoisj
whoisj force-pushed the jwyman/pt2/gen-models branch from 558c361 to 78f755f Compare December 4, 2025 18:41
Comment thread qa/common/gen_qa_model_repository Outdated
TEST_RESULT_FILE="./test_results.txt"
CLIENT_PY="./python_based_backends_test.py"
GEN_PYTORCH_MODEL_PY="../../common/gen_qa_pytorch_model.py"
GEN_TORCHAOTI_MODEL_PY="../../common/gen_qa_torch_aoti_model.py"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Where is this variable used?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed

Comment thread qa/common/gen_qa_models.py Outdated
Comment thread qa/common/gen_qa_models.py Outdated
Comment thread qa/common/gen_qa_torch_aoti_model.py Outdated
@@ -0,0 +1,124 @@
# Copyright 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Where is this file being used?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed

@whoisj
whoisj force-pushed the jwyman/pt2/gen-models branch 2 times, most recently from 5dd1300 to 53b28e7 Compare December 17, 2025 16:31
@whoisj
whoisj requested review from mc-nv and yinggeh December 17, 2025 16:31
@whoisj
whoisj force-pushed the jwyman/pt2/gen-models branch 9 times, most recently from dd98938 to a8a2415 Compare December 17, 2025 22:35
Comment thread qa/common/gen_qa_models.py Fixed
@whoisj
whoisj force-pushed the jwyman/pt2/gen-models branch 5 times, most recently from 2610725 to f00cef1 Compare December 17, 2025 23:43
@whoisj
whoisj force-pushed the jwyman/pt2/gen-models branch 2 times, most recently from b94a33c to f302116 Compare December 22, 2025 18:37
@whoisj
whoisj force-pushed the jwyman/pt2/gen-models branch from f302116 to 82df242 Compare January 6, 2026 20:30
This change adds the generation of PT2 format serialized PyTorch model files to the QA model generation scripts.

add backend: pytorch to model config generation

fix pedantic style complaints and very valid copyright mistakes

pedantic style cop fix

fix variable name error after rebase

rename model

add nvcc to pytorch path

remove unnecessary changes

add torch.export.export generation support to libtorch

remove set -x from generated scripts

improving gen_qa_models.py print statements

fix color

add print based on flags

improve color visibility

remove IDE help (caused errors)

pedantic style cop fixes

specify cuda

fix libtorch pt2 generation

add torchvision generation
@whoisj
whoisj force-pushed the jwyman/pt2/gen-models branch from 82df242 to dafcf53 Compare January 6, 2026 21:31
@yinggeh

yinggeh commented Jan 7, 2026

Copy link
Copy Markdown
Contributor

Please mark this PR Draft if not ready.

@whoisj
whoisj marked this pull request as draft January 7, 2026 15:55
@whoisj
whoisj force-pushed the jwyman/pt2/gen-models branch 3 times, most recently from 171eeed to 62909e0 Compare January 13, 2026 18:43
@whoisj
whoisj force-pushed the jwyman/pt2/gen-models branch from 62909e0 to 64f7855 Compare January 13, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants