Fix SyntaxError in YOLOWorldDetector.reparameterize#652
Open
amrutur wants to merge 1 commit intoAILab-CVC:masterfrom
Open
Fix SyntaxError in YOLOWorldDetector.reparameterize#652amrutur wants to merge 1 commit intoAILab-CVC:masterfrom
amrutur wants to merge 1 commit intoAILab-CVC:masterfrom
Conversation
The line
self.text_feats, None = self.backbone.forward_text(texts)
is a SyntaxError — None cannot appear on the LHS of an assignment.
It was introduced in 1f12bca ("add mask") and causes
`import yolo_world` to fail.
Both implementations of `forward_text()` in mm_backbone.py return a
single tensor (not a tuple), and the other two call sites
(lines 163, 168) treat the return value as a single value.
Fix by dropping the unpack entirely.
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
yolo_world/models/detectors/yolo_world.py:61contains a literalSyntaxError:Noneis a Python keyword and cannot appear on the left-hand side of anassignment. Importing the package fails immediately with:
Introduced in commit 1f12bca ("add mask"), 2025-02-27.
Fix
Both
forward_text()implementations inyolo_world/models/backbones/mm_backbone.pyreturn a single tensor, not a tuple:
PseudoLanguageBackbone.forward_textat L172 returnstext_embedsMultiModalYOLOBackbone.forward_textat L234 returnstxt_featsThe other two call sites at L163 and L168 treat the return value as a
single value. The tuple-unpack here was spurious.
Fix by dropping the unpack:
This is a one-line, one-file change.
Test plan
python -c "import yolo_world"succeedsfrom yolo_world.models.detectors import YOLOWorldDetectorsucceedsdemo/image_demo.pycompletes end-to-end with V2.1 L checkpoints (verified locally against bothl_stage1-7d280586.pthat 640 resolution andl_stage2-b3e3dc3f.pthat 1280 resolution, sinceimage_demo.pycallsmodel.reparameterize(texts)at runtime)🤖 Generated with Claude Code