text stringlengths 31 243k | type stringclasses 1
value | start int64 36 275k | end int64 286 280k | depth int64 0 1 | filepath stringlengths 85 188 | parent_class stringclasses 3
values | class_index int64 0 10.8k |
|---|---|---|---|---|---|---|---|
class Cohere2ForCausalLM(CohereForCausalLM):
def __init__(self, config: Cohere2Config):
super().__init__(config)
def prepare_inputs_for_generation(
self,
input_ids,
past_key_values=None,
attention_mask=None,
inputs_embeds=None,
cache_position=None,
... | class_definition | 24,606 | 28,518 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/cohere2/modular_cohere2.py | null | 5,600 |
class Cohere2Config(PretrainedConfig):
r"""
This is the configuration class to store the configuration of a [`CohereModel`]. It is used to instantiate an Cohere
model according to the specified arguments, defining the model architecture.
Configuration objects inherit from [`PretrainedConfig`] and can b... | class_definition | 1,568 | 11,597 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/cohere2/configuration_cohere2.py | null | 5,601 |
class DimensionInfo:
"""Wrapper for dimension info."""
batch_size: int # batch size
seq_len: int # token length
block_size: int # block size
num_heads: int # num heads
hidden_dim: int # hidden dim
dim_per_head: int # dim per head
num_blocks: int # num blocks
global_len: int ... | class_definition | 1,600 | 2,174 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/pegasus_x/modeling_pegasus_x.py | null | 5,602 |
class PegasusXScaledWordEmbedding(nn.Embedding):
"""
This module overrides nn.Embeddings' forward by multiplying with embeddings scale.
"""
def __init__(self, num_embeddings: int, embedding_dim: int, padding_idx: int, embed_scale: Optional[float] = 1.0):
super().__init__(num_embeddings, embeddi... | class_definition | 2,953 | 3,442 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/pegasus_x/modeling_pegasus_x.py | null | 5,603 |
class PegasusXSinusoidalPositionalEmbedding(nn.Module):
"""This module produces sinusoidal positional embeddings of any length."""
def __init__(self, embed_dim, max_scale: int = 10000.0):
super().__init__()
self.embed_dim = embed_dim
self.max_scale = max_scale
@torch.no_grad()
... | class_definition | 3,445 | 4,699 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/pegasus_x/modeling_pegasus_x.py | null | 5,604 |
class PegasusXAttention(nn.Module):
"""Multi-headed attention from 'Attention Is All You Need' paper"""
def __init__(
self,
embed_dim: int,
num_heads: int,
dropout: float = 0.0,
is_decoder: bool = False,
bias: bool = True,
is_causal: bool = False,
... | class_definition | 4,789 | 12,187 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/pegasus_x/modeling_pegasus_x.py | null | 5,605 |
class PegasusXGlobalLocalAttention(nn.Module):
"""Global + Local attention. For use with Encoder only."""
def __init__(
self,
embed_dim: int,
num_heads: int,
block_size: int,
dropout: float = 0.0,
is_decoder: bool = False,
):
super().__init__()
... | class_definition | 12,190 | 23,331 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/pegasus_x/modeling_pegasus_x.py | null | 5,606 |
class PegasusXEncoderLayer(nn.Module):
def __init__(self, stagger_blocks_this_layer: bool, config: PegasusXConfig):
super().__init__()
self.embed_dim = config.d_model
self.self_attn = PegasusXGlobalLocalAttention(
embed_dim=self.embed_dim,
num_heads=config.encoder_att... | class_definition | 23,334 | 28,667 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/pegasus_x/modeling_pegasus_x.py | null | 5,607 |
class PegasusXDecoderLayer(nn.Module):
def __init__(self, config: PegasusXConfig):
super().__init__()
self.embed_dim = config.d_model
self.self_attn = PegasusXAttention(
embed_dim=self.embed_dim,
num_heads=config.decoder_attention_heads,
dropout=config.at... | class_definition | 28,670 | 33,968 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/pegasus_x/modeling_pegasus_x.py | null | 5,608 |
class PegasusXPreTrainedModel(PreTrainedModel):
config_class = PegasusXConfig
base_model_prefix = "model"
supports_gradient_checkpointing = True
_no_split_modules = [r"PegasusXEncoderLayer", r"PegasusXDecoderLayer"]
def _init_weights(self, module):
std = self.config.init_std
if isin... | class_definition | 33,971 | 34,561 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/pegasus_x/modeling_pegasus_x.py | null | 5,609 |
class PegasusXEncoder(PegasusXPreTrainedModel):
"""
Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a
[`PegasusXEncoderLayer`].
Args:
config: PegasusXConfig
embed_tokens (nn.Embedding): output embedding
"""
def __init__(self, confi... | class_definition | 41,794 | 51,237 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/pegasus_x/modeling_pegasus_x.py | null | 5,610 |
class PegasusXDecoder(PegasusXPreTrainedModel):
"""
Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`PegasusDecoderLayer`]
Args:
config: PegasusXConfig
embed_tokens (nn.Embedding): output embedding
"""
def __init__(self, config: PegasusXConfig, em... | class_definition | 51,240 | 61,890 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/pegasus_x/modeling_pegasus_x.py | null | 5,611 |
class PegasusXModel(PegasusXPreTrainedModel):
_tied_weights_keys = ["encoder.embed_tokens.weight", "decoder.embed_tokens.weight"]
def __init__(self, config: PegasusXConfig):
super().__init__(config)
vocab_size = config.vocab_size
embed_scale = math.sqrt(config.d_model) if config.scale_... | class_definition | 62,044 | 68,572 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/pegasus_x/modeling_pegasus_x.py | null | 5,612 |
class PegasusXForConditionalGeneration(PegasusXPreTrainedModel, GenerationMixin):
base_model_prefix = "model"
_tied_weights_keys = ["encoder.embed_tokens.weight", "decoder.embed_tokens.weight", "lm_head.weight"]
def __init__(self, config: PegasusXConfig):
super().__init__(config)
self.model... | class_definition | 68,690 | 74,977 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/pegasus_x/modeling_pegasus_x.py | null | 5,613 |
class PegasusXDecoderWrapper(PegasusXPreTrainedModel):
"""
This wrapper class is a helper class to correctly load pretrained checkpoints when the causal language model is
used in combination with the [`EncoderDecoderModel`] framework.
"""
def __init__(self, config):
super().__init__(config)... | class_definition | 75,072 | 75,525 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/pegasus_x/modeling_pegasus_x.py | null | 5,614 |
class PegasusXConfig(PretrainedConfig):
r"""
This is the configuration class to store the configuration of a [`PegasusXModel`]. It is used to instantiate a
PEGASUS-X model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a ... | class_definition | 798 | 8,084 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/pegasus_x/configuration_pegasus_x.py | null | 5,615 |
class LayoutLMv2FeatureExtractor(LayoutLMv2ImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn(
"The class LayoutLMv2FeatureExtractor is deprecated and will be removed in version 5 of Transformers."
" Please use LayoutLMv2ImageProcessor instead.",
... | class_definition | 808 | 1,194 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/feature_extraction_layoutlmv2.py | null | 5,616 |
class LayoutLMv2Tokenizer(PreTrainedTokenizer):
r"""
Construct a LayoutLMv2 tokenizer. Based on WordPiece. [`LayoutLMv2Tokenizer`] can be used to turn words, word-level
bounding boxes and optional word labels to token-level `input_ids`, `attention_mask`, `token_type_ids`, `bbox`, and
optional `labels` (... | class_definition | 9,764 | 64,392 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/tokenization_layoutlmv2.py | null | 5,617 |
class BasicTokenizer:
"""
Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.).
Args:
do_lower_case (`bool`, *optional*, defaults to `True`):
Whether or not to lowercase the input when tokenizing.
never_split (`Iterable`, *opti... | class_definition | 64,467 | 71,215 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/tokenization_layoutlmv2.py | null | 5,618 |
class WordpieceTokenizer:
"""Runs WordPiece tokenization."""
def __init__(self, vocab, unk_token, max_input_chars_per_word=100):
self.vocab = vocab
self.unk_token = unk_token
self.max_input_chars_per_word = max_input_chars_per_word
def tokenize(self, text):
"""
Toke... | class_definition | 71,294 | 73,182 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/tokenization_layoutlmv2.py | null | 5,619 |
class LayoutLMv2Processor(ProcessorMixin):
r"""
Constructs a LayoutLMv2 processor which combines a LayoutLMv2 image processor and a LayoutLMv2 tokenizer into a
single processor.
[`LayoutLMv2Processor`] offers all the functionalities you need to prepare data for the model.
It first uses [`LayoutLMv... | class_definition | 905 | 9,291 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/processing_layoutlmv2.py | null | 5,620 |
class LayoutLMv2Embeddings(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
super(LayoutLMv2Embeddings, self).__init__()
self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size, padding_idx=config.pad_token_i... | class_definition | 1,688 | 4,036 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py | null | 5,621 |
class LayoutLMv2SelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
if config.hidden_size % config.num_attention_heads != 0 and not hasattr(config, "embedding_size"):
raise ValueError(
f"The hidden size ({config.hidden_size}) is not a multiple of the ... | class_definition | 4,039 | 8,115 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py | null | 5,622 |
class LayoutLMv2Attention(nn.Module):
def __init__(self, config):
super().__init__()
self.self = LayoutLMv2SelfAttention(config)
self.output = LayoutLMv2SelfOutput(config)
def forward(
self,
hidden_states,
attention_mask=None,
head_mask=None,
outp... | class_definition | 8,118 | 8,916 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py | null | 5,623 |
class LayoutLMv2SelfOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
... | class_definition | 8,919 | 9,487 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py | null | 5,624 |
class LayoutLMv2Intermediate(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isinstance(config.hidden_act, str):
self.intermediate_act_fn = ACT2FN[config.hidden_act]
else:
self.... | class_definition | 9,582 | 10,153 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py | null | 5,625 |
class LayoutLMv2Output(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
... | class_definition | 10,240 | 10,854 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py | null | 5,626 |
class LayoutLMv2Layer(nn.Module):
def __init__(self, config):
super().__init__()
self.chunk_size_feed_forward = config.chunk_size_feed_forward
self.seq_len_dim = 1
self.attention = LayoutLMv2Attention(config)
self.intermediate = LayoutLMv2Intermediate(config)
self.out... | class_definition | 10,857 | 12,257 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py | null | 5,627 |
class LayoutLMv2Encoder(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.layer = nn.ModuleList([LayoutLMv2Layer(config) for _ in range(config.num_hidden_layers)])
self.has_relative_attention_bias = config.has_relative_attention_bias
self.h... | class_definition | 14,383 | 19,709 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py | null | 5,628 |
class LayoutLMv2PreTrainedModel(PreTrainedModel):
"""
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
"""
config_class = LayoutLMv2Config
base_model_prefix = "layoutlmv2"
def _init_weights(self, module):
"""In... | class_definition | 19,712 | 21,007 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py | null | 5,629 |
class LayoutLMv2VisualBackbone(nn.Module):
def __init__(self, config):
super().__init__()
self.cfg = config.get_detectron2_config()
meta_arch = self.cfg.MODEL.META_ARCHITECTURE
model = META_ARCH_REGISTRY.get(meta_arch)(self.cfg)
assert isinstance(model.backbone, detectron2.mo... | class_definition | 22,208 | 25,398 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py | null | 5,630 |
class LayoutLMv2Pooler(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
def forward(self, hidden_states):
# We "pool" the model by simply taking the hidden state corresponding
... | class_definition | 29,393 | 29,928 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py | null | 5,631 |
class LayoutLMv2Model(LayoutLMv2PreTrainedModel):
def __init__(self, config):
requires_backends(self, "detectron2")
super().__init__(config)
self.config = config
self.has_visual_segment_embedding = config.has_visual_segment_embedding
self.embeddings = LayoutLMv2Embeddings(con... | class_definition | 30,096 | 40,821 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py | null | 5,632 |
class LayoutLMv2ForSequenceClassification(LayoutLMv2PreTrainedModel):
def __init__(self, config):
super().__init__(config)
self.num_labels = config.num_labels
self.layoutlmv2 = LayoutLMv2Model(config)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
self.classifier = nn.... | class_definition | 41,269 | 48,714 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py | null | 5,633 |
class LayoutLMv2ForTokenClassification(LayoutLMv2PreTrainedModel):
def __init__(self, config):
super().__init__(config)
self.num_labels = config.num_labels
self.layoutlmv2 = LayoutLMv2Model(config)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
self.classifier = nn.Lin... | class_definition | 49,185 | 54,060 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py | null | 5,634 |
class LayoutLMv2ForQuestionAnswering(LayoutLMv2PreTrainedModel):
def __init__(self, config, has_visual_segment_embedding=True):
super().__init__(config)
self.num_labels = config.num_labels
config.has_visual_segment_embedding = has_visual_segment_embedding
self.layoutlmv2 = LayoutLMv2... | class_definition | 54,416 | 61,910 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/modeling_layoutlmv2.py | null | 5,635 |
class LayoutLMv2ImageProcessor(BaseImageProcessor):
r"""
Constructs a LayoutLMv2 image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to `(size["height"], size["width"])`. Can be
overridden by `do... | class_definition | 3,533 | 13,454 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/image_processing_layoutlmv2.py | null | 5,636 |
class LayoutLMv2TokenizerFast(PreTrainedTokenizerFast):
r"""
Construct a "fast" LayoutLMv2 tokenizer (backed by HuggingFace's *tokenizers* library). Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should
refer to this superclas... | class_definition | 1,490 | 38,099 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/tokenization_layoutlmv2_fast.py | null | 5,637 |
class LayoutLMv2Config(PretrainedConfig):
r"""
This is the configuration class to store the configuration of a [`LayoutLMv2Model`]. It is used to instantiate an
LayoutLMv2 model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yi... | class_definition | 902 | 10,880 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/layoutlmv2/configuration_layoutlmv2.py | null | 5,638 |
class UniSpeechSatConfig(PretrainedConfig):
r"""
This is the configuration class to store the configuration of a [`UniSpeechSatModel`]. It is used to instantiate an
UniSpeechSat model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults w... | class_definition | 847 | 18,795 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/configuration_unispeech_sat.py | null | 5,639 |
class UniSpeechSatForPreTrainingOutput(ModelOutput):
"""
Output type of [`UniSpeechSatForPreTrainingOutput`], with potential hidden states and attentions.
Args:
loss (*optional*, returned when model is in train mode, `torch.FloatTensor` of shape `(1,)`):
Total loss as the sum of the con... | class_definition | 2,429 | 4,721 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,640 |
class UniSpeechSatNoLayerNormConvLayer(nn.Module):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0 else 1
self.out_conv_dim = config.conv_dim[layer_id]
self.conv = nn.Conv1d(
self.in_conv_dim,
... | class_definition | 10,056 | 10,789 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,641 |
class UniSpeechSatLayerNormConvLayer(nn.Module):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0 else 1
self.out_conv_dim = config.conv_dim[layer_id]
self.conv = nn.Conv1d(
self.in_conv_dim,
... | class_definition | 10,908 | 11,891 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,642 |
class UniSpeechSatGroupNormConvLayer(nn.Module):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0 else 1
self.out_conv_dim = config.conv_dim[layer_id]
self.conv = nn.Conv1d(
self.in_conv_dim,
... | class_definition | 12,010 | 12,911 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,643 |
class UniSpeechSatPositionalConvEmbedding(nn.Module):
def __init__(self, config):
super().__init__()
self.conv = nn.Conv1d(
config.hidden_size,
config.hidden_size,
kernel_size=config.num_conv_pos_embeddings,
padding=config.num_conv_pos_embeddings // 2,... | class_definition | 13,035 | 14,836 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,644 |
class UniSpeechSatSamePadLayer(nn.Module):
def __init__(self, num_conv_pos_embeddings):
super().__init__()
self.num_pad_remove = 1 if num_conv_pos_embeddings % 2 == 0 else 0
def forward(self, hidden_states):
if self.num_pad_remove > 0:
hidden_states = hidden_states[:, :, : -... | class_definition | 14,949 | 15,318 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,645 |
class UniSpeechSatFeatureEncoder(nn.Module):
"""Construct the features from raw audio waveform"""
def __init__(self, config):
super().__init__()
if config.feat_extract_norm == "group":
conv_layers = [UniSpeechSatGroupNormConvLayer(config, layer_id=0)] + [
UniSpeechS... | class_definition | 15,433 | 17,199 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,646 |
class UniSpeechSatFeatureExtractor(UniSpeechSatFeatureEncoder):
def __init__(self, config):
super().__init__(config)
warnings.warn(
f"The class `{self.__class__.__name__}` has been depreciated "
"and will be removed in Transformers v5. "
f"Use `{self.__class__.__b... | class_definition | 17,202 | 17,590 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,647 |
class UniSpeechSatFeatureProjection(nn.Module):
def __init__(self, config):
super().__init__()
self.layer_norm = nn.LayerNorm(config.conv_dim[-1], eps=config.layer_norm_eps)
self.projection = nn.Linear(config.conv_dim[-1], config.hidden_size)
self.dropout = nn.Dropout(config.feat_pro... | class_definition | 17,708 | 18,364 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,648 |
class UniSpeechSatAttention(nn.Module):
"""Multi-headed attention from 'Attention Is All You Need' paper"""
def __init__(
self,
embed_dim: int,
num_heads: int,
dropout: float = 0.0,
is_decoder: bool = False,
bias: bool = True,
is_causal: bool = False,
... | class_definition | 18,458 | 25,864 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,649 |
class UniSpeechSatFlashAttention2(UniSpeechSatAttention):
"""
UniSpeechSat flash attention module. This module inherits from `UniSpeechSatAttention` as the weights of the module stays
untouched. The only required change would be on the forward pass where it needs to correctly call the public API of
flas... | class_definition | 25,964 | 32,448 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,650 |
class UniSpeechSatSdpaAttention(UniSpeechSatAttention):
# Copied from transformers.models.bart.modeling_bart.BartSdpaAttention.forward with Bart->UniSpeechSat
def forward(
self,
hidden_states: torch.Tensor,
key_value_states: Optional[torch.Tensor] = None,
past_key_value: Optional... | class_definition | 32,451 | 38,367 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,651 |
class UniSpeechSatFeedForward(nn.Module):
def __init__(self, config):
super().__init__()
self.intermediate_dropout = nn.Dropout(config.activation_dropout)
self.intermediate_dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isinstance(config.hidden_act, str):
... | class_definition | 38,647 | 39,621 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,652 |
class UniSpeechSatEncoderLayer(nn.Module):
def __init__(self, config):
super().__init__()
self.attention = UNISPEECHSAT_ATTENTION_CLASSES[config._attn_implementation](
embed_dim=config.hidden_size,
num_heads=config.num_attention_heads,
dropout=config.attention_dro... | class_definition | 39,758 | 41,129 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,653 |
class UniSpeechSatAttnAdapterLayer(nn.Module):
def __init__(self, config):
"""
Implements adapter modules directly with 3D tensor weight as parameters and without using ModuleList to speed
up training throughput.
"""
super().__init__()
self.input_dim = config.adapter_... | class_definition | 41,246 | 42,131 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,654 |
class UniSpeechSatEncoderLayerStableLayerNorm(nn.Module):
def __init__(self, config):
super().__init__()
self.attention = UNISPEECHSAT_ATTENTION_CLASSES[config._attn_implementation](
embed_dim=config.hidden_size,
num_heads=config.num_attention_heads,
dropout=confi... | class_definition | 42,283 | 44,027 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,655 |
class UniSpeechSatEncoder(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.pos_conv_embed = UniSpeechSatPositionalConvEmbedding(config)
self.layer_norm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropout(... | class_definition | 44,135 | 47,983 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,656 |
class UniSpeechSatEncoderStableLayerNorm(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.pos_conv_embed = UniSpeechSatPositionalConvEmbedding(config)
self.layer_norm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropou... | class_definition | 48,106 | 52,123 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,657 |
class UniSpeechSatGumbelVectorQuantizer(nn.Module):
"""
Vector quantization using gumbel softmax. See [CATEGORICAL REPARAMETERIZATION WITH
GUMBEL-SOFTMAX](https://arxiv.org/pdf/1611.01144.pdf) for more information.
"""
def __init__(self, config):
super().__init__()
self.num_groups =... | class_definition | 52,126 | 55,220 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,658 |
class UniSpeechSatPreTrainedModel(PreTrainedModel):
"""
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
"""
config_class = UniSpeechSatConfig
base_model_prefix = "unispeech_sat"
main_input_name = "input_values"
sup... | class_definition | 55,223 | 58,810 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,659 |
class UniSpeechSatModel(UniSpeechSatPreTrainedModel):
def __init__(self, config: UniSpeechSatConfig):
super().__init__(config)
self.config = config
self.feature_extractor = UniSpeechSatFeatureEncoder(config)
self.feature_projection = UniSpeechSatFeatureProjection(config)
sel... | class_definition | 62,342 | 67,641 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,660 |
class UniSpeechSatForPreTraining(UniSpeechSatPreTrainedModel):
def __init__(self, config: UniSpeechSatConfig):
super().__init__(config)
self.unispeech_sat = UniSpeechSatModel(config)
self.dropout_features = nn.Dropout(config.feat_quantizer_dropout)
self.quantizer = UniSpeechSatGumbe... | class_definition | 67,762 | 73,649 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,661 |
class UniSpeechSatForCTC(UniSpeechSatPreTrainedModel):
def __init__(self, config, target_lang: Optional[str] = None):
super().__init__(config)
self.unispeech_sat = UniSpeechSatModel(config)
self.dropout = nn.Dropout(config.final_dropout)
self.target_lang = target_lang
if c... | class_definition | 74,305 | 81,174 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,662 |
class UniSpeechSatForSequenceClassification(UniSpeechSatPreTrainedModel):
def __init__(self, config):
super().__init__(config)
if hasattr(config, "add_adapter") and config.add_adapter:
raise ValueError(
"Sequence classification does not support the use of UniSpeechSat ad... | class_definition | 81,404 | 87,028 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,663 |
class UniSpeechSatForAudioFrameClassification(UniSpeechSatPreTrainedModel):
def __init__(self, config):
super().__init__(config)
if hasattr(config, "add_adapter") and config.add_adapter:
raise ValueError(
"Audio frame classification does not support the use of UniSpeechS... | class_definition | 87,386 | 91,854 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,664 |
class AMSoftmaxLoss(nn.Module):
def __init__(self, input_dim, num_labels, scale=30.0, margin=0.4):
super(AMSoftmaxLoss, self).__init__()
self.scale = scale
self.margin = margin
self.num_labels = num_labels
self.weight = nn.Parameter(torch.randn(input_dim, num_labels), require... | class_definition | 91,932 | 92,808 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,665 |
class TDNNLayer(nn.Module):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.tdnn_dim[layer_id - 1] if layer_id > 0 else config.tdnn_dim[layer_id]
self.out_conv_dim = config.tdnn_dim[layer_id]
self.kernel_size = config.tdnn_kernel[layer_id]
... | class_definition | 92,882 | 94,312 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,666 |
class UniSpeechSatForXVector(UniSpeechSatPreTrainedModel):
def __init__(self, config):
super().__init__(config)
self.unispeech_sat = UniSpeechSatModel(config)
num_layers = config.num_hidden_layers + 1 # transformer layers + input embeddings
if config.use_weighted_layer_sum:
... | class_definition | 94,661 | 100,867 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/unispeech_sat/modeling_unispeech_sat.py | null | 5,667 |
class T5Tokenizer(PreTrainedTokenizer):
"""
Construct a T5 tokenizer. Based on [SentencePiece](https://github.com/google/sentencepiece).
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this superclass for more information regarding tho... | class_definition | 1,255 | 19,990 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/tokenization_t5.py | null | 5,668 |
class T5TokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" T5 tokenizer (backed by HuggingFace's *tokenizers* library). Based on
[Unigram](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=unigram#models).
This tokenizer inherits from [`PreTrainedTokenizerFast`]... | class_definition | 1,179 | 10,167 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/tokenization_t5_fast.py | null | 5,669 |
class FlaxT5LayerNorm(nn.Module):
hidden_size: int
dtype: jnp.dtype = jnp.float32
eps: float = 1e-6
weight_init: Callable[..., np.ndarray] = jax.nn.initializers.ones
def setup(self):
self.weight = self.param("weight", self.weight_init, (self.hidden_size,))
def __call__(self, hidden_sta... | class_definition | 2,373 | 3,075 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_flax_t5.py | null | 5,670 |
class FlaxT5DenseActDense(nn.Module):
config: T5Config
dtype: jnp.dtype = jnp.float32
def setup(self):
wi_init_std = self.config.initializer_factor * (self.config.d_model**-0.5)
wo_init_std = self.config.initializer_factor * (self.config.d_ff**-0.5)
self.wi = nn.Dense(
... | class_definition | 3,078 | 4,166 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_flax_t5.py | null | 5,671 |
class FlaxT5DenseGatedActDense(nn.Module):
config: T5Config
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
def setup(self):
wi_init_std = self.config.initializer_factor * (self.config.d_model**-0.5)
wo_init_std = self.config.initializer_factor * (self.config.d_ff**-0.5)
... | class_definition | 4,169 | 5,547 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_flax_t5.py | null | 5,672 |
class FlaxT5LayerFF(nn.Module):
config: T5Config
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
def setup(self):
if self.config.is_gated_act:
self.DenseReluDense = FlaxT5DenseGatedActDense(self.config, dtype=self.dtype)
else:
self.DenseReluDense = Fla... | class_definition | 5,550 | 6,436 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_flax_t5.py | null | 5,673 |
class FlaxT5Attention(nn.Module):
config: T5Config
has_relative_attention_bias: bool = False
causal: bool = False
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
def setup(self):
self.relative_attention_num_buckets = self.config.relative_attention_num_buckets
self.rel... | class_definition | 6,439 | 19,501 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_flax_t5.py | null | 5,674 |
class FlaxT5LayerSelfAttention(nn.Module):
config: T5Config
has_relative_attention_bias: bool = False
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
def setup(self):
self.SelfAttention = FlaxT5Attention(
self.config,
has_relative_attention_bias=self.has_r... | class_definition | 19,504 | 20,892 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_flax_t5.py | null | 5,675 |
class FlaxT5LayerCrossAttention(nn.Module):
config: T5Config
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
def setup(self):
self.EncDecAttention = FlaxT5Attention(
self.config, has_relative_attention_bias=False, causal=False, dtype=self.dtype
)
self.laye... | class_definition | 20,895 | 22,136 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_flax_t5.py | null | 5,676 |
class FlaxT5Block(nn.Module):
config: T5Config
has_relative_attention_bias: bool = False
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
def setup(self):
self.causal = self.config.causal
self.layer = (
FlaxT5LayerSelfAttention(
self.config,
... | class_definition | 22,139 | 24,822 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_flax_t5.py | null | 5,677 |
class FlaxT5LayerCollection(nn.Module):
config: T5Config
has_relative_attention_bias: bool
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
def setup(self):
self.layer = FlaxT5Block(
self.config, has_relative_attention_bias=self.has_relative_attention_bias, dtype=self.... | class_definition | 24,825 | 25,946 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_flax_t5.py | null | 5,678 |
class FlaxT5BlockCollection(nn.Module):
config: T5Config
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
gradient_checkpointing: bool = False
def setup(self):
self.causal = self.config.causal
if self.gradient_checkpointing:
FlaxT5CheckpointLayer = remat(FlaxT5... | class_definition | 25,949 | 29,150 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_flax_t5.py | null | 5,679 |
class FlaxT5Stack(nn.Module):
config: T5Config
embed_tokens: nn.Embed
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
gradient_checkpointing: bool = False
def setup(self):
self.causal = self.config.causal
self.block = FlaxT5BlockCollection(
self.config, d... | class_definition | 29,153 | 31,554 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_flax_t5.py | null | 5,680 |
class FlaxT5PreTrainedModel(FlaxPreTrainedModel):
"""
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
"""
config_class = T5Config
base_model_prefix = "transformer"
module_class: nn.Module = None
def __init__(
... | class_definition | 39,284 | 51,812 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_flax_t5.py | null | 5,681 |
class FlaxT5Module(nn.Module):
config: T5Config
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
gradient_checkpointing: bool = False
def _get_encoder_module(self):
return self.encoder
def _get_decoder_module(self):
return self.decoder
def setup(self):
se... | class_definition | 54,428 | 57,505 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_flax_t5.py | null | 5,682 |
class FlaxT5Model(FlaxT5PreTrainedModel):
module_class = FlaxT5Module | class_definition | 57,508 | 57,581 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_flax_t5.py | null | 5,683 |
class FlaxT5EncoderModule(nn.Module):
config: T5Config
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
gradient_checkpointing: bool = False
def setup(self):
self.shared = nn.Embed(
self.config.vocab_size,
self.config.d_model,
embedding_init=jax... | class_definition | 59,002 | 60,446 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_flax_t5.py | null | 5,684 |
class FlaxT5EncoderModel(FlaxT5PreTrainedModel):
module_class = FlaxT5EncoderModule
@add_start_docstrings_to_model_forward(T5_ENCODE_INPUTS_DOCSTRING)
def __call__(
self,
input_ids: jnp.ndarray,
attention_mask: Optional[jnp.ndarray] = None,
output_attentions: Optional[bool] ... | class_definition | 60,449 | 61,979 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_flax_t5.py | null | 5,685 |
class FlaxT5ForConditionalGenerationModule(nn.Module):
config: T5Config
dtype: jnp.dtype = jnp.float32 # the dtype of the computation
gradient_checkpointing: bool = False
def _get_encoder_module(self):
return self.encoder
def _get_decoder_module(self):
return self.decoder
def... | class_definition | 62,080 | 66,118 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_flax_t5.py | null | 5,686 |
class FlaxT5ForConditionalGeneration(FlaxT5PreTrainedModel):
module_class = FlaxT5ForConditionalGenerationModule
@add_start_docstrings(T5_DECODE_INPUTS_DOCSTRING)
@replace_return_docstrings(output_type=FlaxCausalLMOutputWithCrossAttentions, config_class=T5Config)
def decode(
self,
decod... | class_definition | 66,121 | 73,188 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_flax_t5.py | null | 5,687 |
class T5LayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-6):
"""
Construct a layernorm module in the T5 style. No bias and no subtraction of mean.
"""
super().__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self.variance_epsilon = eps
d... | class_definition | 9,192 | 10,285 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_t5.py | null | 5,688 |
class T5DenseActDense(nn.Module):
def __init__(self, config: T5Config):
super().__init__()
self.wi = nn.Linear(config.d_model, config.d_ff, bias=False)
self.wo = nn.Linear(config.d_ff, config.d_model, bias=False)
self.dropout = nn.Dropout(config.dropout_rate)
self.act = ACT2F... | class_definition | 10,705 | 11,564 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_t5.py | null | 5,689 |
class T5DenseGatedActDense(nn.Module):
def __init__(self, config: T5Config):
super().__init__()
self.wi_0 = nn.Linear(config.d_model, config.d_ff, bias=False)
self.wi_1 = nn.Linear(config.d_model, config.d_ff, bias=False)
self.wo = nn.Linear(config.d_ff, config.d_model, bias=False)
... | class_definition | 11,567 | 12,854 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_t5.py | null | 5,690 |
class T5LayerFF(nn.Module):
def __init__(self, config: T5Config):
super().__init__()
if config.is_gated_act:
self.DenseReluDense = T5DenseGatedActDense(config)
else:
self.DenseReluDense = T5DenseActDense(config)
self.layer_norm = T5LayerNorm(config.d_model, e... | class_definition | 12,857 | 13,523 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_t5.py | null | 5,691 |
class T5Attention(nn.Module):
def __init__(
self,
config: T5Config,
has_relative_attention_bias=False,
layer_idx: Optional[int] = None,
):
super().__init__()
self.is_decoder = config.is_decoder
self.has_relative_attention_bias = has_relative_attention_bias... | class_definition | 13,526 | 24,758 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_t5.py | null | 5,692 |
class T5LayerSelfAttention(nn.Module):
def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int] = None):
super().__init__()
self.SelfAttention = T5Attention(
config, has_relative_attention_bias=has_relative_attention_bias, layer_idx=layer_idx
)
... | class_definition | 24,761 | 26,111 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_t5.py | null | 5,693 |
class T5LayerCrossAttention(nn.Module):
def __init__(self, config, layer_idx: Optional[int] = None):
super().__init__()
self.EncDecAttention = T5Attention(config, has_relative_attention_bias=False, layer_idx=layer_idx)
self.layer_norm = T5LayerNorm(config.d_model, eps=config.layer_norm_epsil... | class_definition | 26,114 | 27,527 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_t5.py | null | 5,694 |
class T5Block(nn.Module):
def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int] = None):
super().__init__()
self.is_decoder = config.is_decoder
self.layer = nn.ModuleList()
self.layer.append(
T5LayerSelfAttention(config, has_relative_atten... | class_definition | 27,530 | 31,667 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_t5.py | null | 5,695 |
class T5ClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config: T5Config):
super().__init__()
self.dense = nn.Linear(config.d_model, config.d_model)
self.dropout = nn.Dropout(p=config.classifier_dropout)
self.out_proj = nn.Li... | class_definition | 31,670 | 32,384 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_t5.py | null | 5,696 |
class T5PreTrainedModel(PreTrainedModel):
"""
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
"""
config_class = T5Config
load_tf_weights = load_tf_weights_in_t5
base_model_prefix = "transformer"
is_parallelizable ... | class_definition | 32,387 | 38,806 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_t5.py | null | 5,697 |
class T5Stack(T5PreTrainedModel):
def __init__(self, config, embed_tokens=None):
super().__init__(config)
self.embed_tokens = embed_tokens
self.is_decoder = config.is_decoder
self.block = nn.ModuleList(
[T5Block(config, has_relative_attention_bias=bool(i == 0), layer_id... | class_definition | 38,809 | 59,871 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_t5.py | null | 5,698 |
class T5Model(T5PreTrainedModel):
_keys_to_ignore_on_load_unexpected = [
"decoder.block.0.layer.1.EncDecAttention.relative_attention_bias.weight",
]
_tied_weights_keys = ["encoder.embed_tokens.weight", "decoder.embed_tokens.weight"]
def __init__(self, config: T5Config):
super().__init__... | class_definition | 70,287 | 79,305 | 0 | /Users/nielsrogge/Documents/python_projecten/transformers/src/transformers/models/t5/modeling_t5.py | null | 5,699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.