lllyasviel/Fooocus · error · NotImplementedError

Upsample mode [{self.upsampler}] is not found

Error message

Upsample mode [{self.upsampler}] is not found

What it means

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.

Source

Thrown at ldm_patched/pfn/architecture/RRDB.py:106

        self.supports_fp16 = True
        self.supports_bfp16 = True
        self.min_size_restriction = None

        # Detect if pixelunshuffle was used (Real-ESRGAN)
        if self.in_nc in (self.out_nc * 4, self.out_nc * 16) and self.out_nc in (
            self.in_nc / 4,
            self.in_nc / 16,
        ):
            self.shuffle_factor = int(math.sqrt(self.in_nc / self.out_nc))
        else:
            self.shuffle_factor = None

        upsample_block = {
            "upconv": B.upconv_block,
            "pixel_shuffle": B.pixelshuffle_block,
        }.get(self.upsampler)
        if upsample_block is None:
            raise NotImplementedError(f"Upsample mode [{self.upsampler}] is not found")

        if self.scale == 3:
            upsample_blocks = upsample_block(
                in_nc=self.num_filters,
                out_nc=self.num_filters,
                upscale_factor=3,
                act_type=self.act,
                c2x2=c2x2,
            )
        else:
            upsample_blocks = [
                upsample_block(
                    in_nc=self.num_filters,
                    out_nc=self.num_filters,
                    act_type=self.act,
                    c2x2=c2x2,
                )
                for _ in range(int(math.log(self.scale, 2)))

View on GitHub (pinned to ae05379cc9)

Solutions

  1. Set upsampler='pixel_shuffle' (underscore) or 'upconv' in the RRDB config
  2. For nearest-neighbour style upsampling use 'upconv' with the appropriate conv config, or patch the dict to add your mode

Example fix

# before
net = RRDBNet(3, 3, 64, 23, upsampler='pixelshuffle')  # -> NotImplementedError

# after
net = RRDBNet(3, 3, 64, 23, upsampler='pixel_shuffle')
Defensive patterns

Strategy: validation

Validate before calling

RRDB_UPSAMPLERS = {'upconv', 'pixel_shuffle'}

upsampler = cfg.get('upsampler', 'upconv')
# tolerate the BasicSR spelling when porting configs
if upsampler == 'pixelshuffle':
    upsampler = 'pixel_shuffle'
assert upsampler in RRDB_UPSAMPLERS, f'RRDB upsampler must be one of {RRDB_UPSAMPLERS}'

Type guard

def is_valid_rrdb_upsampler(name: str) -> bool:
    return name in ('upconv', 'pixel_shuffle')

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of lllyasviel/Fooocus@ae05379cc9 (2026-08-15). Data as JSON: /api/errors/00d22b4ecdab5d15. Report an issue: GitHub.