Skip to content

New feature optimize_for_inference is not in pip package #237

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

Open
sergiovillanueva opened this issue May 31, 2025 · 2 comments
Open

New feature optimize_for_inference is not in pip package #237

sergiovillanueva opened this issue May 31, 2025 · 2 comments

Comments

@sergiovillanueva
Copy link

I can see in the readme that there are a new feature model.optimize_for_inference(), but when I install from pip I can't see this feature, even if I install from github.

@sergiovillanueva sergiovillanueva changed the title New features are not in pip package New feature optimize_for_inference is not in pip package May 31, 2025
@nok
Copy link

nok commented May 31, 2025

Hello @sergiovillanueva , you're right, this feature hasn't been released yet. As a workaround, you can install the develop branch directly using:

pip install git+ssh://[email protected]/roboflow/rf-detr.git@develop

In addition there is a small bug in the example code. The method optimize_for_inference() doesn't return anything.

Current:

model = RFDETRBase()
model = model.optimize_for_inference()
# ...
detections = model.predict(image, threshold=0.5)

Fixed:

model = RFDETRBase()
model.optimize_for_inference()  # just call the method
# ...
detections = model.predict(image, threshold=0.5)

I created a small PR for that: #238


Finally I'm able to share my experience with this optimization: across all experiments, I measured a speedup ranging from 1.16x to 1.22x.

@isaacrob-roboflow
Copy link
Collaborator

hi @nok ! thanks for the catch, my mistake on the README 😅

what hardware are you using? are you happy with that speedup?

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

No branches or pull requests

3 participants