pyvene.models.backpack_gpt2.modelings_backpack_gpt2

pyvene.models.backpack_gpt2.modelings_backpack_gpt2#

Classes

BackpackGPT2BaseModelOutput([hidden_states, ...])

BackpackGPT2Config([vocab_size, num_senses, ...])

This is the configuration class to store the configuration of a [GPT2Model] or a [TFGPT2Model]. It is used to instantiate a Backpack GPT-2 model according to the specified arguments, defining the model architecture. Configuration objects inherit from [GPT2Config] and can be used to control the model outputs. Read the documentation from [GPT2Config] for more information. Args: num_senses (int, optional, defaults to 16): The number of sense vectors to define for each word. sense_intermediate_scale (int, optional, defaults ot 4): The hidden dimensionality of the sense vector network. Example: ```python >>> from transformers import BackpackGPT2Config, BackpackGPT2Model >>> # Initializing a GPT2 configuration >>> configuration = BackpackGPT2Config() >>> # Initializing a model (with random weights) from the configuration >>> model = BackpackGPT2Model(configuration) >>> # Accessing the model configuration >>> configuration = model.config.

BackpackGPT2LMHeadModel(config)

BackpackGPT2LMHeadModelOutput([logits, ...])

BackpackGPT2Model(config)

BackpackGPT2PreTrainedModel(*inputs, **kwargs)

An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained models.

BackpackMLP(embed_dim, intermediate_dim, ...)

BackpackNoMixBlock(config)

BackpackSenseNetwork(config, num_senses[, ...])

BackpackWeightNetwork(num_senses, embed_dim)