Skip to content

Conversation

@EricPedley
Copy link
Contributor

@EricPedley EricPedley commented Feb 11, 2023

This line prevents users from providing a custom batch size to the exporter with kwargs in model.export. When it's removed, providing a batch size works as expected. I verified this by exporting one of my v8n models to onnx and providing a custom batch size, then opening the model on netron.app.
image

image

It looks like this is an artifact from a work-around introduced in #129. In #132 the conditional was commented out but the body was left in. (I figured this out with GitLens. It's really cool and worth checking out)

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

This Pull Request has no code changes.

📊 Key Changes

  • There are no code modifications, additions, or deletions to report.

🎯 Purpose & Impact

  • As there are no changes, there is no direct impact or benefit to the end-users from this PR. It might be a simple case of housekeeping or an incorrectly generated PR.
  • Users should wait for future updates for any actual feature additions or bug fixes. 👀

This line prevents users from providing a custom batch size to the exporter with kwargs in `model.export`. When it's removed, providing a batch size works as expected. I verified this by exporting one of my v8n models to onnx and providing a custom batch size, then opening the model on netron.app.
```
from ultralytics import YOLO

model = YOLO("trained_models/v8n.pt")

model.export(format="onnx", batch=8)
```

It looks like this is an artifact from a work-around introduced in ultralytics#129. In ultralytics#132 the conditional was commented out but the body was left in.
@github-actions
Copy link

github-actions bot commented Feb 11, 2023

CLA Assistant Lite bot All Contributors have signed the CLA. ✅

@EricPedley
Copy link
Contributor Author

I have read the CLA Document and I sign the CLA

@glenn-jocher
Copy link
Member

@EricPedley thanks for the PR! Unfortunately this placeholder helps exports default to batch=1, otherwise they will use the default.yaml batch=16, which is probably not the dominant use case here.

We need to figure out a better way to set batch size per task and make this more flexible so that i.e. exports default to batch=1, train defaults to batch=16 etc., while still allowing overrides when batch argument is passed.

@glenn-jocher glenn-jocher changed the base branch from main to readme-1 February 11, 2023 15:32
@glenn-jocher glenn-jocher merged commit 6ad14b9 into ultralytics:readme-1 Feb 11, 2023
@glenn-jocher
Copy link
Member

glenn-jocher commented Feb 11, 2023

@EricPedley resolved in conjunction with 8.0.35 PR to allow setting default 1 but also allow manually defined batch sizes. Only problem is if they match default.yaml batch=16 then it will get reset to 1. All others are allowed, i.e. export batch=8

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