MCPcopy Create free account
hub / github.com/OpenBMB/AgentCPM-GUI / __init__

Method __init__

eval/utils/utils_odyssey/visual.py:301–318  ·  view source on GitHub ↗
(
            self,
            width: int,
            layers: int,
            heads: int,
            mlp_ratio: float = 4.0,
            act_layer: Callable = nn.GELU,
            norm_layer: Callable = nn.LayerNorm,
    )

Source from the content-addressed store, hash-verified

299
300class TransformerBlock(nn.Module):
301 def __init__(
302 self,
303 width: int,
304 layers: int,
305 heads: int,
306 mlp_ratio: float = 4.0,
307 act_layer: Callable = nn.GELU,
308 norm_layer: Callable = nn.LayerNorm,
309 ):
310 super().__init__()
311 self.width = width
312 self.layers = layers
313
314 self.resblocks = nn.ModuleList([
315 VisualAttentionBlock(
316 width, heads, mlp_ratio, act_layer=act_layer, norm_layer=norm_layer)
317 for _ in range(layers)
318 ])
319
320 def get_cast_dtype(self) -> torch.dtype:
321 return self.resblocks[0].mlp.c_fc.weight.dtype

Callers

nothing calls this directly

Calls 2

__init__Method · 0.45

Tested by

no test coverage detected