feat(florence2): add native Florence-2 image-to-text support - #1258
feat(florence2): add native Florence-2 image-to-text support#1258ssss141414 wants to merge 1 commit into
Conversation
|
Independent reviewer verdict: REQUEST_CHANGES Reviewed exact code SHA Code findings are unchanged: the sealed 26-path candidate remains clean and hash-identical, Blocking explainer-owned issue:
No code change is requested. Update the PR description only, then re-enter independent review against the same SHA. |
Independent reviewer verdict: REQUEST_CHANGESReviewed exact head Blocking findingThe published PR body does not satisfy the required shipment hierarchy. Action (explainer-owned): replace the body with the contract structure using only the frozen handoffs. Include:
Independently verified non-blocking state
Keep the PR Draft and retain |
|
Independent final metadata reviewer verdict: REQUEST_CHANGES Reviewed the fresh live PR metadata at exact head Blocking metadata findings:
All other requested gates pass: exact H2 order ( No code change is requested. Repair only the three metadata items above, then re-enter independent review against the same SHA. |
Independent reviewer verdict: REQUEST_CHANGESReviewed the fresh live PR body and exact head Concrete live metadata defects
These omissions were explicitly requested in prior issue comment Independently verified passing gates
|
Independent reviewer verdict: APPROVEFresh-read final review of the live PR body and exact head Exact provenance and contract evidence
Shipment gates
No concrete reviewer-contract blocker remains. Keep the PR Draft and retain |
Summary
This Draft replaces #1098 without closing it and adds native Transformers Florence-2 image-to-text support through a split image encoder and cached text decoder. The shipped engineering effort is L2: class-wide export/runtime support plus generated CPU recipes and tests. Both required CPU tuples pass the committed L3 ceiling; requested fp16 is honestly reported as a mixed composite with an fp32 encoder and fp16 decoder.
Model metadata
What the model does
Florence-2-base is a prompt-conditioned image-and-text encoder-decoder model. A user supplies an image and a task prompt; the model autoregressively generates text tokens that
Florence2Processorcan return as captions or parse into OCR text, boxes, labels, phrase-grounding results, or polygons.microsoft/Florence-2-basemodel card and native Transformers 5.14.1Florence2ForConditionalGeneration/Florence2Processorsources (verified).Primary user stories
<CAPTION>,<DETAILED_CAPTION>, or<MORE_DETAILED_CAPTION>to obtain descriptions at different levels of detail (verified).verified).verified).Supported tasks
image-text-to-textimage-to-textimage-text-to-textModel architecture
verified).Validation and support evidence
Baseline
b7a7b893d757bb8e52b5b5a594a9aa72f0c0fff4.OnnxConfigwas registered formodel_type='florence2'with taskimage-text-to-text.winml eval --schema --task image-to-textexited 0 and exposed image/text columns plus composite encoder/decoder inputs, but main had no default image-to-text dataset, no prompt field, and invoked the evaluator with empty text. Task evaluation therefore remained unreachable from the failed baseline build.UNREGISTERED). The established split encoder/decoder path was therefore a class-wide code fix, not a recipe-only override.Goal
florence2export/runtime support.Outcome
fp32means encoder fp32 plus decoder fp32.fp16is explicitly mixed: encoder fp32 plus decoder fp16. The filename records the requested tuple; each component config serializes its actual precision. This is not a full-fp16 claim.git diff --checkpassed.Per-tuple results
nlphuji/flickr30k@cd91f9a00273ce2e1584511cba8c10b917c488a3, splittest, streaming subset source indices0..7(n=8).All runtime rows use
CPUExecutionProvider / cpu. L1 used one warmup and five measured composite generations withmax_new_tokens=8; RAM is peak RSS delta and VRAM was not measured.<CAPTION>, n=8, zero skips; CIDEr 0.7842, CER 0.8713<CAPTION>, n=8, zero skips; CIDEr 0.7842, CER 0.8713For both L2 tuples, candidate-produced cache was consumed recursively and all four reference/candidate encoder-cache crossings selected cached-step token 102. The exact decoded result was
</s><s>a blue background with a white border</s>. The low L3 values are reported as measured and pass under the frozen charter; they are not characterized as high quality or compared against an invented threshold.Delta
examples/recipes/microsoft_Florence-2-base/cpu/cpu/: fp32 encoder/decoder and requested-fp16 encoder/decoder./precision: "fp32"; requested-fp16 encoder/precision: "fp32"with/quant: null; requested-fp16 decoder/precision: "fp16"with fp16 quantization. The encoder recipes are intentionally identical across requested tuples.florence2split-export registration and class-wide behavior for semantic dummy inputs, component precision propagation, registry-driven composite resolution, decoder KV-cache position/advancement, and prompt-aware image-to-text evaluation. The implementation is keyed by model metadata/class, not a checkpoint ID.skip_optimize, export compatibility policy, internal quantization behavior, and analyze behavior while reconciling overlapping shared paths.Analyze summary
Static
winml analyze --ep allcompleted with seven EP rows per fresh artifact. Its partial/unsupported findings describe static rule coverage, not runtime execution; CPU runtime acceptance is the measured evidence above.Component-level summary
NonZerounsupported; QNN:Transpose,NonZero, andGatherpartialThe final moved-main handoff reports complete artifact-level operator counts but does not re-emit a component-node mapped/unmapped total; none is fabricated here.
Op-level summary
NonZerounsupported; QNN reports partial types aboveCUDA, DirectML, MIGraphX, and TensorRT rule-less rows classify operator types as unknown rather than proving support or failure.
Reproduce commands
These are the portable public commands supplied by the tester for build and static analysis. L1 composite perf, L2 recursive parity, and L3 pinned-dataset metrics were produced by the authoritative tester harness; that handoff did not publish portable standalone harness commands, so none are invented here.