{"record":{"id":"e4873e7d55f8bacf","repo":"huggingface/transformers","slug":"file-not-found-audio","errorCode":null,"errorMessage":"File not found: {audio}","messagePattern":"File not found: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/transformers/audio_utils.py","lineNumber":342,"sourceCode":"            - `str`: Base64 encoded audio data (if return_format=\"base64\")\n            - `dict`: Dictionary with 'data' (base64 encoded audio data) and 'format' keys (if return_format=\"dict\")\n            - `io.BytesIO`: BytesIO object containing audio data (if return_format=\"buffer\")\n    \"\"\"\n    requires_backends(load_audio_as, [\"librosa\"])\n\n    if return_format not in [\"base64\", \"dict\", \"buffer\"]:\n        raise ValueError(f\"Invalid return_format: {return_format}. Must be 'base64', 'dict', or 'buffer'\")\n\n    try:\n        # Load audio bytes from URL or file\n        audio_bytes = None\n        if audio.startswith((\"http://\", \"https://\")):\n            audio_bytes = _fetch_audio_bytes(audio, timeout=timeout)\n        elif os.path.isfile(audio):\n            with open(audio, \"rb\") as audio_file:\n                audio_bytes = audio_file.read()\n        else:\n            raise ValueError(f\"File not found: {audio}\")\n\n        # Process audio data\n        with io.BytesIO(audio_bytes) as audio_file:\n            with sf.SoundFile(audio_file) as f:\n                audio_array = f.read(dtype=\"float32\")\n                original_sr = f.samplerate\n                audio_format = f.format\n                if sampling_rate is not None and sampling_rate != original_sr:\n                    # Resample audio to target sampling rate\n                    audio_array = soxr.resample(audio_array, original_sr, sampling_rate, quality=\"HQ\")\n                else:\n                    sampling_rate = original_sr\n\n        # Convert to mono if needed\n        if force_mono and audio_array.ndim != 1:\n            audio_array = audio_array.mean(axis=1)\n\n        buffer = io.BytesIO()","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/huggingface/transformers/blob/a597f974857b3d92939971296bc0deb93d33d780/src/transformers/audio_utils.py#L324-L360","documentation":"During `HfTrainerDeepSpeedConfig.fill_matches`/`fill_only` auto-filling, transformers resolves `auto` entries that depend on hidden size (e.g. `zero_optimization.reduce_bucket_size`, `stage3_prefetch_bucket_size`) by reading `model.config.hidden_size`, `hidden_sizes`, or the nested `text_config` equivalents. If none of these attributes exist on the model config (non-standard architecture), hidden_size stays None and auto-fill cannot proceed, so it raises with the list of affected keys.","triggerScenarios":"Training with DeepSpeed ZeRO (config containing `auto` bucket-size keys) a model whose config class lacks `hidden_size`/`hidden_sizes` (and `text_config.hidden_size[s]`) — e.g. some vision/multimodal/audio models or heavily custom configs.","commonSituations":"Custom model architectures; older multimodal configs without text_config; wrapper configs that hide the LM config under a different attribute name.","solutions":["Replace the `auto` values for the listed keys with explicit integers in your DeepSpeed config (e.g. `reduce_bucket_size: 5000000`, `stage3_prefetch_bucket_size: 4500000`)","Or expose `hidden_size`/`hidden_sizes` on your custom config class so auto-fill works","Or route the config through a `text_config` attribute carrying `hidden_size` if the model wraps a text backbone"],"exampleFix":"// before (ds_config.json)\n\"zero_optimization\": { \"stage\": 3, \"reduce_bucket_size\": \"auto\", \"stage3_prefetch_bucket_size\": \"auto\" }\n\n// after\n\"zero_optimization\": { \"stage\": 3, \"reduce_bucket_size\": 5000000, \"stage3_prefetch_bucket_size\": 4500000 }","handlingStrategy":"validation","validationCode":"cfg = model.config\nhidden = getattr(cfg, \"hidden_size\", None) or (\n    max(getattr(cfg, \"hidden_sizes\", [])) if hasattr(cfg, \"hidden_sizes\") else None\n) or getattr(getattr(cfg, \"text_config\", None), \"hidden_size\", None)\nif hidden is None:\n    # replace 'auto' bucket keys with explicit ints before training\n    for k in (\"zero_optimization.reduce_bucket_size\", \"zero_optimization.stage3_prefetch_bucket_size\"):\n        if deepspeed_dict_get(ds_cfg, k) == \"auto\":\n            raise SystemExit(f\"set {k} to an integer; model config has no hidden_size\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give custom config classes a hidden_size (or text_config.hidden_size) attribute","Prefer explicit bucket sizes in shared DeepSpeed JSONs used across architectures"],"tags":["deepspeed","zero","config","hidden-size","training"],"backgroundTag":null,"analyzedSha":"a597f974857b3d92939971296bc0deb93d33d780","analyzedAt":"2026-08-14T18:24:08.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}