"""Configuration for the SPEV multimodal decision model.""" import math from typing import ClassVar from transformers import PretrainedConfig, Qwen3OmniMoeThinkerConfig class SPEVConfig(PretrainedConfig): model_type = "spev" sub_configs: ClassVar[dict] = {"thinker_config": Qwen3OmniMoeThinkerConfig} def __init__( self, thinker_config=None, adapter_rank=32, adapter_alpha=64, head_width=256, temperature=1.0, max_tokens=8192, **kwargs, ): if isinstance(thinker_config, dict): thinker_config = Qwen3OmniMoeThinkerConfig(**thinker_config) self.thinker_config = thinker_config or Qwen3OmniMoeThinkerConfig() for name, value in ( ("adapter_rank", adapter_rank), ("head_width", head_width), ("max_tokens", max_tokens), ): if not isinstance(value, int) or isinstance(value, bool) or value <= 0: raise ValueError(f"{name} must be a positive integer") if not math.isfinite(adapter_alpha) or adapter_alpha <= 0: raise ValueError("adapter_alpha must be positive and finite") if not math.isfinite(temperature) or temperature <= 0: raise ValueError("temperature must be positive and finite") self.adapter_rank = adapter_rank self.adapter_alpha = adapter_alpha self.head_width = head_width self.temperature = temperature self.max_tokens = max_tokens kwargs.setdefault("tie_word_embeddings", False) super().__init__(**kwargs) def get_text_config(self, decoder=False, encoder=False): return self.thinker_config.text_config SPEVConfig.register_for_auto_class()