sgl-project/sglang · error · ValueError

Unexpected arguments: `**rope_kwargs` and `config` are mutua

Error message

Unexpected arguments: `**rope_kwargs` and `config` are mutually exclusive

What it means

MiMo audio's rope-parameter helper accepts either a HF-style config object or explicit rope keyword args (base, dim, ...), never both. Passing config together with any rope kwarg raises immediately. This mirrors transformers' _compute_default_rope_parameters signature contract.

Source

Thrown at python/sglang/srt/models/mimo_audio.py:34

from einops import rearrange
from transformers.activations import ACT2FN
from transformers.configuration_utils import PretrainedConfig
from transformers.modeling_utils import PreTrainedModel
from transformers.models.qwen2.configuration_qwen2 import Qwen2Config
from transformers.models.qwen2.modeling_qwen2 import Qwen2Model

from sglang.srt.layers.attention.vision import VisionAttention
from sglang.srt.layers.quantization.base_config import QuantizationConfig
from sglang.srt.runtime_context import get_model

logger = logging.getLogger(__name__)


def _compute_default_rope_parameters(
    config=None, device=None, seq_len=None, **rope_kwargs
):
    if config is not None and len(rope_kwargs) > 0:
        raise ValueError(
            "Unexpected arguments: `**rope_kwargs` and `config` are mutually exclusive"
        )
    if len(rope_kwargs) > 0:
        base = rope_kwargs["base"]
        dim = rope_kwargs["dim"]
    elif config is not None:
        base = config.rope_theta
        partial_rotary_factor = (
            config.partial_rotary_factor
            if hasattr(config, "partial_rotary_factor")
            else 1.0
        )
        head_dim = getattr(config, "head_dim", None)
        if head_dim is None:
            head_dim = config.hidden_size // config.num_attention_heads
            logger.info(
                "audio.head_dim not set; defaulting to hidden_size/num_heads = %d",
                head_dim,

View on GitHub (pinned to 0132848349)

Solutions

  1. Pass only config=..., deriving base/dim from it, and drop the extra kwargs
  2. Or omit config and pass all required rope_kwargs (base, dim, etc.) explicitly
  3. If wrapping the function, strip config from **rope_kwargs before forwarding

Example fix

// before
_compute_default_rope_parameters(config=cfg, base=10000, dim=64)
// after
_compute_default_rope_parameters(config=cfg)
Defensive patterns

Strategy: type-guard

Type guard

def call_rope_params(config=None, **kwargs):
    assert config is None or not kwargs, "pass config OR rope kwargs, not both"
    return _compute_default_rope_parameters(config=config, **kwargs)

Prevention

When it happens

Trigger: Calling _compute_default_rope_parameters(config=cfg, base=10000, dim=64) or similar mixed calls; wrapping the helper and forwarding both *args-derived kwargs and a config.

Common situations: Code adapted from transformers rope utilities where callers sometimes pass partial kwargs; refactors that forward **kwargs blindly while also injecting config.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/0d92eb5084471d65. Report an issue: GitHub.