Skip to content
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

Feature/sg 1386 granular control over export in ptq and qat #1879

Merged

Conversation

BloodAxe
Copy link
Contributor

@BloodAxe BloodAxe commented Feb 29, 2024

This PR introduce a better control on the model export to ONNX format while using PTQ and QAT.

It introduce an ExportParams dataclass and export_params argument to ptq() and qat() methods that is meant to contain many properties one may use to explicitly set this or another parameter used during export process.
As an example one may enable of disable attaching postprocessing to detection model. And this would behave exactly the sample way for PTQ and QAT (Currently these methods export model differently #1189)

Motivation to introduce an ExportParams dataclass is to introduce some form of strict schema of what parameters can be passed. This is especially useful in Colab environment since once can easily get code completion and navigate to that dataclass and read comments on each field.

A recipe-based entry-points (Like quantize_from_config) can easily populate this object as it has no mandatory fields.

To PR should be merged after #1860, so that we can incorporate .export() support for segmentation models.

Copy link
Collaborator

@ofrimasad ofrimasad left a comment

Choose a reason for hiding this comment

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

Is this a breaking change?
Some minor comments inside

src/super_gradients/training/sg_trainer/sg_trainer.py Outdated Show resolved Hide resolved
src/super_gradients/training/sg_trainer/sg_trainer.py Outdated Show resolved Hide resolved
src/super_gradients/training/sg_trainer/sg_trainer.py Outdated Show resolved Hide resolved
@BloodAxe BloodAxe marked this pull request as ready for review March 5, 2024 13:58
@BloodAxe BloodAxe requested a review from shaydeci as a code owner March 5, 2024 13:58
Copy link
Collaborator

@ofrimasad ofrimasad left a comment

Choose a reason for hiding this comment

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

looks great.
minor comments/questions

src/super_gradients/module_interfaces/export_params.py Outdated Show resolved Hide resolved
src/super_gradients/module_interfaces/export_params.py Outdated Show resolved Hide resolved
BloodAxe added 2 commits March 6, 2024 12:15
…-over-export-in-ptq-and-qat' into feature/SG-1386-granular-control-over-export-in-ptq-and-qat
Copy link
Collaborator

@ofrimasad ofrimasad left a comment

Choose a reason for hiding this comment

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

LGTM

@BloodAxe BloodAxe merged commit eaa0c21 into master Mar 6, 2024
8 of 9 checks passed
@BloodAxe BloodAxe deleted the feature/SG-1386-granular-control-over-export-in-ptq-and-qat branch March 6, 2024 10:45
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.

2 participants