-
Notifications
You must be signed in to change notification settings - Fork 51
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
Enhance Error Handling for TENSOR_META in Output Shape Calculation for YOLOv8 Quantization #1186
Conversation
Co-authored-by: Laughing-q <1185102784@qq.com>
Hi @ambitious-octopus , thanks for your PR, can you explain the specific case that reproduce this issue? |
Hey @Idan-BenAmi, you can reproduce the error with this script. This script closely resembles the notebook tutorial located at pip install git+https://github.com/ultralytics/ultralytics.git@quan Running the script without this fix results in an error when invoking the Anonymized output
|
Hi @ambitious-octopus, I'm trying to reproduce the issue using the branch you sent to me (quan), both via pip (as you mentioned) and also by cloning the ultralytics repository and switching quan branch. Can you advise? am I using the correct branch/version?
|
Pull Request Description:
The PR addresses the case where a PyTorch graph contains additional input nodes, like
args
andkwargs
, that have no outputs. Instead of causing an error, these nodes will be removed in the subsequent method:remove_broken_nodes_from_graph
.This PR includes a small update to the code that handles the extraction of
output_shape
based on the type of the_node.meta[TYPE]
.The old code assumes that
_node.meta[TENSOR_META]
is always present when_node.meta[TYPE]
is a list or tuple. This assumption could lead to aKeyError
ifTENSOR_META
is missing from_node.meta.
The new code uses
_node.meta.get(TENSOR_META, [])
instead, which returns an empty list ifTENSOR_META
is not found, thereby preventing potential errors and ensuring the code handles such cases more gracefully.This change is necessary to handle scenarios specific to YOLOv8 quantization, where
TENSOR_META
may not always be present in_node.meta
.Checklist before requesting a review: