Skip to content

Allow .onnx models in the detection folder (fixes #14050, #14635)#14781

Open
Andrew-Pulley wants to merge 1 commit into
Comfy-Org:masterfrom
Andrew-Pulley:fix/detection-onnx-extensions
Open

Allow .onnx models in the detection folder (fixes #14050, #14635)#14781
Andrew-Pulley wants to merge 1 commit into
Comfy-Org:masterfrom
Andrew-Pulley:fix/detection-onnx-extensions

Conversation

@Andrew-Pulley

@Andrew-Pulley Andrew-Pulley commented Jul 5, 2026

Copy link
Copy Markdown

Issue

Fixes #14050
Fixes #14635

After #14025 added the detection model folder for MediaPipe nodes, it was registered with supported_pt_extensions only. That excludes .onnx files, so get_filename_list("detection") and prompt validation reject models such as vitpose-l-wholebody.onnx and yolov10m.onnx.

Symptoms:

  • Desktop: OnnxDetectionModelLoader dropdown empty / runtime get_full_path_or_raise failure
  • Comfy Cloud: UI dropdown shows ONNX models, but queue fails at prompt validation with value_not_in_list before execution

Fix

Register .onnx as an allowed extension for the detection folder:

folder_names_and_paths["detection"] = (
    [os.path.join(models_dir, "detection")],
    supported_pt_extensions | {".onnx"},
)

Testing

pytest tests-unit/folder_paths_test/detection_onnx_extensions_test.py -v

Both tests pass locally.

Side effects

  • Additive only: MediaPipe and other detection consumers simply gain .onnx entries in their model lists.
  • Coexists with kijai/ComfyUI-WanAnimatePreprocess import-time extension patch (idempotent).

Notes

  • MediaPipe models use .task files; this PR scopes to .onnx as reported in the linked issues. Cloud users will need a core release deploy after merge.
  • I designed and tested this fix as an actual human in the loop even with AI assistance on the unit test, and automated PR. ☺️

PR Comfy-Org#14025 registered models/detection/ with supported_pt_extensions only,
which excludes .onnx files used by WanAnimate ONNX loaders and other
detection nodes. That caused prompt validation to reject values like
vitpose-l-wholebody.onnx with value_not_in_list even when the UI showed
them as selectable.

Fixes Comfy-Org#14050
Fixes Comfy-Org#14635

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This change updates the "detection" model folder configuration in folder_paths.py to accept .onnx files in addition to previously supported extensions. A new unit test file was added to verify that .onnx is included in the detected extensions, that .onnx files placed in a registered detection directory are correctly listed via get_filename_list, and that get_full_path resolves to the correct absolute file path.

Changes

File Summary
folder_paths.py Added .onnx to the allowed extensions for the "detection" model folder configuration.
tests-unit/folder_paths_test/detection_onnx_extensions_test.py New test file validating .onnx extension support, filename listing, and path resolution for the detection folder.

Related PRs: None identified.

Suggested labels: tests, enhancement

Suggested reviewers: None identified.

🐰 A rabbit sniffs a model shaped odd,
Not .pt, not .safetensors — but .onnx, by nod!
Now detection folders open their door,
Tests confirm paths as they did before,
Hop, hop, extension explored! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR adds .onnx to the detection folder extensions, which addresses both missing discovery and validation failures in #14050 and #14635.
Out of Scope Changes check ✅ Passed The only code changes are the extension update and a focused test file, both directly aligned with the stated goal.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly matches the main change: adding .onnx support to the detection folder.
Description check ✅ Passed The description directly explains the .onnx extension fix, symptoms, and tests, and matches the code changes.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Andrew-Pulley

Copy link
Copy Markdown
Author

Realize PR #14689 adds .onnx to the list directly. It's a good PR with appropriate unit test updates. My approach only adds .onnx only when needed, which may introduce more complexity than desired by the team. Won't be offended if you choose to go the other way. Feel free to close with the simpler fix if that's the preferred route!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant