Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: keep causal-conv1d for Qwen3.5 / Qwen3-Next remote implementations (#14685)

Daniel Han3e68722e6c3a
diff --git a/studio/backend/tests/test_ssm_runtime.py b/studio/backend/tests/test_ssm_runtime.py
index 1e1c8341b06..cea38ea2abb 100644
--- a/studio/backend/tests/test_ssm_runtime.py
+++ b/studio/backend/tests/test_ssm_runtime.py
@@ -966,6 +966,35 @@ def test_qwen_gdn_configs_skip_causal_conv1d_when_zoo_covers_decode(monkeypatch,
assert ssm_runtime.resolved_model_wants_causal_conv1d("acme/x", target, None) is False
[email protected]("trust_remote_code", [True, None])
+def test_qwen_gdn_remote_code_keeps_causal_conv1d(monkeypatch, tmp_path, trust_remote_code):
+ # zoo patches the native modeling modules only; a remote implementation may import the package.
+ _zoo_covers_gdn(monkeypatch)
+ config = {
+ "model_type": "qwen3_5",
+ "architectures": ["CustomForCausalLM"],
+ "auto_map": {"AutoModelForCausalLM": "modeling_custom.CustomForCausalLM"},
+ }
+ target = str(_write_config(tmp_path / "remote", config))
+ kernels = ssm_runtime.resolve_ssm_kernels(
+ "acme/x", target, None, trust_remote_code = trust_remote_code
+ )
+ assert kernels.causal_conv1d is True
+ assert ssm_runtime.resolved_model_wants_causal_conv1d("acme/x", target, None) is True
+
+
+def test_qwen_gdn_auto_map_without_trust_remote_code_uses_native_modeling(monkeypatch, tmp_path):
+ # Without trust_remote_code transformers runs the native class, which zoo covers.
+ _zoo_covers_gdn(monkeypatch)
+ config = {
+ "model_type": "qwen3_5",
+ "auto_map": {"AutoModelForCausalLM": "modeling_custom.CustomForCausalLM"},
+ }
+ target = str(_write_config(tmp_path / "remote", config))
+ kernels = ssm_runtime.resolve_ssm_kernels("acme/x", target, None, trust_remote_code = False)
+ assert kernels.causal_conv1d is False
+
+
@pytest.mark.parametrize("missing", ["kill_switch", "decode_kernel", "platform"])
def test_qwen_gdn_request_returns_without_full_zoo_coverage(monkeypatch, missing):
_zoo_covers_gdn(monkeypatch, decode = missing != "decode_kernel", platform = missing != "platform")
diff --git a/studio/backend/utils/ssm_runtime.py b/studio/backend/utils/ssm_runtime.py
index e0e33eedd0a..cf7079e1629 100644
--- a/studio/backend/utils/ssm_runtime.py
+++ b/studio/backend/utils/ssm_runtime.py
@@ -631,6 +631,14 @@ def resolve_ssm_kernels(
required = model_requires_mamba_ssm(probe)
if wants is None:
wants = model_wants_causal_conv1d(probe)
+ # zoo replaces causal_conv1d only in the native modeling modules; remote code may import it.
+ if (
+ not wants
+ and remote_code
+ and trust_remote_code is not False
+ and any(_is_zoo_gdn_model_type(model_type) for model_type in model_types)
+ ):
+ wants = True
ssm_types = {t for t in model_types if t in SSM_MODEL_TYPES}
remote_code_used = bool(remote_code) and (
bool(trust_remote_code)