-
-
Notifications
You must be signed in to change notification settings - Fork 16.6k
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
Fix Flask REST API #7210
Fix Flask REST API #7210
Conversation
@Zengyf-CVer thanks for the PR! I looked into this and seems like PyTorch > 1.10 should have this bug fixed:
|
@glenn-jocher My configuration is torch1.10, but this bug appears. |
@Zengyf-CVer sorry to hear that! That's very strange. Could you test 1.11 please? If there error is still present then I'll go ahead and merge with an explanation for that line, because that's the strangest lambda function I've ever seen. |
@glenn-jocher # torch 1.10
model = torch.hub.load("ultralytics/yolov5", "yolov5s", force_reload=False) # force_reload to recache
# torch 1.11
# No need to do any operation, it can be used normally. |
@Zengyf-CVer ok, thanks for the tests! I think we should leave the code alone then as the issue seems to be fixed in latest PyTorch release. |
@glenn-jocher |
@Zengyf-CVer yes, we could do an if torch<1.11 statement. Could you do this using this example? Lines 79 to 82 in 71621df
|
@glenn-jocher |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
@Zengyf-CVer understood, thanks for the detailed debugging! PR is merged. Thank you for your contributions to YOLOv5 π and Vision AI β |
* Update restapi.py * Update restapi.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Cleanup * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@glenn-jocher
I fixed this bug.
π οΈ PR Summary
Made with β€οΈ by Ultralytics Actions
π Summary
Update and fix in the Flask REST API for YOLOv5 model deployment.
π Key Changes
args
toopt
for argument parsing consistency.torch.hub
.π― Purpose & Impact
torch.hub
rate limit issue ensures that developers won't run into HTTP 403 errors when trying to load models, leading to smoother development and deployment experiences. This could be particularly impactful for users working with YOLOv5 model in cloud environments or with frequent reloads.