{"record":{"id":"00d22b4ecdab5d15","repo":"lllyasviel/Fooocus","slug":"upsample-mode-self-upsampler-is-not-found","errorCode":null,"errorMessage":"Upsample mode [{self.upsampler}] is not found","messagePattern":"Upsample mode \\[(.+?)\\] is not found","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"ldm_patched/pfn/architecture/RRDB.py","lineNumber":106,"sourceCode":"        self.supports_fp16 = True\n        self.supports_bfp16 = True\n        self.min_size_restriction = None\n\n        # Detect if pixelunshuffle was used (Real-ESRGAN)\n        if self.in_nc in (self.out_nc * 4, self.out_nc * 16) and self.out_nc in (\n            self.in_nc / 4,\n            self.in_nc / 16,\n        ):\n            self.shuffle_factor = int(math.sqrt(self.in_nc / self.out_nc))\n        else:\n            self.shuffle_factor = None\n\n        upsample_block = {\n            \"upconv\": B.upconv_block,\n            \"pixel_shuffle\": B.pixelshuffle_block,\n        }.get(self.upsampler)\n        if upsample_block is None:\n            raise NotImplementedError(f\"Upsample mode [{self.upsampler}] is not found\")\n\n        if self.scale == 3:\n            upsample_blocks = upsample_block(\n                in_nc=self.num_filters,\n                out_nc=self.num_filters,\n                upscale_factor=3,\n                act_type=self.act,\n                c2x2=c2x2,\n            )\n        else:\n            upsample_blocks = [\n                upsample_block(\n                    in_nc=self.num_filters,\n                    out_nc=self.num_filters,\n                    act_type=self.act,\n                    c2x2=c2x2,\n                )\n                for _ in range(int(math.log(self.scale, 2)))","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/lllyasviel/Fooocus/blob/ae05379cc97bc4361ec8b4ec90193dab21be763f/ldm_patched/pfn/architecture/RRDB.py#L88-L124","documentation":"RRDBNet selects its upsampling block builder from a dict keyed by exactly two strings: 'upconv' and 'pixel_shuffle' (with an underscore). Any other self.upsampler value makes the .get() return None and raises NotImplementedError at build time.","triggerScenarios":"Constructing RRDBNet with upsampler='pixelshuffle' (BasicSR's usual spelling, no underscore), 'nearest', 'nearest+conv', or None. The value flows in from the model config dict used when loading ESRGAN-family upscalers.","commonSituations":"Copying a Real-ESRGAN YAML (which uses 'pixelshuffle') into this vendored RRDB without renaming to 'pixel_shuffle'; hand-written model params omitting the key default expectations; arch code ported between repos with inconsistent naming.","solutions":["Set upsampler='pixel_shuffle' (underscore) or 'upconv' in the RRDB config","For nearest-neighbour style upsampling use 'upconv' with the appropriate conv config, or patch the dict to add your mode"],"exampleFix":"# before\nnet = RRDBNet(3, 3, 64, 23, upsampler='pixelshuffle')  # -> NotImplementedError\n\n# after\nnet = RRDBNet(3, 3, 64, 23, upsampler='pixel_shuffle')","handlingStrategy":"validation","validationCode":"RRDB_UPSAMPLERS = {'upconv', 'pixel_shuffle'}\n\nupsampler = cfg.get('upsampler', 'upconv')\n# tolerate the BasicSR spelling when porting configs\nif upsampler == 'pixelshuffle':\n    upsampler = 'pixel_shuffle'\nassert upsampler in RRDB_UPSAMPLERS, f'RRDB upsampler must be one of {RRDB_UPSAMPLERS}'","typeGuard":"def is_valid_rrdb_upsampler(name: str) -> bool:\n    return name in ('upconv', 'pixel_shuffle')","tryCatchPattern":null,"preventionTips":["Remember the underscore: RRDBNet uses 'pixel_shuffle', SPSR uses 'pixelshuffle'","Normalize config strings once in the loader for all SR architectures"],"tags":["super-resolution","rrdb","esrgan","upsampler","config","naming"],"backgroundTag":null,"analyzedSha":"ae05379cc97bc4361ec8b4ec90193dab21be763f","analyzedAt":"2026-08-15T04:23:59.533Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}