Skip to content

Refactor models conversions - #135

Merged
Sarah5567 merged 5 commits into
mainfrom
refactor-models-conversions
Nov 11, 2025
Merged

Sarah5567 merged 5 commits into
mainfrom
refactor-models-conversions

Conversation

@Sarah5567

Copy link
Copy Markdown
Collaborator

This PR refactors and renames all model conversion scripts under src/model_conversion/ to ensure consistent naming and structure:

  • export_to_onnx.pypytorch_to_onnx.py
  • onnx_validation.pyvalidate_onnx_vs_pytorch.py
  • validate_deepstream_vs_onnx.pyvalidate_trt_vs_onnx.py
  • engine_helper.pyonnx_to_trt.py

The refactoring maintains identical functionality to the pre-refactored versions.
All imports, file paths, and documentation have been updated accordingly.
Validation confirms that both old and new versions produce identical outputs (console logs, generated files, and results).

closes #131

Comment thread docs/deepstream_validation.md Outdated
- **Configs used:** `configs/resnet18.txt`, `configs/mobilenet.txt`
- **Engines:** `/workspace/models/deepstream/`
- **Script used:** `src/validate_deepstream_vs_onnx.py`
- **Script used:** `src/model_conversion/validate_onnx_vs_pytorch.py`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think it's a mistake - the script for that should be validate_trt_vs_onnx.py

do_constant_folding=True,
)

subprocess.run(["python3", "src/model_conversion/validate_onnx_vs_pytorch.py", model_name], check=True)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since both scripts are written in Python, best practice in this case is to import those functions instead of using subprocesses.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

In general that's right, specificly here I preferd do it like this to avoid creating the models objects, because their creation is gonna change (in #134 and #130)

@Sarah5567
Sarah5567 merged commit 08b3a56 into main Nov 11, 2025
1 check failed
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.

Refactor pytorch->ONNX conversion scripts

2 participants