Skip to content

rplksr DySample bug #296

@umzi2

Description

@umzi2

https://github.com/chaiNNer-org/spandrel/blob/main/libs/spandrel/spandrel/architectures/PLKSR/__arch/RealPLKSR.py#L147
This is not your fault, but rather a feature of the detection.
You will never get the condition DySample: True plus 1x in models from neosr so the condition with 1x is useless, also due to an error with groups 3x models do not work, it is better to replace this block with a piece from trainner-redux which we have with the-database changed. this is fully compatible with neosr but also extends the capabilities of DySample and makes spandrel compatible with redux.
https://github.com/the-database/traiNNer-redux/blob/master/traiNNer/archs/realplksr_arch.py#L142

        if dysample:
            groups = out_ch if upscaling_factor % 2 != 0 else 4
            self.to_img = DySample(
                in_ch * upscaling_factor**2,
                out_ch,
                upscaling_factor,
                groups=groups,
                end_convolution=True if upscaling_factor != 1 else False,
            )
        else:
            self.to_img = nn.PixelShuffle(upscaling_factor)

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        x = self.feats(x) + self.repeat_op(x)
        return self.to_img(x)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions