MCPcopy Create free account

hub / github.com/google-deepmind/penzai / functions

Functions1,092 in github.com/google-deepmind/penzai

Methodeffect_protocol
(cls)
penzai/deprecated/v1/data_effects/side_input.py:213
Methodeffect_protocol
(cls)
penzai/deprecated/v1/data_effects/random.py:46
Methodeffect_protocol
(cls)
penzai/deprecated/v1/data_effects/random.py:63
Methodeffect_protocol
(cls)
penzai/deprecated/v1/data_effects/random.py:72
Methodeffect_protocol
(cls)
penzai/deprecated/v1/data_effects/random.py:90
Methodeffect_protocol
(cls)
penzai/deprecated/v1/data_effects/random.py:171
Methodeffect_protocol
(cls)
penzai/deprecated/v1/data_effects/random.py:261
Methodeffect_protocol
(cls)
penzai/deprecated/v1/data_effects/random.py:357
Functionembed_shared_state_requests
Embeds shared state requests into a tree. This function is the inverse of hoist_shared_state_requests, and can be used to re-embed the initial va
penzai/deprecated/v1/data_effects/local_state.py:634
Methodenable
Returns a stochastic, enabled version of this layer.
penzai/nn/dropout.py:124
Methodenable
Returns a stochastic, enabled version of this layer.
penzai/deprecated/v1/nn/dropout.py:127
Functionenable_interactive_context
Compatibility function: No-op for consistency with old Treescope API. Originally, global overrides for Penzai/Treescope ContextualValue objects n
penzai/treescope/_compatibility_setup.py:145
Methodequal_or_not_a_prefix
(keypath, _)
penzai/core/selectors.py:1074
Methodextract_vars
(self)
penzai/core/shapecheck.py:217
Methodf
(carry, x)
tests/core/named_axes_test.py:1129
Methodfilter
(self, record)
docs/conf.py:78
Functionfree_effect_types
Collects the effect types of all `EffectRequest` nodes in a (sub)model. Args: model_tree: A pytree for a model or submodel. Returns: A l
penzai/deprecated/v1/data_effects/effect_base.py:188
Functionfreeze_local_states
Embeds the given states into a handled model, and removes the handler. This function converts a functionalized stateful model into a single effectf
penzai/deprecated/v1/data_effects/local_state.py:499
Functionfreeze_params
r"""Version of `freeze_variables` that only freezes `Parameter`\ s.
penzai/core/variables.py:854
Functionfreeze_state_vars
r"""Version of `freeze_variables` that only freezes `StateVariable`\ s.
penzai/core/variables.py:896
Methodfrom_config
Constructs a RMS layer normalization layer. Args: name: The name of the layer. init_base_rng: The base RNG to use for initializing mo
penzai/nn/standardization.py:162
Methodfrom_config
Constructs an ``EmbeddingTable``. Args: name: The name of the layer. init_base_rng: The base RNG to use for initializing model parame
penzai/nn/embeddings.py:65
Methodfrom_config
Constructs an ``AddBias`` layer from a configuration. Args: name: The name of the layer. init_base_rng: The base RNG to use for initi
penzai/nn/linear_and_affine.py:658
Methodfrom_config
( cls, name: str, init_base_rng: jax.Array | None, input_axes: dict[str, int], o
penzai/nn/linear_and_affine.py:711
Methodfrom_config
( cls, init_base_rng: jax.Array | None, feature_sizes: list[int], drop_rate: float,
penzai/models/simple_mlp.py:61
Methodfrom_config
( cls, feature_sizes: list[int], drop_rate: float, activation_fn: Callable[[jax.Array]
penzai/deprecated/v1/example_models/simple_mlp.py:60
Methodfrom_config
Constructs an uninitialized Gemma feed-forward layer. Gemma's feedforward layer uses GELU-based gated linear units (GEGLU), as proposed by Sh
penzai/deprecated/v1/example_models/gemma/model_core.py:119
Methodfrom_config
Builds a ``GemmaTransformerBlock`` from a configuration. Args: config: The configuration of the Gemma model. Returns: A ``GemmaT
penzai/deprecated/v1/example_models/gemma/model_core.py:311
Methodfrom_config
Constructs an uninitialized transformer with the Gemma architecture. Args: config: The configuration of the Gemma model. Returns:
penzai/deprecated/v1/example_models/gemma/model_core.py:454
Methodfrom_config
Builds a TellIntermediate layer that writes to the given tag.
penzai/deprecated/v1/data_effects/side_output.py:232
Methodfrom_config
Constructs a RMS layer normalization layer. Args: across_axes: Names and lengths of the axes to normalize over. epsilon: Epsilon para
penzai/deprecated/v1/nn/standardization.py:187
Methodfrom_config
Creates an ``ApplyAttentionMask`` layer from a tag and a mask value. Args: mask_tag: Side input tag for the mask side input. This should be
penzai/deprecated/v1/nn/attention.py:57
Methodfrom_config
Constructs an ``EmbeddingTable`` with uninitialized parameters. Args: vocab_size: The size of the vocabulary. embedding_axes: A dicti
penzai/deprecated/v1/nn/embeddings.py:67
Methodfrom_config
Constructs an ``AddBias`` layer from a configuration. Args: biased_axes: Names and lengths for the axes in the input that the bias
penzai/deprecated/v1/nn/linear_and_affine.py:657
Methodfrom_config
( cls, input_axes: dict[str, int], output_axes: dict[str, int], parallel_axes: dict[st
penzai/deprecated/v1/nn/linear_and_affine.py:735
Methodfrom_pretrained
Constructs a ``GemmaTransformer`` from an official Gemma Flax checkpoint. The parameters of the loaded ``GemmaTransformer`` will be close to thos
penzai/deprecated/v1/example_models/gemma/model_core.py:510
Methodfrom_uncached
Transforms a `Transformer` into cached sampling mode. This constructor hot-swaps all `pz.nn.Attention` layers in the original model to enable
penzai/models/transformer/sampling_mode.py:145
Methodfrom_uncached
Transforms a `GemmaTransformer` into cached sampling mode. This constructor hot-swaps all `model_core.GemmaAttention` layers in the original
penzai/deprecated/v1/example_models/gemma/sampling_mode.py:240
Methodfrom_uncached
Builds a caching attention from an uncached attention. Args: original: The original attention layer that this block should replace. s
penzai/deprecated/v1/nn/attention.py:230
Methodfrom_uninitialized
Builds a ``ShareableUninitializedParameter`` equivalent to ``uninit``.
penzai/deprecated/v1/nn/parameters.py:405
Functionfull
Constructs a full named array with a given shape. Args: named_shape: Named shape for the result. fill_value: Value to fill the array with.
penzai/core/named_axes.py:1795
Functionfull_substitute_dimension_variables
Substitutes all dimension variables for their known values. Args: structure: A PyTree structure containing `ArraySpec` leaves. substitution
penzai/core/shapecheck.py:1144
Functiongemma_from_pretrained_checkpoint
Builds a Gemma model from a pretrained checkpoint. The parameters of the loaded ``Transformer`` will be close to those in the original checkpoint
penzai/models/transformer/variants/gemma.py:118
Methodget
(self)
penzai/deprecated/v1/data_effects/local_state.py:160
Methodget
(self)
penzai/deprecated/v1/data_effects/local_state.py:252
Functionget_dimension_variables
Returns a collection of all dimension variables in a structure. Args: structure: The structure to extract variables from. Usually a PyTree with
penzai/core/shapecheck.py:1106
Methodget_keypaths
Returns the collection of selected key paths.
penzai/core/selectors.py:257
Functionget_leaf
(leaf)
penzai/core/shapecheck.py:1124
Methodget_numpy_dtype
( self, array: named_axes.NamedArrayBase )
penzai/core/_treescope_handlers/named_axes_handlers.py:236
Methodget_sharding_info_for_array_data
( self, array: named_axes.NamedArrayBase )
penzai/core/_treescope_handlers/named_axes_handlers.py:244
Methodget_slot
Returns the slot that this variable is replaced with when unbound. The variable slot will uniquely identify this variable within a pytree.
penzai/core/variables.py:112
Methodget_slot
Returns the slot that this variable is replaced with when unbound. The `get_slot` method of a frozen variable should always return the same s
penzai/core/variables.py:146
Methodget_slot
(self)
penzai/core/variables.py:624
Methodget_slot
(self)
penzai/core/variables.py:755
Methodget_slot
(self)
penzai/core/variables.py:778
Functiongo
()
penzai/toolshed/unflaxify.py:443
Functiongo
()
penzai/toolshed/sharding_util.py:178
Functiongo
()
penzai/deprecated/v1/toolshed/unflaxify.py:407
Functiongo
(layer, argument)
penzai/deprecated/v1/toolshed/check_layers_by_tracing.py:100
Functiongo
()
penzai/deprecated/v1/toolshed/annotate_shapes.py:133
Methodgo
(node)
penzai/core/selectors.py:400
Methodgo
(x)
penzai/toolshed/model_rewiring.py:232
Methodgo
(rng)
penzai/nn/layer_stack.py:295
Methodgo
(value)
tests/core/named_axes_test.py:844
Functiongpt_neox_from_huggingface_model
Converts a GPT-NeoX model to a Penzai model. This function converts GPT-NeoX models from their HuggingFace implementations to Penzai. Note: Ch
penzai/models/transformer/variants/gpt_neox.py:354
Functionhandle_arraystructures
Renders ArraySpec and contained variables.
penzai/core/_treescope_handlers/shapecheck_handlers.py:93
Functionhandle_data_effects_objects
Handles data effects objects.
penzai/deprecated/v1/data_effects/_treescope_handlers.py:44
Functionhandle_layer
Renders a penzai layer. Layers render like Structs in general, except that they render with input and output structure annotations. Args:
penzai/nn/_treescope_handlers/layer_handler.py:29
Functionhandle_layers
Renders a penzai layer. Layers render like Structs in general. However: * The outermost layer is augmented with information about the set of fr
penzai/deprecated/v1/core/_treescope_handlers/layer_handler.py:44
Functionhandle_local_states
( body: layer_base.LayerLike, category: Category | None = None, category_predicate: Callable[[Cate
penzai/deprecated/v1/data_effects/local_state.py:327
Functionhandle_named_arrays
Renders NamedArrays.
penzai/core/_treescope_handlers/named_axes_handlers.py:93
Functionhandle_result
(leaf)
penzai/core/named_axes.py:316
Functionhandle_structs
Renders a penzai struct or layer. Differences in handling structs vs other dataclasses: * We use ``cls.from_attributes`` instead of ``penzai
penzai/core/_treescope_handlers/struct_handler.py:100
Methodhandler_id
(self)
penzai/deprecated/v1/data_effects/side_output.py:116
Methodhandler_id
(self)
penzai/deprecated/v1/data_effects/local_state.py:245
Methodhandler_id
(self)
penzai/deprecated/v1/data_effects/side_input.py:88
Methodhandler_id
Returns the ID of the handler that created this implementation.
penzai/deprecated/v1/data_effects/effect_base.py:437
Functionhandler_id_interceptor
( node: Any, path: str | None = None, *, handler_id: str, )
penzai/deprecated/v1/data_effects/_treescope_handlers.py:55
Methodhandling
Builds a ``CollectingSideOutputs`` that handles effects in this layer. Args: body: The layer to wrap. Usually will contain `SideOutputReque
penzai/deprecated/v1/data_effects/side_output.py:174
Methodhandling
Builds a `WithSideInputsFromInputTuple` handling effects in this layer. Args: body: The layer to wrap. Usually will contain `SideInputReque
penzai/deprecated/v1/data_effects/side_input.py:148
Methodhandling
Builds a ``WithConstantSideInputs`` that handles effects in this layer. Args: body: The layer to wrap. Usually will contain `SideInputReque
penzai/deprecated/v1/data_effects/side_input.py:230
Methodhandling
Builds a `WithStatefulRandomKey` that handles effects in this layer. Args: body: The layer to wrap. Usually will contain random effects in
penzai/deprecated/v1/data_effects/random.py:211
Methodhandling
Builds a `WithFrozenRandomState` that handles effects in this layer. Args: body: The layer to wrap. Usually will contain random effects in
penzai/deprecated/v1/data_effects/random.py:304
Functionhoist_constant_side_inputs
Extracts all constant side inputs from a tree so they can be re-handled. This function finds all `WithConstantSideInputs` handlers in a tree, and
penzai/deprecated/v1/data_effects/side_input.py:297
Functionhoist_shared_state_requests
r"""Hoists out the value of shared states in a pytree. This function is a helper for manipulating Penzai models that contain shared states. Ordin
penzai/deprecated/v1/data_effects/local_state.py:543
Functioninfer_or_check_handler_id
Tries to generate a unique handler ID from the structure of a subtree. Each handler in Penzai's effect system needs to have a unique ID that iden
penzai/deprecated/v1/data_effects/effect_base.py:268
Functioninitialize_parameters
Initializes all parameters in a model. Args: model: Model to initialize. prng_key: Key to use to initialize parameters. Returns: Cop
penzai/deprecated/v1/nn/parameters.py:636
Functioninitialize_parameters_sharded
Initializes the parameters of a model, sharded according to a mesh. Args: model: A model whose parameters we should initialize. Should usually
penzai/deprecated/v1/toolshed/sharding_util.py:34
Functioninline_anonymous_sequentials
Inlines instances of `Sequential` (not subclasses) into parent groups.
penzai/nn/grouping.py:327
Functioninline_anonymous_sequentials
Inlines instances of `Sequential` (not subclasses) into parent groups.
penzai/deprecated/v1/nn/grouping.py:323
Functioninner_fun
(*args, **kwargs)
penzai/core/variables.py:420
Methodinput_axes
The axis names and sizes that should appear in the input only.
penzai/nn/linear_and_affine.py:607
Methodinput_axes
The axis names and sizes that should appear in the input only.
penzai/deprecated/v1/nn/linear_and_affine.py:605
Methodinput_structure
(self)
penzai/deprecated/v1/example_models/gemma/model_core.py:443
Methodinput_structure
(self)
penzai/deprecated/v1/example_models/gemma/sampling_mode.py:225
Methodinput_structure
(self)
penzai/deprecated/v1/data_effects/side_output.py:139
Methodinput_structure
(self)
penzai/deprecated/v1/data_effects/local_state.py:309
Methodinput_structure
(self)
penzai/deprecated/v1/data_effects/side_input.py:118
Methodinput_structure
(self)
penzai/deprecated/v1/data_effects/random.py:113
Methodinput_structure
(self)
penzai/deprecated/v1/nn/grouping.py:210
← previousnext →501–600 of 1,092, ranked by callers