Skip to content
Open
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: 11 additions & 2 deletions docs/CICD.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,17 @@ behind its Hub repo.
- `tests/composer/test_selective_download.py::TestRealHubMetadata`: the published
adapter repos' layout, against the live Hub.
- `tests/hf/test_quantization.py`: the quantization libraries on a real
checkpoint. Its `GRANITE_SWITCH_E2E_MODELS=1` gate is opened by
`tests/conftest.py` whenever `-m` selects `release`.
checkpoint.
- The MultiSwitch real-checkpoint tests, which compose a real `granite-4.1-3b`
with real adapter libraries:
`tests/hf/test_multi_switch_real_checkpoint.py`,
`tests/integration/test_multi_switch_vllm_generate.py`,
`tests/integration/test_multi_switch_serving_e2e.py`,
`tests/integration/test_multi_switch_alora_cache.py`,
`tests/integration/test_conversation_prefix_cache.py` and
`tests/vllm/test_pipeline_parallelism_equivalence.py` (2 GPUs).
`tests/integration/test_conversation_concurrency.py` stays out: it never
composes a checkpoint and needs one pre-built at `GRANITE_SWITCH_CONV_DIR`.

**The rest of a breadth matrix** is release-only too: PR runs keep one
representative case.
Expand Down
7 changes: 2 additions & 5 deletions docs/MULTISWITCH_EXPLAINED.md
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ An fp8 cache would saturate the mask and collapse the codeword separation the ga

### One render emits one control token -- *(template limit, not engine)*

The template keys off a single scalar `adapter_name`, so one `apply_chat_template` call yields one token for `single` and `multi` alike. Reaching MultiSwitch's actual shape -- several control tokens in one sequence -- means assembling token ids rather than rendering, which is what PRESERVE does and what `tests/hf/test_multi_switch_alora.py` does by concatenating two renders. So: *one token per render*, not one token per request.
The template keys off a single scalar `adapter_name`, so one `apply_chat_template` call yields one token for `single` and `multi` alike. Reaching MultiSwitch's actual shape -- several control tokens in one sequence -- means assembling token ids rather than rendering, which is what PRESERVE does and what `tests/hf/test_multi_switch_real_checkpoint.py` does by concatenating two renders. So: *one token per render*, not one token per request.

### Control tokens are freely generatable -- *(by design)*

Expand Down Expand Up @@ -605,12 +605,9 @@ Test counts are `grep -c '^\s*def test_'` over the tree. Two files shrank in the
| `tests/unit/test_conversation_lora_rule.py` | 8 | a LoRA turn falls back to a full render |
| **HF backend -- CPU** | | |
| `tests/hf/test_multi_switch.py` | 12 | the engine across attention backends; `TestReturnToBaseCoded` |
| `tests/hf/test_multi_switch_alora.py` | 9 | two aLoRA adapters in *one* sequence |
| `tests/hf/test_multi_switch_buffers.py` | 4 | the codebook and LUT surviving a save/load round trip |
| `tests/hf/test_multi_switch_e2e.py` | 9 | compose -> load -> forward |
| `tests/hf/test_multi_switch_real_checkpoint.py` | 31 | real LoRA / aLoRA / mixed checkpoints: compose -> load -> forward -> generate; template placement, multi-turn, long prompts, two aLoRAs in one sequence, re-save |
| `tests/hf/test_multi_switch_generate.py` | 6 | the `kv_len` mask fix; a prefill-only control token routing every later decode step |
| `tests/hf/test_multi_switch_mixed_tech.py` | 7 | LoRA + aLoRA in one checkpoint |
| `tests/hf/test_multi_switch_realistic.py` | 7 | chat template, real multi-turn, long prompts |
| `tests/hf/test_conversation_routing.py` | 4 | the policy's ids actually routing as claimed |
| **composer** | | |
| `tests/composer/test_base_reset_token.py` | 11 | the engine driven by exactly what compose emits |
Expand Down
4 changes: 2 additions & 2 deletions src/granite_switch/composer/compose_granite_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,8 +307,8 @@ def refresh_switch_control_lut(model) -> bool:
specific to ``--enable-audio`` rather than universal.

Extracted from ``build()`` so the rebuild can be tested without composing a
real checkpoint (the real audio-compose tests are gated behind
``GRANITE_SWITCH_E2E_MODELS=1``, unset in CI).
real checkpoint (the real audio-compose tests run only in the
release tier, not on PRs).

Args:
model: Composed model, after ``resize_token_embeddings``.
Expand Down
2 changes: 1 addition & 1 deletion tests/composer/test_control_lut_refresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
``--switch-type multi --enable-audio`` and not multi alone.

Why nothing caught it: every test that runs a real ``compose --switch-type
multi`` is gated behind ``GRANITE_SWITCH_E2E_MODELS=1``, which CI never sets, and
multi`` was gated behind an opt-in env var that CI never set, and
none of them passes ``--enable-audio`` anyway. These tests are deliberately
CPU-only and ungated so the intersection is covered on every run.
"""
Expand Down
10 changes: 0 additions & 10 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,6 @@ def pytest_configure(config):
# a newer toolkit in the image; this keeps the suites meaningful until then.
os.environ.setdefault("VLLM_USE_FLASHINFER_SAMPLER", "0")

# ── release tier opens the real-checkpoint gate ───────────────
#
# Some release-tier tests (test_quantization.py) are also gated on
# GRANITE_SWITCH_E2E_MODELS=1, which the GPU pod has no way to set: the runner
# passes only pytest arguments. A run that selects the release marker has asked
# for exactly those tests, so it sets the gate itself. setdefault, so an explicit
# GRANITE_SWITCH_E2E_MODELS=0 still wins.
if "release" in (config.getoption("markexpr", "") or "").replace("not release", ""):
os.environ.setdefault("GRANITE_SWITCH_E2E_MODELS", "1")

worker_id = os.environ.get("PYTEST_XDIST_WORKER")
if worker_id is None:
return # not running under xdist
Expand Down
2 changes: 1 addition & 1 deletion tests/hf/test_multi_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ def test_bf16_autocast_stays_correct(self):

NOTE: on GPU, letting the memory head autocast to bf16 overflows its
softmax to NaN and routes every token to base — this was a real bug caught
only by the GPU end-to-end test (tests/hf/test_multi_switch_e2e.py), NOT by
only by the GPU end-to-end test (tests/hf/test_multi_switch_real_checkpoint.py), NOT by
CPU (CPU autocast does not reproduce the overflow). This CPU test documents
the intended behavior and guards the no-NaN / correct-routing contract; the
GPU e2e is the authoritative regression gate for the overflow itself."""
Expand Down
Loading
Loading