Gate mamba extra-buffer predicates on uses_mamba_radix_cache (#37474)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: Ke Bao <ispobaoke@gmail.com>
Co-authored-by: Sam Shleifer <sam@thinkingmachines.ai>
This commit is contained in:
Sam Shleifer
2026-09-17 14:39:12 +08:00
committed by GitHub
co-authored by Claude Fable 5 Ke Bao Sam Shleifer
parent fd6f96bf96
commit 8ae4a39b50
4 changed files with 30 additions and 0 deletions
@@ -591,6 +591,21 @@ class TestGoldenModelOverrides(_IsolatedPublish):
set_global_server_args_for_scheduler(server_args)
return get_server_args()
def test_explicit_extra_buffer_without_mamba_state_fails_fast(self):
with self.assertRaisesRegex(ValueError, "needs mamba state"):
self._construct(
"LlamaForCausalLM", "llama", mamba_radix_cache_strategy="extra_buffer"
)
def test_explicit_extra_buffer_is_harmless_with_radix_cache_disabled(self):
sa = self._construct(
"LlamaForCausalLM",
"llama",
mamba_radix_cache_strategy="extra_buffer",
disable_radix_cache=True,
)
self.assertFalse(self._resolved(sa, "uses_mamba_radix_cache"))
def test_mistral_large3_forces_bfloat16(self):
sa = self._construct("MistralLarge3ForCausalLM", "mistral")
self.assertEqual(