{"record":{"id":"665f9707ccf97ce3","repo":"huggingface/transformers","slug":"the-model-s-config-file-has-neither-hidden-size","errorCode":null,"errorMessage":"The model's config file has neither `hidden_size` nor `hidden_sizes` entry, therefore it's not possible to automatically fill out the following `auto` entries in the DeepSpeed config file: {hidden_size_auto_keys}. You can fix that by replacing `auto` values for these keys with an integer value of your choice.","messagePattern":"The model's config file has neither `hidden_size` nor `hidden_sizes` entry, therefore it's not possible to automatically fill out the following `auto` entries in the DeepSpeed config file: (.+?)\\. You can fix that by replacing `auto` values for these keys with an integer value of your choice\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/transformers/integrations/deepspeed.py","lineNumber":222,"sourceCode":"        ]\n        hidden_size_auto_keys = [x for x in hidden_size_based_keys if self.is_auto(x)]\n\n        if len(hidden_size_auto_keys) > 0:\n            hidden_size = None\n            if hasattr(model, \"config\"):\n                if hasattr(model.config, \"hidden_size\"):\n                    hidden_size = model.config.hidden_size\n                elif hasattr(model.config, \"hidden_sizes\"):\n                    # if there are many hidden sizes pick the largest one\n                    hidden_size = max(model.config.hidden_sizes)\n                elif hasattr(model.config, \"text_config\") and hasattr(model.config.text_config, \"hidden_size\"):\n                    hidden_size = model.config.text_config.hidden_size\n                elif hasattr(model.config, \"text_config\") and hasattr(model.config.text_config, \"hidden_sizes\"):\n                    # if there are many hidden sizes pick the largest one\n                    hidden_size = max(model.config.text_config.hidden_sizes)\n\n            if hidden_size is None:\n                raise ValueError(\n                    \"The model's config file has neither `hidden_size` nor `hidden_sizes` entry, \"\n                    \"therefore it's not possible to automatically fill out the following `auto` entries \"\n                    f\"in the DeepSpeed config file: {hidden_size_auto_keys}. You can fix that by replacing \"\n                    \"`auto` values for these keys with an integer value of your choice.\"\n                )\n\n            self.fill_only(\"zero_optimization.reduce_bucket_size\", hidden_size * hidden_size)\n            if self.is_zero3():\n                # automatically assign the optimal config values based on model config\n                self.fill_only(\n                    \"zero_optimization.stage3_prefetch_bucket_size\",\n                    int(0.9 * hidden_size * hidden_size),\n                )\n                self.fill_only(\n                    \"zero_optimization.stage3_param_persistence_threshold\",\n                    10 * hidden_size,\n                )\n","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/huggingface/transformers/blob/a597f974857b3d92939971296bc0deb93d33d780/src/transformers/integrations/deepspeed.py#L204-L240","documentation":"Error \"The model's config file has neither `hidden_size` nor `hidden_sizes` entry, therefore it's not possible to automatically fill out the following `auto` entries in the DeepSpeed config file: {hidden_size_auto_keys}. You can fix that by replacing `auto` values for these keys with an integer value of your choice.\" thrown in huggingface/transformers.","triggerScenarios":"Raised in DeepSpeed config auto-fill when the model config has neither hidden_size nor hidden_sizes for 'auto' entries.","commonSituations":"DeepSpeed config with 'auto' hidden-size keys on a model whose config lacks any hidden size attribute.","solutions":["Replace the 'auto' entries in the DeepSpeed config with explicit integers.","Add `hidden_size` to the model config so auto-fill can work."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a597f974857b3d92939971296bc0deb93d33d780","analyzedAt":"2026-08-14T18:24:08.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}