lllyasviel/Fooocus · error · NotImplementedError

upsample mode [{upsampler}] is not found

Error message

upsample mode [{upsampler}] is not found

What it means

SPSRNet (branch A of SPSR) accepts exactly two upsampler strings: 'upconv' -> B.upconv_block and 'pixelshuffle' -> B.pixelshuffle_block (note: here WITHOUT underscore, unlike RRDBNet in the same repo). Anything else raises NotImplementedError before the upsampling stack is built.

Source

Thrown at ldm_patched/pfn/architecture/SPSR.py:104

                mode="CNA",
            )
            for _ in range(self.num_blocks)
        ]
        LR_conv = B.conv_block(
            self.num_filters,
            self.num_filters,
            kernel_size=3,
            norm_type=norm,
            act_type=None,
            mode=mode,
        )

        if upsampler == "upconv":
            upsample_block = B.upconv_block
        elif upsampler == "pixelshuffle":
            upsample_block = B.pixelshuffle_block
        else:
            raise NotImplementedError(f"upsample mode [{upsampler}] is not found")
        if self.scale == 3:
            a_upsampler = upsample_block(
                self.num_filters, self.num_filters, 3, act_type=act
            )
        else:
            a_upsampler = [
                upsample_block(self.num_filters, self.num_filters, act_type=act)
                for _ in range(n_upscale)
            ]
        self.HR_conv0_new = B.conv_block(
            self.num_filters,
            self.num_filters,
            kernel_size=3,
            norm_type=None,
            act_type=act,
        )
        self.HR_conv1_new = B.conv_block(
            self.num_filters,

View on GitHub (pinned to ae05379cc9)

Solutions

  1. Use upsampler='pixelshuffle' or 'upconv' for SPSR
  2. If porting a config from RRDBNet, change 'pixel_shuffle' to 'pixelshuffle' when targeting SPSR

Example fix

# before
net = SPSRNet(..., upsampler='pixel_shuffle')  # -> NotImplementedError

# after
net = SPSRNet(..., upsampler='pixelshuffle')
Defensive patterns

Strategy: validation

Validate before calling

SPSR_UPSAMPLERS = {'upconv', 'pixelshuffle'}

upsampler = cfg.get('upsampler', 'upconv')
if upsampler == 'pixel_shuffle':  # tolerate RRDB-style spelling
    upsampler = 'pixelshuffle'
assert upsampler in SPSR_UPSAMPLERS, f'SPSR upsampler must be one of {SPSR_UPSAMPLERS}'

Type guard

def is_valid_spsr_upsampler(name: str) -> bool:
    return name in ('upconv', 'pixelshuffle')

Prevention

When it happens

Trigger: Constructing SPSR with upsampler='pixel_shuffle' (RRDB's spelling), '', or an arbitrary string in the model params dict; typically from a copied upscaler YAML whose spelling does not match this architecture's expectations.

Common situations: Cross-pollinating configs between RRDBNet ('pixel_shuffle') and SPSR ('pixelshuffle') upscalers; registering SPSR with nearest/none upsampler intending to skip upsampling.

Related errors


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