Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions ONBOARDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,16 @@ registry that every test file imports (`CAUSAL_LM_MODELS` for generative,
```

Optional fields:
- `"dtype": "bfloat16"` / `"float32"` — set the test dtype if fp16 is wrong for
the model (bf16-native models, or large multipliers that overflow fp16 on CPU)
- `"load_fn": True` — use if your adapter has a custom `load_hf_model()` function

- `"is_gated": True` — exclude the checkpoint unless `SPYRE_INCLUDE_GATED=1`.
- `"always_test": True` — include the checkpoint in addition to the smallest
representative selected for its adapter. This does not override gating or
test exclusions.
- `"kind": "dspark_draft"` — identify a causal-LM entry as a speculative-decoding
draft model instead of a normal generation model.

For `VISION_MODELS`, `"kind"` is required: use `"tower"` for an encoder-only
vision tower or `"vlm"` for a complete image-to-text model.

## Step 6: Run CPU Accuracy Test

Expand Down
13 changes: 11 additions & 2 deletions hf_adapters/auto_spyre_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
MistralConfig,
ModernBertConfig,
MPNetConfig,
MuseGlimmerConfig,
Olmo2Config,
OlmoConfig,
OPTConfig,
Expand Down Expand Up @@ -128,6 +129,7 @@
hf_mistral3_vision_mm,
hf_modernbert,
hf_mpnet,
hf_muse_glimmer_mm,
hf_olmo,
hf_olmo2,
hf_opt,
Expand Down Expand Up @@ -207,6 +209,7 @@
Gemma4UnifiedConfig: hf_gemma4_mm,
Granite4VisionConfig: hf_granite_vision_mm,
Mistral3Config: hf_mistral3_vision_mm,
MuseGlimmerConfig: hf_muse_glimmer_mm,
}

# Sequence-classification mapping — used by
Expand Down Expand Up @@ -859,19 +862,25 @@ def _generate_image_text_to_text(
"""Run multimodal prefill and text decode through the shared generation loop."""
# Processor outputs consumed by this adapter rather than by generation config.
adapter_input_names = module._GENERATION_INPUT_NAMES
missing = set(adapter_input_names) - set(kwargs)
required_input_names = getattr(
module, "_GENERATION_REQUIRED_INPUT_NAMES", adapter_input_names
)
missing = set(required_input_names) - set(kwargs)
if missing:
raise TypeError(
f"Missing processor inputs for {module.__name__}: {sorted(missing)}"
)
adapter_inputs = {name: kwargs.pop(name) for name in adapter_input_names}
adapter_inputs = {
name: kwargs.pop(name) for name in adapter_input_names if name in kwargs
}

# Inputs keyed by token position need the same compaction/padding as input_ids.
# The mapping value is the padding value for each tensor.
aligned_specs = module._GENERATION_TOKEN_ALIGNED_INPUTS
token_aligned_inputs = {
name: (adapter_inputs[name], pad_value)
for name, pad_value in aligned_specs.items()
if name in adapter_inputs
}
# Image tensors and metadata are passed to prefill unchanged.
pass_through_inputs = {
Expand Down
Loading
Loading