{"record":{"id":"b28e8a0e2dfc885c","repo":"Lightning-AI/pytorch-lightning","slug":"the-provided-parameter-names-name-name-isn-t","errorCode":null,"errorMessage":"The provided `parameter_names` name: {name} isn't in {self.PARAMETER_NAMES}","messagePattern":"The provided `parameter_names` name: (.+?) isn't in (.+?)","errorType":"exception","errorClass":"MisconfigurationException","httpStatus":null,"severity":"error","filePath":"src/lightning/pytorch/callbacks/pruning.py","lineNumber":175,"sourceCode":"                if ``pruning_norm`` is not provided when ``\"ln_structured\"``,\n                if ``pruning_fn`` is neither ``str`` nor :class:`torch.nn.utils.prune.BasePruningMethod`, or\n                if ``amount`` is none of ``int``, ``float`` and ``Callable``.\n\n        \"\"\"\n\n        self._use_global_unstructured = use_global_unstructured\n        self._parameters_to_prune = parameters_to_prune\n        self._use_lottery_ticket_hypothesis = use_lottery_ticket_hypothesis\n        self._resample_parameters = resample_parameters\n        self._prune_on_train_epoch_end = prune_on_train_epoch_end\n        self._parameter_names = parameter_names or self.PARAMETER_NAMES\n        self._global_kwargs: dict[str, Any] = {}\n        self._original_layers: Optional[dict[int, _LayerRef]] = None\n        self._pruning_method_name: Optional[str] = None\n\n        for name in self._parameter_names:\n            if name not in self.PARAMETER_NAMES:\n                raise MisconfigurationException(\n                    f\"The provided `parameter_names` name: {name} isn't in {self.PARAMETER_NAMES}\"\n                )\n\n        if isinstance(pruning_fn, str):\n            pruning_kwargs = {}\n            pruning_fn = pruning_fn.lower()\n            if pruning_fn not in _PYTORCH_PRUNING_FUNCTIONS:\n                raise MisconfigurationException(\n                    f\"The provided `pruning_fn` {pruning_fn} isn't available in PyTorch's\"\n                    f\" built-in functions: {list(_PYTORCH_PRUNING_FUNCTIONS.keys())} \"\n                )\n            if pruning_fn.endswith(\"_structured\"):\n                if pruning_dim is None:\n                    raise MisconfigurationException(\n                        \"When requesting `structured` pruning, the `pruning_dim` should be provided.\"\n                    )\n                if pruning_fn == \"ln_structured\":\n                    if pruning_norm is None:","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/pytorch/callbacks/pruning.py#L157-L193","documentation":"ModelPruning prunes parameters by name (e.g., 'weight' or 'bias') on the modules you list. Each name in parameter_names must exist in the callback's PARAMETER_NAMES set; otherwise __init__ raises MisconfigurationException listing the accepted names.","triggerScenarios":"Passing parameter_names=['weights'], ['keras_weight'], or any string not in PARAMETER_NAMES (typically {'weight','bias'}) to ModelPruning; singular/plural or casing mistakes in config.","commonSituations":"Assuming arbitrary attribute names work; configs written for other pruning tools; misspelling 'weight'.","solutions":["Restrict parameter_names to the supported set: ['weight'] and/or ['bias']","Check available names via the callback's PARAMETER_NAMES attribute before constructing","For custom-named parameters, subclass ModelPruning and override filter_parameters_to_prune to map to the real attributes"],"exampleFix":"# before\nModelPruning(parameter_names=['weights'])\n# after\nModelPruning(parameter_names=['weight'])","handlingStrategy":"validation","validationCode":"from lightning.pytorch.callbacks.pruning import ModelPruning\nassert set(names).issubset(ModelPruning.PARAMETER_NAMES), f'allowed: {ModelPruning.PARAMETER_NAMES}'","typeGuard":"def valid_param_names(names) -> bool:\n    return set(names).issubset({'weight', 'bias'})","tryCatchPattern":null,"preventionTips":["Inspect PARAMETER_NAMES on the callback class before writing configs","Use only 'weight'/'bias' unless subclassing"],"tags":["pytorch-lightning","pruning","parameter-names","argument-validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"9fed5c27d2a62ff0efd6c3573599921d6ff67c14","analyzedAt":"2026-08-28T11:52:41.083Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}