Skip to content

Batchnorm training mode support in a minimal build #17103

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

Merged
merged 2 commits into from
Aug 11, 2023

Conversation

baijumeswani
Copy link
Contributor

@baijumeswani baijumeswani commented Aug 10, 2023

Now that ONNX Runtime supports a minimal training build, the batchnorm in training mode is needed even in a minimal build.

This PR removes the preprocessor macro BATCHNORM_INCLUDE_TRAINING_SUPPORT and replaces it with ENABLE_TRAINING_OPS

@baijumeswani baijumeswani added the training issues related to ONNX Runtime training; typically submitted using template label Aug 10, 2023
edgchen1
edgchen1 previously approved these changes Aug 10, 2023
@baijumeswani baijumeswani merged commit 54153c7 into main Aug 11, 2023
@baijumeswani baijumeswani deleted the baijumeswani/batchnorm-training-minimal-build branch August 11, 2023 04:44
@baijumeswani
Copy link
Contributor Author

Thanks for the review @edgchen1 :)

@BowenBao
Copy link
Contributor

This is excluding batchnorm training mode support for standard onnxruntime releases, regression found from ort-nightly==1.16.0.dev20230821001. Can we revert that effect? There are some exported models for inference that runs just bn specifically in training mode.

@baijumeswani
Copy link
Contributor Author

baijumeswani commented Aug 23, 2023

@edgchen1 @skottmckay
Is it ok to completely remove the need for the preprocessor guard for training mode batchnorm? This might impact the inference minimal build.

@BowenBao under what conditions would you need the training batchnorm for inferencing?

@baijumeswani
Copy link
Contributor Author

I created #17270

But I am not sure I understand why a training op would be needed in an inference build. @BowenBao could you use onnxruntime_ENABLE_TRAINING_OPS cmake flag in your test if needed or do we need the training bits in the inference build?

@BowenBao
Copy link
Contributor

afaik some models are set to manipulate running mean and running variance in some ways. There is a separate issue pytorch/pytorch#75252 discussing other ways of export but there is no traction.

It would be nice if the previous behavior can be restored for 1.16 release. I hope training minimal build would still have this op after #17270 so the goal of this PR is not affected?

kleiti pushed a commit to kleiti/onnxruntime that referenced this pull request Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
training issues related to ONNX Runtime training; typically submitted using template
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants