MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / __init__

Method __init__

diffusers/src/diffusers/models/adapter.py:474–498  ·  view source on GitHub ↗
(
        self,
        in_channels: int = 3,
        channels: List[int] = [320, 640, 1280],
        num_res_blocks: int = 4,
        downscale_factor: int = 8,
    )

Source from the content-addressed store, hash-verified

472 """
473
474 def __init__(
475 self,
476 in_channels: int = 3,
477 channels: List[int] = [320, 640, 1280],
478 num_res_blocks: int = 4,
479 downscale_factor: int = 8,
480 ):
481 super().__init__()
482
483 in_channels = in_channels * downscale_factor**2
484
485 self.unshuffle = nn.PixelUnshuffle(downscale_factor)
486
487 self.body = nn.ModuleList(
488 [
489 LightAdapterBlock(in_channels, channels[0], num_res_blocks),
490 *[
491 LightAdapterBlock(channels[i], channels[i + 1], num_res_blocks, down=True)
492 for i in range(len(channels) - 1)
493 ],
494 LightAdapterBlock(channels[-1], channels[-1], num_res_blocks, down=True),
495 ]
496 )
497
498 self.total_downscale_factor = downscale_factor * (2 ** len(channels))
499
500 def forward(self, x: torch.Tensor) -> List[torch.Tensor]:
501 r"""

Callers

nothing calls this directly

Calls 2

LightAdapterBlockClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected