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

Method __init__

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

Source from the content-addressed store, hash-verified

294 """
295
296 def __init__(
297 self,
298 in_channels: int = 3,
299 channels: List[int] = [320, 640, 1280, 1280],
300 num_res_blocks: int = 2,
301 downscale_factor: int = 8,
302 ):
303 super().__init__()
304
305 in_channels = in_channels * downscale_factor**2
306
307 self.unshuffle = nn.PixelUnshuffle(downscale_factor)
308 self.conv_in = nn.Conv2d(in_channels, channels[0], kernel_size=3, padding=1)
309
310 self.body = nn.ModuleList(
311 [
312 AdapterBlock(channels[0], channels[0], num_res_blocks),
313 *[
314 AdapterBlock(channels[i - 1], channels[i], num_res_blocks, down=True)
315 for i in range(1, len(channels))
316 ],
317 ]
318 )
319
320 self.total_downscale_factor = downscale_factor * 2 ** (len(channels) - 1)
321
322 def forward(self, x: torch.Tensor) -> List[torch.Tensor]:
323 r"""

Callers

nothing calls this directly

Calls 2

AdapterBlockClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected