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

ONNX export in .train() mode fix #3362

Merged
merged 1 commit into from
May 27, 2021
Merged

Conversation

ChaofWang
Copy link
Contributor

@ChaofWang ChaofWang commented May 27, 2021

This PR is submitted for this bug #3346

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Enhanced ONNX export options for different training modes.

πŸ“Š Key Changes

  • πŸ”„ Added an option to specify training or evaluation mode during ONNX export.
  • 🧱 Enabled or disabled constant folding depending on the selected mode (training or evaluation).

🎯 Purpose & Impact

  • πŸŽ› This improvement allows developers to export their models in the proper mode, matching their intended use case (either for further training or for inference).
  • πŸš€ Users can now optimize their models' ONNX export for training with gradient updates or for faster inference without gradients.
  • πŸ›  The option to toggle constant folding can help in optimizing the model accordingly, potentially improving performance in inference scenarios.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

πŸ‘‹ Hello @ChaofWang, thank you for submitting a πŸš€ PR! To allow your work to be integrated as seamlessly as possible, we advise you to:

  • βœ… Verify your PR is up-to-date with origin/master. If your PR is behind origin/master an automatic GitHub actions rebase may be attempted by including the /rebase command in a comment body, or by running the following code, replacing 'feature' with the name of your local branch:
git remote add upstream https://github.com/ultralytics/yolov5.git
git fetch upstream
git checkout feature  # <----- replace 'feature' with local branch name
git rebase upstream/master
git push -u origin -f
  • βœ… Verify all Continuous Integration (CI) checks are passing.
  • βœ… Reduce changes to the absolute minimum required for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." -Bruce Lee

@glenn-jocher glenn-jocher changed the base branch from develop to master May 27, 2021 12:04
@glenn-jocher glenn-jocher changed the title ONNX export in .train() mode fix ONNX export in .train() mode fix May 27, 2021
@glenn-jocher glenn-jocher merged commit ef4d538 into ultralytics:master May 27, 2021
@glenn-jocher
Copy link
Member

@ChaofWang PR is merged, thank you for your contributions!

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.

models/export.py setting model.train() may be changed to false in onnx
2 participants