Instructions to use FunAudioLLM/Qwen-Audio-3.1-Jev with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FunAudioLLM/Qwen-Audio-3.1-Jev with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="FunAudioLLM/Qwen-Audio-3.1-Jev", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("FunAudioLLM/Qwen-Audio-3.1-Jev", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download configuration_jev.py from FunAudioLLM/Qwen-Audio-3.1-Jev: direct link, hf CLI and curl.
- Browser
- Download file 3.59 kB
-
https://huggingface.co/FunAudioLLM/Qwen-Audio-3.1-Jev/resolve/main/configuration_jev.py
- Command line
-
hf download hf://FunAudioLLM/Qwen-Audio-3.1-Jev/configuration_jev.py
-
curl -L -o configuration_jev.py https://huggingface.co/FunAudioLLM/Qwen-Audio-3.1-Jev/resolve/main/configuration_jev.py
3.59 kB
| """HF configuration for the complete audio encoder, backbone and decision heads.""" | |
| from transformers import PreTrainedConfig | |
| from transformers.models.qwen3_5.configuration_qwen3_5 import Qwen3_5TextConfig | |
| from transformers.models.qwen3_5_moe.configuration_qwen3_5_moe import Qwen3_5MoeTextConfig | |
| TINY_TEXT_CONFIG = { | |
| "vocab_size": 248320, "hidden_size": 1024, "intermediate_size": 3584, | |
| "num_hidden_layers": 24, "num_attention_heads": 8, "num_key_value_heads": 2, | |
| "head_dim": 256, "rms_norm_eps": 1e-6, "max_position_embeddings": 262144, | |
| "linear_conv_kernel_dim": 4, "linear_key_head_dim": 128, "linear_value_head_dim": 128, | |
| "linear_num_key_heads": 16, "linear_num_value_heads": 16, "full_attention_interval": 4, | |
| "rope_parameters": {"rope_type": "default", "rope_theta": 10000000.0, | |
| "partial_rotary_factor": 0.25, "mrope_interleaved": True, | |
| "mrope_section": [11, 11, 10]}, | |
| } | |
| TINY_AUDIO_CONFIG = { | |
| "encoder_dim": 1536, "conv_dim": 1280, "attention_heads": 16, | |
| "kv_heads": 8, "head_dim": 128, "num_blocks": 5, "intermediate_size": 4608, | |
| "block_causal_size": 4, "rms_norm_eps": 1e-6, "rope_theta": 1000000.0, | |
| "adaptor_downsample_rate": 4, "adaptor_num_layers": 0, | |
| } | |
| class JevConfig(PreTrainedConfig): | |
| model_type = "qwen_audio_jev" | |
| sub_configs = {"text_config": Qwen3_5MoeTextConfig} | |
| def __init__(self, text_config=None, audio_config=None, max_choice_options=64, | |
| max_score_levels=10, variant="base", **kwargs): | |
| kwargs.pop("tie_word_embeddings", None) | |
| super().__init__(tie_word_embeddings=False, **kwargs) | |
| if variant not in ("base", "tiny"): | |
| raise ValueError("Unsupported Jev variant: " + str(variant)) | |
| self.variant = variant | |
| text_class = Qwen3_5MoeTextConfig if variant == "base" else Qwen3_5TextConfig | |
| if isinstance(text_config, dict) and text_config.get("model_type", text_class.model_type) != text_class.model_type: | |
| raise ValueError(f"Incompatible language model configuration for Jev {variant}") | |
| if isinstance(text_config, PreTrainedConfig): | |
| if not isinstance(text_config, text_class): | |
| raise ValueError(f"Incompatible language model configuration for Jev {variant}") | |
| self.text_config = text_config | |
| else: | |
| defaults = TINY_TEXT_CONFIG if variant == "tiny" else { | |
| "vocab_size": 248576, | |
| "rope_parameters": {"rope_type": "default", "rope_theta": 10000000.0, | |
| "partial_rotary_factor": 0.25}, | |
| } | |
| self.text_config = text_class(**(dict(defaults) if text_config is None else text_config)) | |
| self.text_config.use_cache = False | |
| self.audio_config = { | |
| "input_size": 128, "encoder_dim": 1280, "attention_heads": 20, | |
| "num_blocks": 32, "kernel_size": 31, "rope_theta": 10000.0, | |
| "adaptor_downsample_rate": 2, "adaptor_num_layers": 2, "adaptor_ffn_dim": 2048, | |
| "adaptor_attention_heads": 8, "window_size": 6000, "bin_threshold": 200, | |
| "max_windows_per_batch": 48, | |
| **(TINY_AUDIO_CONFIG if variant == "tiny" else {}), | |
| **(audio_config or {}), | |
| } | |
| self.max_choice_options = max_choice_options | |
| self.max_score_levels = max_score_levels | |
| self.hidden_size = self.text_config.hidden_size | |
| if not 2 <= max_choice_options <= 64 or not 2 <= max_score_levels <= 10: | |
| raise ValueError("Unsupported Jev decision-head dimensions") | |