MCPcopy Create free account
hub / github.com/Gadersd/stable-diffusion-burn / CLIPEncoderLayer

Class CLIPEncoderLayer

python/dump.py:406–424  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

404 return attn_output
405
406class CLIPEncoderLayer:
407 def __init__(self):
408 self.self_attn = CLIPAttention()
409 self.layer_norm1 = LayerNorm(768)
410 self.mlp = CLIPMLP()
411 self.layer_norm2 = LayerNorm(768)
412
413 def __call__(self, hidden_states, causal_attention_mask):
414 residual = hidden_states
415 hidden_states = self.layer_norm1(hidden_states)
416 hidden_states = self.self_attn(hidden_states, causal_attention_mask)
417 hidden_states = residual + hidden_states
418
419 residual = hidden_states
420 hidden_states = self.layer_norm2(hidden_states)
421 hidden_states = self.mlp(hidden_states)
422 hidden_states = residual + hidden_states
423
424 return hidden_states
425
426class CLIPEncoder:
427 def __init__(self):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected