{"record":{"id":"d3e525f015878f8c","repo":"huggingface/transformers","slug":"incorrect-audio-source-must-be-a-valid-url-starti","errorCode":null,"errorMessage":"Incorrect audio source. Must be a valid URL starting with `http://` or `https://`, a valid path to an audio file, or a base64 encoded string. Got {audio}. Failed with {e}","messagePattern":"Incorrect audio source\\. Must be a valid URL starting with `http://` or `https://`, a valid path to an audio file, or a base64 encoded string\\. Got (.+?)\\. Failed with (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/transformers/audio_utils.py","lineNumber":192,"sourceCode":"\n\ndef _resolve_audio_source(audio: str, timeout: float | None = None) -> \"str | bytes\":\n    \"\"\"Resolve an audio source string to a local file path or raw bytes for a decoder.\n\n    Accepts `http(s)://` URLs (fetched with retry), local file paths (returned unchanged),\n    and base64 strings (optionally wrapped as a `data:...` URI).\n    \"\"\"\n    if audio.startswith((\"http://\", \"https://\")):\n        return _fetch_audio_bytes(audio, timeout=timeout)\n    if os.path.isfile(audio):\n        return audio\n    # Not a URL or a local path — assume base64, optionally wrapped as a `data:<media-type>;base64,` URI\n    if audio.startswith(\"data:\"):\n        audio = audio.split(\",\", 1)[1]\n    try:\n        return base64.b64decode(audio)\n    except Exception as e:\n        raise ValueError(\n            \"Incorrect audio source. Must be a valid URL starting with `http://` or `https://`, \"\n            f\"a valid path to an audio file, or a base64 encoded string. Got {audio}. Failed with {e}\"\n        )\n\n\ndef load_audio(audio: str | np.ndarray, sampling_rate=16000, timeout=None, backend: str = \"auto\") -> np.ndarray:\n    \"\"\"\n    Loads `audio` to an np.ndarray object.\n\n    Args:\n        audio (`str` or `np.ndarray`):\n            The audio to be loaded to the numpy array format. If a `str`, it can be an `http(s)://`\n            URL, a local file path, or a base64-encoded string (optionally wrapped as a\n            `data:<media-type>;base64,` URI).\n        sampling_rate (`int`, *optional*, defaults to 16000):\n            The sampling rate to be used when loading the audio. It should be same as the\n            sampling rate the model you will be using further was trained with.\n        timeout (`float`, *optional*):","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/huggingface/transformers/blob/a597f974857b3d92939971296bc0deb93d33d780/src/transformers/audio_utils.py#L174-L210","documentation":"The DeepGEMM FP8/FP4 experts dispatch only supports dynamic (per-token) activation quantization; when the experts module was quantized with `activation_scheme='static'` (calibrated per-tensor input scales), the dispatch raises `NotImplementedError` on the first forward. DeepGEMM's kernels need per-row scale factors, which static schemes do not provide.","triggerScenarios":"Loading an FP8 MoE checkpoint calibrated with static activation scales (e.g. DeepSeek-V2 static variants, `QuantizerConfig(activation_scheme='static')`) and running `experts_implementation='deepgemm'`.","commonSituations":"Switching dispatch from the default to 'deepgemm' on an older static-FP8 checkpoint; teams re-using calibrated V2 scales with V3-style kernels.","solutions":["Switch experts dispatch to `grouped_mm` (or the default) which supports static activation scales","Re-quantize/calibrate the checkpoint with `activation_scheme='dynamic'`","Catch NotImplementedError and fall back per-layer if building a generic runner"],"exampleFix":"# before\nmodel.set_experts_implementation(\"deepgemm\")\nout = model(x)  # activation_scheme == \"static\" -> NotImplementedError\n\n# after\nmodel.set_experts_implementation(\"grouped_mm\")","handlingStrategy":"validation","validationCode":"scheme = getattr(experts_module, \"activation_scheme\", None)\nif scheme == \"static\":\n    model.set_experts_implementation(\"grouped_mm\")  # deepgemm needs dynamic per-token quant","typeGuard":null,"tryCatchPattern":"try:\n    out = experts(hidden, idx, w)\nexcept NotImplementedError as e:\n    if \"static activation quantization\" in str(e):\n        model.set_experts_implementation(\"grouped_mm\")\n        out = model(input_ids)\n    else:\n        raise","preventionTips":["Check activation_scheme in the checkpoint's quantization config at load","Prefer dynamic activation FP8 checkpoints for DeepGEMM deployments"],"tags":["deepgemm","moe","static-quantization","fp8"],"backgroundTag":null,"analyzedSha":"a597f974857b3d92939971296bc0deb93d33d780","analyzedAt":"2026-08-14T18:24:08.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}