huggingface/transformers · error · ValueError
Incorrect audio source. Must be a valid URL starting with `h
Error message
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} What it means
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.
Source
Thrown at src/transformers/audio_utils.py:192
def _resolve_audio_source(audio: str, timeout: float | None = None) -> "str | bytes":
"""Resolve an audio source string to a local file path or raw bytes for a decoder.
Accepts `http(s)://` URLs (fetched with retry), local file paths (returned unchanged),
and base64 strings (optionally wrapped as a `data:...` URI).
"""
if audio.startswith(("http://", "https://")):
return _fetch_audio_bytes(audio, timeout=timeout)
if os.path.isfile(audio):
return audio
# Not a URL or a local path — assume base64, optionally wrapped as a `data:<media-type>;base64,` URI
if audio.startswith("data:"):
audio = audio.split(",", 1)[1]
try:
return base64.b64decode(audio)
except Exception as e:
raise ValueError(
"Incorrect audio source. Must be a valid URL starting with `http://` or `https://`, "
f"a valid path to an audio file, or a base64 encoded string. Got {audio}. Failed with {e}"
)
def load_audio(audio: str | np.ndarray, sampling_rate=16000, timeout=None, backend: str = "auto") -> np.ndarray:
"""
Loads `audio` to an np.ndarray object.
Args:
audio (`str` or `np.ndarray`):
The audio to be loaded to the numpy array format. If a `str`, it can be an `http(s)://`
URL, a local file path, or a base64-encoded string (optionally wrapped as a
`data:<media-type>;base64,` URI).
sampling_rate (`int`, *optional*, defaults to 16000):
The sampling rate to be used when loading the audio. It should be same as the
sampling rate the model you will be using further was trained with.
timeout (`float`, *optional*):View on GitHub (pinned to a597f97485)
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
Example fix
# before
model.set_experts_implementation("deepgemm")
out = model(x) # activation_scheme == "static" -> NotImplementedError
# after
model.set_experts_implementation("grouped_mm") Defensive patterns
Strategy: validation
Validate before calling
scheme = getattr(experts_module, "activation_scheme", None)
if scheme == "static":
model.set_experts_implementation("grouped_mm") # deepgemm needs dynamic per-token quant Try / catch
try:
out = experts(hidden, idx, w)
except NotImplementedError as e:
if "static activation quantization" in str(e):
model.set_experts_implementation("grouped_mm")
out = model(input_ids)
else:
raise Prevention
- Check activation_scheme in the checkpoint's quantization config at load
- Prefer dynamic activation FP8 checkpoints for DeepGEMM deployments
When it happens
Trigger: 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'`.
Common situations: Switching dispatch from the default to 'deepgemm' on an older static-FP8 checkpoint; teams re-using calibrated V2 scales with V3-style kernels.
Related errors
- Unsupported config file format: {args.config_file}
- No benchmark was run successfully
- All of the arguments --batch-size, --sequence-length, and --
- --num_tokens_to_generate arguments should be larger than 1
- function {activation_string} not found in ACT2FN mapping {li
AI-assisted analysis of huggingface/transformers@a597f97485 (2026-08-14).
Data as JSON: /api/errors/d3e525f015878f8c.
Report an issue: GitHub.