MCPcopy
hub / github.com/google-deepmind/gemma / apply

Method apply

gemma/gm/nn/_transformer_like.py:134–145  ·  view source on GitHub ↗

Applies a module method to variables and returns output and modified variables.

(
      self,
      variables: VariableDict,
      tokens: Int['*B L'],
      *,
      images: UInt8['*B N H W C'] | UInt8['*B H W C'] | None = None,
      cache: _config.Cache | None = None,
      positions: Int['*B L_with_mm'] | None = None,
      attention_mask: Bool['*B L_with_mm cache_length'] | None = None,
  )

Source from the content-addressed store, hash-verified

132 @typechecked
133 @abc.abstractmethod
134 def apply(
135 self,
136 variables: VariableDict,
137 tokens: Int['*B L'],
138 *,
139 images: UInt8['*B N H W C'] | UInt8['*B H W C'] | None = None,
140 cache: _config.Cache | None = None,
141 positions: Int['*B L_with_mm'] | None = None,
142 attention_mask: Bool['*B L_with_mm cache_length'] | None = None,
143 ) -> Any | tuple[Any, FrozenVariableDict | dict[str, Any]]:
144 """Applies a module method to variables and returns output and modified variables."""
145 ...
146
147 @typechecked
148 @abc.abstractmethod

Callers 15

_init_stateMethod · 0.80
_sample_stepMethod · 0.80
_init_and_applyFunction · 0.80
test_embedder_encodeFunction · 0.80
test_embedder_decodeFunction · 0.80
_get_attn_outputFunction · 0.80
test_sliding_windowFunction · 0.80
test_ffwFunction · 0.80
test_ffw_gradFunction · 0.80
test_blockFunction · 0.80

Calls

no outgoing calls

Tested by 15

_init_and_applyFunction · 0.64
test_embedder_encodeFunction · 0.64
test_embedder_decodeFunction · 0.64
_get_attn_outputFunction · 0.64
test_sliding_windowFunction · 0.64
test_ffwFunction · 0.64
test_ffw_gradFunction · 0.64
test_blockFunction · 0.64
test_einsumFunction · 0.64