Skip to content

Validate task type before model upload#457

Draft
leeclemnet wants to merge 1 commit intomainfrom
fix/task-type-validation
Draft

Validate task type before model upload#457
leeclemnet wants to merge 1 commit intomainfrom
fix/task-type-validation

Conversation

@leeclemnet
Copy link
Copy Markdown

@leeclemnet leeclemnet commented Apr 17, 2026

Summary

Uploading a seg .pt with model_type="yolov11" used to succeed silently then crash at inference. Same for rfdetr detect/seg mismatches. Adds two client-side checks:

  1. .ptmodel_type reconciliation in model_processor.process():
    • YOLO: detects task from Ultralytics class name. Auto-appends the missing suffix when user omitted it; raises on conflict.
    • RF-DETR: detects task from checkpoint["model_name"] (same field rf-detr's loader uses). Raises on conflict.
  2. model_type ↔ project type cross-check in Version.deploy().

Also adds canonical TASK_* constants to config.py.

Test plan

  • python -m unittest — all pass
  • ruff check roboflow — clean
  • YOLOv11l-seg .pt + model_type="yolov11" on seg project → deploys as yolov11-seg, inference returns masks
  • Same .pt + model_type="yolov11-pose"ValueError
  • model_type="yolov11-seg" on detection project → ValueError
  • Regression: detection .pt + model_type="yolov11" on detection project → clean deploy
  • rf-detr seg .pt + model_type="rfdetr-medium"ValueError
  • model_type="rfdetr-seg-medium" on detection project → ValueError

🤖 Generated with Claude Code

@leeclemnet leeclemnet marked this pull request as draft April 17, 2026 16:11
@leeclemnet leeclemnet force-pushed the fix/task-type-validation branch 7 times, most recently from 4239a88 to 9afcf14 Compare April 20, 2026 20:24
@leeclemnet leeclemnet force-pushed the fix/task-type-validation branch from 9afcf14 to e70961f Compare April 20, 2026 20:42
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

Successfully merging this pull request may close these issues.

1 participant