Skip to content

recipe(owlvit): add base patch16 fp16 recipe#1155

Draft
kujin66 wants to merge 1 commit into
mainfrom
kujin66/add-owlvit-base-patch16-recipe
Draft

recipe(owlvit): add base patch16 fp16 recipe#1155
kujin66 wants to merge 1 commit into
mainfrom
kujin66/add-owlvit-base-patch16-recipe

Conversation

@kujin66

@kujin66 kujin66 commented Jul 21, 2026

Copy link
Copy Markdown

Adds a CPU-validated FP16 recipe for google/owlvit-base-patch16 zero-shot object detection. The model already exports on current origin/main, but the auto-config/baseline artifact assigns ONNX input names to the wrong shapes; this recipe fixes the input order to match OwlViTForObjectDetection.forward(input_ids, pixel_values, attention_mask) and adds a verified FP16 artifact path.

  1. Recipe path(s)

    • examples/recipes/google_owlvit-base-patch16/zero-shot-object-detection_fp16_config.json
  2. README row

    • Not added. examples/recipes/README.md currently says the table lists model/task tuples that pass fp16 eval on all 10 EP/device buckets; this PR has CPU build/perf evidence only, so adding a row would over-claim catalog coverage.
  3. Build output dir

    • Baseline: temp/baseline_google_owlvit_base_patch16
    • Recipe: temp/verify_google_owlvit_base_patch16_fp16_fixed
    • Perf: temp/owlvit_fp16_perf_cpu.json
  4. Build log

    • Baseline command: uv run winml build -m google/owlvit-base-patch16 -o temp/baseline_google_owlvit_base_patch16 --ep cpu --device cpu --no-analyze --no-optimize --no-quant --no-compile --rebuild
    • Baseline result: Build complete in 126.9s; final artifact temp/baseline_google_owlvit_base_patch16/model.onnx; baseline HEAD 38767add6f91c7b10b6394fae3af6f437e02effd; winml-cli package version 0.2.0.
    • Baseline structural issue: pixel_values [1,16], input_ids [1,3,768,768], attention_mask [1,16].
    • Recipe command: uv run winml build -c examples/recipes/google_owlvit-base-patch16/zero-shot-object-detection_fp16_config.json -m google/owlvit-base-patch16 -o temp/verify_google_owlvit_base_patch16_fp16_fixed --ep cpu --device cpu --precision fp16 --no-analyze --no-compile --rebuild
    • Recipe result: Build complete in 90.4s; final artifact temp/verify_google_owlvit_base_patch16_fp16_fixed/model.onnx; FP16 stage 14.5s; quantized artifact 291.1 MB.
  5. Appended findings

    • Skill knowledge appended outside this model PR: model_knowledge/owlvit.json, finding owlvit-001.
    • Key finding: OwlViT recipes must order input_tensors as input_ids, pixel_values, attention_mask; the inspect/autoconfig order can build but produces semantic ONNX input-name/shape swaps.
    • No skill_meta finding added; existing reviewer guidance already covers semantically wrong recipe I/O and FP16 initializer validation.
  6. Optimum-coverage probe

    • model_type: owlvit
    • architectures: ['OwlViTForObjectDetection']
    • vendor: ['feature-extraction', 'zero-shot-object-detection']
    • after_winml: ['feature-extraction', 'zero-shot-object-detection']
    • added_by_winml: []
    • Verdict: VENDOR-ONLY
    • winml inspect resolves task zero-shot-object-detection, loader AutoModelForZeroShotObjectDetection, exporter OwlViTOnnxConfig, WinML class WinMLModelForGenericTask.
  7. Claimed (Effort, Goal, Outcome)

    • Effort: L0 recipe-only, with an existing OWLv2 zero-shot-object-detection template.
    • Goal ceiling: L1 CPU.
    • Outcome: L0 model PR plus skill-side model_knowledge finding.
    • Target EPs: ['cpu'].
  8. Goal-ladder verdict table

    • L0 PASS: recipe JSON parses; build completed in 90.4s; ONNX structural validation: inputs input_ids [1,16], pixel_values [1,3,768,768], attention_mask [1,16]; outputs logits [1,2304,1], pred_boxes [1,2304,4], text_embeds [1,1,512], image_embeds [1,48,48,768]; FP16 validation found 419 FLOAT16 initializers and 0 FLOAT initializers; model.onnx.data is 304,811,008 bytes vs baseline 609,623,040 bytes.
    • L1 PASS: uv run winml perf -m temp/verify_google_owlvit_base_patch16_fp16_fixed/model.onnx --device cpu --ep cpu --format json -o temp/owlvit_fp16_perf_cpu.json --overwrite wrote JSON with CPUExecutionProvider, 100 iterations, mean 2566.361 ms, p50 2550.853 ms, throughput 0.39 samples/s, RSS total delta 1978.02 MB. Available providers snapshot: ['DmlExecutionProvider', 'CPUExecutionProvider'].
  9. Methodology-evolution declaration

    • No methodology friction requiring a new _meta rule was observed. The run did surface a model-family gotcha, captured in model_knowledge/owlvit.json (owlvit-001), and the existing reviewer checklist already requires semantic recipe sanity plus emitted FP16 validation.

@kujin66

kujin66 commented Jul 21, 2026

Copy link
Copy Markdown
Author

APPROVE

Reviewer checks performed from PR branch kujin66/add-owlvit-base-patch16-recipe at e0726398:

  • PR exists and is draft: recipe(owlvit): add base patch16 fp16 recipe #1155, base main, head kujin66/add-owlvit-base-patch16-recipe.
  • Diff scope matches L0 recipe-only claim: git diff --name-only origin/main...HEAD shows only examples/recipes/google_owlvit-base-patch16/zero-shot-object-detection_fp16_config.json.
  • PR body contains the required 9 hand-off items: recipe path, README row decision, build dirs/logs, findings, Optimum probe, claimed tiers, Goal ladder, methodology declaration.
  • Baseline gate cited current origin/main 38767add6f91c7b10b6394fae3af6f437e02effd; worktree HEAD before commit matched that commit.
  • Recipe schema parses with uv run python -m json.tool examples/recipes/google_owlvit-base-patch16/zero-shot-object-detection_fp16_config.json.
  • Structural validation of rebuilt artifact temp/verify_google_owlvit_base_patch16_fp16_fixed/model.onnx: inputs are input_ids [1,16], pixel_values [1,3,768,768], attention_mask [1,16]; outputs are logits [1,2304,1], pred_boxes [1,2304,4], text_embeds [1,1,512], image_embeds [1,48,48,768].
  • FP16 validation: 419 FLOAT16 initializers, 0 FLOAT initializers.
  • Goal L1 evidence: temp/owlvit_fp16_perf_cpu.json contains CPUExecutionProvider perf, mean 2566.361 ms, p50 2550.853 ms, throughput 0.39 samples/s, RSS total delta 1978.02 MB.
  • Knowledge capture exists outside this model PR: model_knowledge/owlvit.json / owlvit-001, JSON-validated locally.

Coverage annotation: full for charter target EP cpu; non-target EPs are not claimed.

@kujin66
kujin66 marked this pull request as ready for review July 21, 2026 03:50
@kujin66
kujin66 requested a review from a team as a code owner July 21, 2026 03:50
@ssss141414 ssss141414 added the model-scale-by-skill Model support PR created or maintained by the adding-model-support skill label Jul 21, 2026
@ssss141414
ssss141414 marked this pull request as draft July 22, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

model-scale-by-skill Model support PR created or maintained by the adding-model-support skill

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants