# 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 # This file was automatically generated from src/transformers/models/musicflamingo/modular_musicflamingo.py. # Do NOT edit this file manually as any edits will be overwritten by the generation of # the file from the modular. If any change should be done, please apply the change to the # modular_musicflamingo.py file directly. One of our CI enforces this. # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 # Copyright 2026 NVIDIA CORPORATION and the HuggingFace Inc. team. All rights # reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from huggingface_hub.dataclasses import strict from ...configuration_utils import PreTrainedConfig from ...utils import auto_docstring from ..auto import CONFIG_MAPPING, AutoConfig @auto_docstring(checkpoint="nvidia/music-flamingo-2601-hf") @strict class MusicFlamingoConfig(PreTrainedConfig): r""" audio_bos_token_id (`int`, *optional*, defaults to 151670): The beginning-of-audio token index used to mark the start of audio spans. audio_eos_token_id (`int`, *optional*, defaults to 151671): The end-of-audio token index used to mark the end of audio spans. audio_frame_step (`float`, *optional*, defaults to 0.01): Duration in seconds of one input mel frame (trained with hop_length 160 at sampling_rate 16000). Example: ```python >>> from transformers import MusicFlamingoForConditionalGeneration, MusicFlamingoConfig, AudioFlamingo3EncoderConfig, Qwen2Config >>> # Initializing an MusicFlamingoEncoder config >>> audio_config = AudioFlamingo3EncoderConfig() >>> # Initializing a Qwen2 config >>> text_config = Qwen2Config() >>> # Initializing an MusicFlamingo configuration >>> configuration = MusicFlamingoConfig(audio_config, text_config) >>> # Initializing a model from the musicflamingo style configuration >>> model = MusicFlamingoForConditionalGeneration(configuration) >>> # Accessing the model configuration >>> configuration = model.config ```""" model_type = "musicflamingo" sub_configs = {"audio_config": AutoConfig, "text_config": AutoConfig} audio_config: dict | PreTrainedConfig | None = None text_config: dict | PreTrainedConfig | None = None audio_token_id: int = 151669 projector_hidden_act: str = "gelu" projector_bias: bool = True audio_bos_token_id: int = 151670 audio_eos_token_id: int = 151671 audio_frame_step: float = 0.01 rope_parameters: dict | None = None def __post_init__(self, **kwargs): if self.rope_parameters is None: self.rope_parameters = { "rope_type": "default", "rope_theta": 1200.0, "partial_rotary_factor": 0.2, } if isinstance(self.audio_config, dict): if self.audio_config["model_type"] in [None, "musicflamingo_encoder"]: self.audio_config["model_type"] = "audioflamingo3_encoder" self.audio_config = CONFIG_MAPPING[self.audio_config["model_type"]](**self.audio_config) elif self.audio_config is None: self.audio_config = CONFIG_MAPPING["audioflamingo3_encoder"]() if isinstance(self.text_config, dict): self.text_config["model_type"] = self.text_config.get("model_type", "qwen2") self.text_config = CONFIG_MAPPING[self.text_config["model_type"]](**self.text_config) elif self.text_config is None: self.text_config = CONFIG_MAPPING["qwen2"]() self.max_position_embeddings = self.rope_parameters["rope_theta"] self.head_dim = self.audio_config.hidden_size super().__post_init__(**kwargs) __all__ = ["MusicFlamingoConfig"]