Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
Signed-off-by: tc-mb <[email protected]>
c244528 to
aaab6bf
Compare
| EntryClass = [ | ||
| MiniCPMV, | ||
| MiniCPMV4_6ForConditionalGeneration, | ||
| MiniCPMV4_7ForConditionalGeneration, | ||
| MiniCPMOcrForConditionalGeneration, |
There was a problem hiding this comment.
The AWQ checkpoint loads but ignores the image, because its skip list names merger while the 4.6 path quantizes it as resampler. Consider mapping that exclusion onto resampler, or rejecting quantized checkpoints at startup.
| inner = getattr(model, "minicpmv", None) | ||
| if inner is not None: | ||
| inner.shared_experts_config = shared_experts |
There was a problem hiding this comment.
This restores the lost attribute for every MiniCPMV wrapper, OCR included, but probes one model family inside the shared loader. Would it make sense to fix it in the wrapper, as #41391 does?
| if getattr(hf_config, "model_type", None) == "minicpm_ocr": | ||
| align_merge_factor = 2 if downsample_mode == "4x" else 4 | ||
| else: | ||
| align_merge_factor = 4 |
There was a problem hiding this comment.
No test fails if this branch goes, yet without it 13 of 18 sizes we tried diverge from the HF OCR processor's slicing. Could you add a small CPU case checking OCR target sizes?
| @@ -1860,8 +1865,17 @@ class MiniCPMV4_7ForConditionalGeneration(MiniCPMV4_6ForConditionalGeneration): | |||
| pass | |||
|
|
|||
|
|
|||
| class MiniCPMOCR1_0ForConditionalGeneration(MiniCPMV4_6ForConditionalGeneration): | |||
There was a problem hiding this comment.
Nothing uses this intermediate class except the one below, and the OCR config's drop_vision_last_layer assignment repeats the 4.6 default. Consider folding the class into MiniCPMOcrForConditionalGeneration and dropping that line.
| @@ -333,6 +342,11 @@ def __init__(self, hf_config, server_args, _processor, *args, **kwargs): | |||
| getattr(vision_cfg, "patch_size", 14) if vision_cfg is not None else 14 | |||
| ) | |||
| downsample_mode = getattr(hf_config, "downsample_mode", "16x") | |||
| # OCR find_best_resize: one 2x2 merge in 4x, two in 16x. | |||
There was a problem hiding this comment.
This comment repeats the one beside the new align_merge_factor parameter. Would it make sense to keep only that one?
… target A DSpark draft may sample in its own cropped output vocabulary (draft_vocab_size < vocab_size) and map the sampled ids onto target ids through the checkpoint's d2t table. - VanillaMarkov biases only the draft's output vocabulary: markov_w1 still embeds previous target tokens, while markov_w2 spans bias_vocab_size. - A cropped draft owns its ParallelLMHead and a draft_token_to_target buffer, and decodes the delta-encoded d2t table into absolute ids. - Draft steps write in the draft vocabulary; the block scatters the kept step logits onto the target vocabulary with -inf elsewhere, which leaves the softmax unchanged. - The folded sampler sizes the draft buffer wherever step_logits was allocated and declines the single-vocabulary megakernel sampler.
9d6e9b8 to
d0b63fc
Compare
Motivation
MiniCPM-OCR 1.0 is the MiniCPM-V 4.6 stack with a different
model_type, sothis only registers it:
MiniCPMOcrForConditionalGenerationsubclasses the 4.6model unchanged, plus its own config and image-geometry alignment.
Modifications
configs/minicpm_ocr_1_0.py:MiniCPMOCR1_0Config/MiniCPMOCR1_0VisionConfigsubclass the 4.6 configs and pinmodel_typetothe checkpoint's values. Registered in
configs/__init__.pyand_CONFIG_REGISTRY.models/minicpmv.py:MiniCPMOcrForConditionalGenerationformodel_type: minicpm_ocr, routed to the 4.6 version.multimodal/processors/minicpmv4_6.py: newalign_merge_factoronMiniCPMV4_6ImageProcessor(default 4, so 4.6 is unaffected). OCR's imageprocessor applies a single 2x2 merge in
"4x", so it uses 2.parser/conversation.py: skip the legacy conv template forminicpm_ocr, sothe checkpoint's own
chat_template.jinjais used.model_loader/loader.py: also setshared_experts_configon the innerminicpmvmodule.MiniCPMVforwards attributes via__getattr__andDefaultModelLoaderreturnsmodel.eval(), which resolves to the innermodule, so the attribute set on the wrapper is lost. Not OCR-specific — 4.6
and 4.7 hit the same
AttributeErrorat warmup.Accuracy Tests
Run with
chat_template_kwargs={"enable_thinking": false}, otherwise thetemplate emits
<think>.English smoke document, matches the reference:
Chinese crop:
Speed Tests and Profiling
Not benchmarked.
Checklist
if there is a pattern to follow.
CI States
Latest PR Test (Base): ⊘ Skipped -- add the
run-cilabel to run CI tests.Latest PR Test (Extra): ⊘ Skipped -- add the
run-cilabel to run CI tests.Latest PR Test (AMD ROCm 10): ➖ No AMD PR run found for this commit.
Tip
Base CI only covers the core cases, and its workload may not exercise your change. Use
/rerun-testto run the tests your change touches, or copy this prompt for an agent: