{"record":{"id":"7792ce9dcfa27b9a","repo":"huggingface/pytorch-image-models","slug":"invalid-net-configuration","errorCode":null,"errorMessage":"Invalid net configuration ","messagePattern":"Invalid net configuration ","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"timm/models/selecsls.py","lineNumber":316,"sourceCode":"        feature_info.extend([\n            dict(num_chs=144, reduction=4, module='features.1'),\n            dict(num_chs=304, reduction=8, module='features.6'),\n            dict(num_chs=512, reduction=16, module='features.12'),\n        ])\n        # Head can be replaced with alternative configurations depending on the problem\n        cfg['head'] = [\n            (512, 960, 3, 2),\n            (960, 1024, 3, 1),\n            (1024, 1024, 3, 2),\n            (1024, 1280, 3, 1),\n        ]\n        cfg['num_features'] = 1280\n        feature_info.extend([\n            dict(num_chs=1024, reduction=32, module='head.1'),\n            dict(num_chs=1280, reduction=64, module='head.3')\n        ])\n    else:\n        raise ValueError('Invalid net configuration ' + variant + ' !!!')\n    cfg['feature_info'] = feature_info\n\n    # this model can do 6 feature levels by default, unlike most others, leave as 0-4 to avoid surprises?\n    return build_model_with_cfg(\n        SelecSls,\n        variant,\n        pretrained,\n        model_cfg=cfg,\n        feature_cfg=dict(out_indices=(0, 1, 2, 3, 4), flatten_sequential=True),\n        **kwargs,\n    )\n\n\ndef _cfg(url='', **kwargs):\n    return {\n        'url': url,\n        'num_classes': 1000, 'input_size': (3, 224, 224), 'pool_size': (4, 4),\n        'crop_pct': 0.875, 'interpolation': 'bilinear',","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/huggingface/pytorch-image-models/blob/9a5261e31b3b5128526eb2658333b4c0a54464ae/timm/models/selecsls.py#L298-L334","documentation":"_create_selecsls builds a config from a hardcoded table keyed by variant string; an unknown variant falls through to the generic 'Invalid net configuration' error. The public factories (selecsls42, selecsls42b, selecsls60, selecsls60b, selecsls84) always pass valid names, so this fires only on custom/misspelled variants.","triggerScenarios":"Calling build_model_with_cfg(SelecSls, 'selecsls42c', ...) or a custom factory with a variant not in the if/elif chain of _create_selecsls.","commonSituations":"Adding a new SelecSls width/depth variant by copying a factory without extending _create_selecsls, or renaming variants inconsistently.","solutions":["Use one of the registered variants: selecsls42, selecsls42b, selecsls60, selecsls60b, selecsls84","If adding a new variant, add a matching branch in _create_selecsls that populates cfg and feature_info"],"exampleFix":"# before\nmodel = timm.create_model('selecsls42c', pretrained=False)\n# after\nmodel = timm.create_model('selecsls42b', pretrained=False)","handlingStrategy":"validation","validationCode":"from timm.models.selecsls import selecsls_variants if False else None\nvalid = {'selecsls42','selecsls42b','selecsls60','selecsls60b','selecsls84'}\nassert variant in valid","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use timm.create_model with exact registered variant names","Extend _create_selecsls when adding variants"],"tags":["timm","selecsls","variant","config"],"backgroundTag":"unknown-model-variant","analyzedSha":"9a5261e31b3b5128526eb2658333b4c0a54464ae","analyzedAt":"2026-08-27T02:34:25.417Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}