id int64 0 328k | repository_name stringlengths 7 58 | file_path stringlengths 9 302 | class_name stringlengths 5 256 | human_written_code stringlengths 16 2.16M | class_skeleton stringlengths 18 1.49M ⌀ | total_program_units int64 1 1.76k | total_doc_str int64 0 771 | AvgCountLine float64 0 7.89k | AvgCountLineBlank float64 0 297 | AvgCountLineCode float64 0 7.89k | AvgCountLineComment float64 0 7.89k | AvgCyclomatic float64 0 130 | CommentToCodeRatio float64 0 168 | CountClassBase float64 0 40 | CountClassCoupled float64 0 583 | CountClassCoupledModified float64 0 575 | CountClassDerived float64 0 5.35k | CountDeclInstanceMethod float64 0 529 | CountDeclInstanceVariable float64 0 296 | CountDeclMethod float64 0 599 | CountDeclMethodAll float64 0 1.12k | CountLine float64 1 40.4k | CountLineBlank float64 0 8.16k | CountLineCode float64 1 25.7k | CountLineCodeDecl float64 1 8.15k | CountLineCodeExe float64 0 24.2k | CountLineComment float64 0 16.5k | CountStmt float64 1 9.71k | CountStmtDecl float64 1 8.15k | CountStmtExe float64 0 9.69k | MaxCyclomatic float64 0 759 | MaxInheritanceTree float64 0 16 | MaxNesting float64 0 34 | SumCyclomatic float64 0 2.9k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5,300 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speech_to_text/modeling_speech_to_text.py | transformers.models.speech_to_text.modeling_speech_to_text.Speech2TextPreTrainedModel | from .configuration_speech_to_text import Speech2TextConfig
from torch import nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
import torch
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
@auto_docstring
class Speech2TextPreTrainedModel(PreTrainedModel):
config: ... | @auto_docstring
class Speech2TextPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass
def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTensor):
'''
Computes the output length of the convolutional layers
'''
pass
def _get_featur... | 5 | 1 | 12 | 1 | 8 | 2 | 3 | 0.23 | 1 | 1 | 0 | 4 | 3 | 0 | 3 | 3 | 43 | 6 | 30 | 12 | 26 | 7 | 27 | 12 | 23 | 5 | 1 | 2 | 9 |
5,301 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speech_to_text/modeling_speech_to_text.py | transformers.models.speech_to_text.modeling_speech_to_text.Speech2TextSinusoidalPositionalEmbedding | from torch import nn
import math
import torch
from typing import Callable, Optional, Union
class Speech2TextSinusoidalPositionalEmbedding(nn.Module):
"""This module produces sinusoidal positional embeddings of any length."""
def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]... |
class Speech2TextSinusoidalPositionalEmbedding(nn.Module):
'''This module produces sinusoidal positional embeddings of any length.'''
def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]=None):
pass
def make_weights(self, num_embeddings: int, embedding_dim: int, p... | 8 | 3 | 12 | 1 | 8 | 3 | 2 | 0.4 | 1 | 3 | 0 | 0 | 4 | 4 | 5 | 15 | 68 | 9 | 42 | 22 | 32 | 17 | 36 | 18 | 30 | 3 | 1 | 1 | 9 |
5,302 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speech_to_text/processing_speech_to_text.py | transformers.models.speech_to_text.processing_speech_to_text.Speech2TextProcessor | from ...processing_utils import ProcessorMixin
from contextlib import contextmanager
import warnings
class Speech2TextProcessor(ProcessorMixin):
"""
Constructs a Speech2Text processor which wraps a Speech2Text feature extractor and a Speech2Text tokenizer into a
single processor.
[`Speech2TextProcesso... |
class Speech2TextProcessor(ProcessorMixin):
'''
Constructs a Speech2Text processor which wraps a Speech2Text feature extractor and a Speech2Text tokenizer into a
single processor.
[`Speech2TextProcessor`] offers all the functionalities of [`Speech2TextFeatureExtractor`] and
[`Speech2TextTokenizer`]... | 5 | 3 | 14 | 1 | 9 | 4 | 3 | 0.65 | 1 | 2 | 0 | 0 | 5 | 2 | 5 | 22 | 93 | 12 | 49 | 16 | 42 | 32 | 41 | 15 | 35 | 9 | 2 | 1 | 13 |
5,303 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speech_to_text/tokenization_speech_to_text.py | transformers.models.speech_to_text.tokenization_speech_to_text.Speech2TextTokenizer | from pathlib import Path
from shutil import copyfile
import os
from typing import Any, Optional, Union
from ...tokenization_utils import PreTrainedTokenizer
from ...utils.import_utils import requires
@requires(backends=('sentencepiece',))
class Speech2TextTokenizer(PreTrainedTokenizer):
"""
Construct an Speech... | @requires(backends=('sentencepiece',))
class Speech2TextTokenizer(PreTrainedTokenizer):
'''
Construct an Speech2Text tokenizer.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains some of the main methods. Users should refer to
the superclass for more information regarding such methods.
... | 20 | 6 | 11 | 1 | 8 | 1 | 2 | 0.45 | 1 | 6 | 0 | 0 | 15 | 13 | 15 | 104 | 227 | 37 | 131 | 66 | 95 | 59 | 89 | 45 | 73 | 5 | 3 | 2 | 31 |
5,304 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/configuration_speecht5.py | transformers.models.speecht5.configuration_speecht5.SpeechT5Config | import functools
import operator
from ...configuration_utils import PretrainedConfig
class SpeechT5Config(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`SpeechT5Model`]. It is used to instantiate a
SpeechT5 model according to the specified arguments, defining the m... |
class SpeechT5Config(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`SpeechT5Model`]. It is used to instantiate a
SpeechT5 model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a s... | 3 | 1 | 73 | 5 | 68 | 1 | 2 | 1.1 | 1 | 3 | 0 | 0 | 2 | 54 | 2 | 2 | 311 | 19 | 139 | 119 | 76 | 153 | 63 | 59 | 60 | 2 | 1 | 1 | 3 |
5,305 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/configuration_speecht5.py | transformers.models.speecht5.configuration_speecht5.SpeechT5HifiGanConfig | from ...configuration_utils import PretrainedConfig
class SpeechT5HifiGanConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`SpeechT5HifiGanModel`]. It is used to instantiate
a SpeechT5 HiFi-GAN vocoder model according to the specified arguments, defining the mod... |
class SpeechT5HifiGanConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`SpeechT5HifiGanModel`]. It is used to instantiate
a SpeechT5 HiFi-GAN vocoder model according to the specified arguments, defining the model architecture.
Instantiating a configuration w... | 2 | 1 | 25 | 0 | 25 | 0 | 1 | 1.63 | 1 | 1 | 0 | 0 | 1 | 10 | 1 | 1 | 80 | 9 | 27 | 26 | 12 | 44 | 14 | 13 | 12 | 1 | 1 | 0 | 1 |
5,306 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/feature_extraction_speecht5.py | transformers.models.speecht5.feature_extraction_speecht5.SpeechT5FeatureExtractor | from ...audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function
from ...utils import PaddingStrategy, TensorType, logging
import warnings
import numpy as np
from typing import Any, Optional, Union
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extr... |
class SpeechT5FeatureExtractor(SequenceFeatureExtractor):
'''
Constructs a SpeechT5 feature extractor.
This class can pre-process a raw speech signal by (optionally) normalizing to zero-mean unit-variance, for use by
the SpeechT5 speech encoder prenet.
This class can also extract log-mel filter ban... | 8 | 4 | 52 | 6 | 37 | 9 | 6 | 0.43 | 1 | 12 | 1 | 0 | 5 | 19 | 6 | 23 | 363 | 44 | 223 | 91 | 170 | 96 | 98 | 44 | 91 | 14 | 3 | 3 | 33 |
5,307 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5Attention | import torch
from torch import nn
from typing import Optional, Union
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
class SpeechT5Attention(nn.Module):
"""
Multi-headed attention from 'Attention Is All You Need' paper with relative position ... |
class SpeechT5Attention(nn.Module):
'''
Multi-headed attention from 'Attention Is All You Need' paper with relative position bias (see
https://aclanthology.org/N18-2074.pdf)
'''
def __init__(self, embed_dim: int, num_heads: int, dropout: Optional[float]=0.0, is_decoder: Optional[bool]=False, bias:... | 4 | 2 | 50 | 7 | 35 | 8 | 5 | 0.25 | 1 | 6 | 0 | 0 | 3 | 10 | 3 | 13 | 158 | 24 | 107 | 43 | 87 | 27 | 71 | 27 | 67 | 13 | 1 | 2 | 16 |
5,308 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5BatchNormConvLayer | from torch import nn
class SpeechT5BatchNormConvLayer(nn.Module):
def __init__(self, config, layer_id=0):
super().__init__()
if layer_id == 0:
in_conv_dim = config.num_mel_bins
else:
in_conv_dim = config.speech_decoder_postnet_units
if layer_id == config.spe... |
class SpeechT5BatchNormConvLayer(nn.Module):
def __init__(self, config, layer_id=0):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 18 | 3 | 16 | 0 | 3 | 0 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 38 | 6 | 32 | 9 | 29 | 0 | 22 | 9 | 19 | 4 | 1 | 1 | 6 |
5,309 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5Decoder | from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_causal_attention_mask
from typing import Optional, Union
from torch import nn
from .configuration_speecht5 import SpeechT5Config, SpeechT5HifiGanConfig
from ...integrations.fsdp import is_fsdp_managed_module
from ...modeling_outputs import ... |
class SpeechT5Decoder(SpeechT5PreTrainedModel):
'''
Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`SpeechT5DecoderLayer`]
'''
def __init__(self, config: SpeechT5Config):
pass
def forward(self, hidden_states: Optional[torch.FloatTensor]=None, attention_... | 3 | 2 | 100 | 16 | 57 | 28 | 17 | 0.51 | 1 | 11 | 3 | 0 | 2 | 3 | 2 | 3 | 205 | 33 | 114 | 33 | 98 | 58 | 56 | 20 | 53 | 33 | 2 | 3 | 34 |
5,310 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5DecoderLayer | from typing import Optional, Union
from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from .configuration_speecht5 import SpeechT5Config, SpeechT5HifiGanConfig
from ...utils.deprecation import deprecate_kwarg
c... |
class SpeechT5DecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: SpeechT5Config, layer_idx=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, encode... | 4 | 1 | 52 | 6 | 34 | 13 | 4 | 0.36 | 1 | 6 | 3 | 0 | 2 | 7 | 2 | 12 | 106 | 12 | 69 | 28 | 55 | 25 | 35 | 17 | 32 | 6 | 1 | 1 | 7 |
5,311 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5DecoderWithSpeechPrenet | import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqSpectrogramOutput
from typing import Optional, Union
from .configuration_speecht5 import SpeechT5Config, SpeechT5HifiGanConfig
from ...cache_utils import Cache, DynamicCac... |
class SpeechT5DecoderWithSpeechPrenet(SpeechT5PreTrainedModel):
'''
Wrapper around SpeechT5Decoder that applies SpeechT5SpeechDecoderPrenet to convert log-mel filterbanks to hidden
features.
'''
def __init__(self, config: SpeechT5Config):
pass
def forward(self, input_values: Optional[... | 3 | 1 | 20 | 2 | 18 | 1 | 1 | 0.14 | 1 | 7 | 4 | 0 | 2 | 2 | 2 | 3 | 46 | 5 | 36 | 21 | 19 | 5 | 10 | 7 | 7 | 1 | 2 | 0 | 2 |
5,312 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5DecoderWithTextPrenet | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqSpectrogramOutput
from .configuration_speecht5 import SpeechT5Config, SpeechT5HifiGanConfig
from typing import Optional, Union
from ...cache_utils import Cache, DynamicCache, EncoderDe... |
class SpeechT5DecoderWithTextPrenet(SpeechT5PreTrainedModel):
'''
Wrapper around SpeechT5Decoder that applies SpeechT5TextDecoderPrenet to convert input tokens to hidden features.
'''
def __init__(self, config: SpeechT5Config):
pass
def get_input_embeddings(self):
pass
def se... | 5 | 1 | 11 | 1 | 10 | 0 | 1 | 0.1 | 1 | 7 | 4 | 0 | 4 | 2 | 4 | 5 | 50 | 7 | 39 | 22 | 21 | 4 | 14 | 9 | 9 | 1 | 2 | 0 | 4 |
5,313 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5DecoderWithoutPrenet | from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from .configuration_speecht5 import SpeechT5Config, SpeechT5HifiGanConfig
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqSpectrogramOutput
from typing import Optio... |
class SpeechT5DecoderWithoutPrenet(SpeechT5PreTrainedModel):
'''
This wrapper class is a helper class to correctly load pretrained checkpoints when used in combination with
[`SpeechT5Model`].
'''
def __init__(self, config: SpeechT5Config):
pass
def forward(self, input_values: Optional... | 3 | 1 | 17 | 1 | 16 | 1 | 1 | 0.15 | 1 | 6 | 3 | 0 | 2 | 1 | 2 | 3 | 41 | 3 | 33 | 18 | 17 | 5 | 8 | 5 | 5 | 1 | 2 | 0 | 2 |
5,314 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5Encoder | import torch
from torch import nn
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqSpectrogramOutput
from ...integrations.deepspeed import is_deepspeed_zero3_enabled
from typing import Optional, Union
from ...integrations.fsdp import... |
class SpeechT5Encoder(SpeechT5PreTrainedModel):
'''
Transformer encoder consisting of *config.encoder_layers* layers. Each layer is a [`SpeechT5EncoderLayer`].
'''
def __init__(self, config: SpeechT5Config):
pass
def forward(self, hidden_states: torch.FloatTensor, attention_mask: Optional... | 3 | 2 | 65 | 11 | 39 | 15 | 11 | 0.41 | 1 | 11 | 4 | 0 | 2 | 6 | 2 | 3 | 135 | 24 | 79 | 25 | 68 | 32 | 46 | 17 | 43 | 20 | 2 | 3 | 21 |
5,315 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5EncoderLayer | import torch
from torch import nn
from typing import Optional, Union
from .configuration_speecht5 import SpeechT5Config, SpeechT5HifiGanConfig
from ...modeling_layers import GradientCheckpointingLayer
class SpeechT5EncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: SpeechT5Config):
super... |
class SpeechT5EncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: SpeechT5Config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, layer_head_mask: Optional[torch.Tensor]=None, position_bias: Optional[torch.Tensor]=None, output_attenti... | 3 | 1 | 29 | 3 | 19 | 8 | 2 | 0.39 | 1 | 6 | 3 | 0 | 2 | 5 | 2 | 12 | 59 | 6 | 38 | 18 | 28 | 15 | 20 | 11 | 17 | 2 | 1 | 1 | 3 |
5,316 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5EncoderWithSpeechPrenet | import torch
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqSpectrogramOutput
from .configuration_speecht5 import SpeechT5Config, SpeechT5HifiGanConfig
class SpeechT5EncoderWithSpeechPrenet(Speec... |
class SpeechT5EncoderWithSpeechPrenet(SpeechT5PreTrainedModel):
'''
Wrapper around SpeechT5Encoder that applies SpeechT5SpeechEncoderPrenet to convert the audio waveform data to
hidden features.
'''
def __init__(self, config: SpeechT5Config):
pass
def forward(self, input_values: torch... | 3 | 1 | 14 | 2 | 12 | 1 | 1 | 0.2 | 1 | 7 | 4 | 0 | 2 | 2 | 2 | 3 | 35 | 5 | 25 | 15 | 14 | 5 | 10 | 7 | 7 | 1 | 2 | 0 | 2 |
5,317 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5EncoderWithTextPrenet | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqSpectrogramOutput
from .configuration_speecht5 import SpeechT5Config, SpeechT5HifiGanConfig
import torch
from typing import Optional, Union
class SpeechT5EncoderWithTextPrenet(SpeechT... |
class SpeechT5EncoderWithTextPrenet(SpeechT5PreTrainedModel):
'''
Wrapper around SpeechT5Encoder that applies SpeechT5TextEncoderPrenet to convert the input_ids to hidden features.
'''
def __init__(self, config: SpeechT5Config):
pass
def get_input_embeddings(self):
pass
def s... | 5 | 1 | 8 | 1 | 7 | 0 | 1 | 0.14 | 1 | 7 | 4 | 0 | 4 | 2 | 4 | 5 | 40 | 7 | 29 | 17 | 16 | 4 | 14 | 9 | 9 | 1 | 2 | 0 | 4 |
5,318 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5EncoderWithoutPrenet | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqSpectrogramOutput
from .configuration_speecht5 import SpeechT5Config, SpeechT5HifiGanConfig
from typing import Optional, Union
import torch
class SpeechT5EncoderWithoutPrenet(SpeechT5... |
class SpeechT5EncoderWithoutPrenet(SpeechT5PreTrainedModel):
'''
This wrapper class is a helper class to correctly load pretrained checkpoints when used in combination with
[`SpeechT5Model`].
'''
def __init__(self, config: SpeechT5Config):
pass
def forward(self, input_values: torch.Fl... | 3 | 1 | 12 | 1 | 11 | 1 | 1 | 0.23 | 1 | 6 | 3 | 0 | 2 | 1 | 2 | 3 | 30 | 3 | 22 | 12 | 11 | 5 | 7 | 4 | 4 | 1 | 2 | 0 | 2 |
5,319 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5FeatureEncoder | from torch import nn
class SpeechT5FeatureEncoder(nn.Module):
"""Construct the features from raw audio waveform"""
def __init__(self, config):
super().__init__()
if config.feat_extract_norm == 'group':
conv_layers = [SpeechT5GroupNormConvLayer(config, layer_id=0)] + [SpeechT5NoLaye... |
class SpeechT5FeatureEncoder(nn.Module):
'''Construct the features from raw audio waveform'''
def __init__(self, config):
pass
def _freeze_parameters(self):
pass
def forward(self, input_values):
pass | 4 | 1 | 13 | 1 | 11 | 0 | 3 | 0.06 | 1 | 6 | 3 | 0 | 3 | 3 | 3 | 13 | 44 | 7 | 35 | 11 | 31 | 2 | 23 | 11 | 19 | 4 | 1 | 2 | 9 |
5,320 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5FeatureProjection | from torch import nn
class SpeechT5FeatureProjection(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.Drop... |
class SpeechT5FeatureProjection(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.09 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 13 | 1 | 11 | 7 | 8 | 1 | 11 | 7 | 8 | 1 | 1 | 0 | 2 |
5,321 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5FeedForward | from ...activations import ACT2FN
from torch import nn
class SpeechT5FeedForward(nn.Module):
def __init__(self, config, intermediate_size):
super().__init__()
self.intermediate_dropout = nn.Dropout(config.activation_dropout)
self.intermediate_dense = nn.Linear(config.hidden_size, intermedi... |
class SpeechT5FeedForward(nn.Module):
def __init__(self, config, intermediate_size):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 10 | 2 | 9 | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 2 | 5 | 2 | 12 | 22 | 4 | 18 | 8 | 15 | 0 | 17 | 8 | 14 | 2 | 1 | 1 | 3 |
5,322 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5ForSpeechToSpeech | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqSpectrogramOutput
from typing import Optional, Union
from ...utils import auto_docstring, logging
from .configuration_speecht5 import SpeechT5Config, SpeechT5HifiGanConfig
from torch i... | @auto_docstring(custom_intro='\n SpeechT5 Model with a speech encoder and a speech decoder.\n ')
class SpeechT5ForSpeechToSpeech(SpeechT5PreTrainedModel):
def __init__(self, config: SpeechT5Config):
pass
def get_encoder(self):
pass
def get_decoder(self):
pass
def freeze... | 10 | 3 | 37 | 4 | 16 | 17 | 2 | 1 | 1 | 10 | 6 | 0 | 6 | 2 | 6 | 7 | 230 | 30 | 100 | 46 | 61 | 100 | 30 | 15 | 23 | 6 | 2 | 2 | 12 |
5,323 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5ForSpeechToText | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqSpectrogramOutput
from .configuration_speecht5 import SpeechT5Config, SpeechT5HifiGanConfig
from typing import Optional, Union
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss,... | @auto_docstring(custom_intro='\n SpeechT5 Model with a speech encoder and a text decoder.\n ')
class SpeechT5ForSpeechToText(SpeechT5PreTrainedModel, GenerationMixin):
def __init__(self, config: SpeechT5Config):
pass
def get_encoder(self):
pass
def get_decoder(self):
pass
... | 10 | 2 | 23 | 3 | 13 | 6 | 2 | 0.48 | 1 | 11 | 6 | 0 | 8 | 2 | 9 | 10 | 217 | 38 | 122 | 53 | 82 | 58 | 49 | 24 | 39 | 7 | 2 | 2 | 19 |
5,324 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5ForTextToSpeech | import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from .configuration_speecht5 import SpeechT5Config, SpeechT5HifiGanConfig
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, S... | @auto_docstring(custom_intro='\n SpeechT5 Model with a text encoder and a speech decoder.\n ')
class SpeechT5ForTextToSpeech(SpeechT5PreTrainedModel):
def __init__(self, config: SpeechT5Config):
pass
@classmethod
def can_generate(cls) -> bool:
pass
def get_encoder(self):
... | 13 | 3 | 54 | 5 | 26 | 23 | 3 | 0.88 | 1 | 12 | 7 | 0 | 6 | 2 | 6 | 7 | 338 | 38 | 160 | 63 | 108 | 140 | 48 | 19 | 41 | 8 | 2 | 3 | 20 |
5,325 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5GroupNormConvLayer | from ...activations import ACT2FN
from ...modeling_layers import GradientCheckpointingLayer
from torch import nn
class SpeechT5GroupNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0... |
class SpeechT5GroupNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 10 | 1 | 9 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 5 | 2 | 12 | 22 | 3 | 19 | 8 | 16 | 0 | 13 | 8 | 10 | 2 | 1 | 0 | 3 |
5,326 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5GuidedMultiheadAttentionLoss | import torch
from torch import nn
from .configuration_speecht5 import SpeechT5Config, SpeechT5HifiGanConfig
class SpeechT5GuidedMultiheadAttentionLoss(nn.Module):
"""
Guided attention loss from the paper [Efficiently Trainable Text-to-Speech System Based on Deep Convolutional
Networks with Guided Attention... |
class SpeechT5GuidedMultiheadAttentionLoss(nn.Module):
'''
Guided attention loss from the paper [Efficiently Trainable Text-to-Speech System Based on Deep Convolutional
Networks with Guided Attention](https://huggingface.co/papers/1710.08969), adapted for multi-head attention.
'''
def __init__(sel... | 6 | 2 | 12 | 2 | 7 | 3 | 1 | 0.52 | 1 | 5 | 1 | 0 | 3 | 2 | 4 | 14 | 57 | 10 | 31 | 19 | 23 | 16 | 24 | 16 | 19 | 2 | 1 | 1 | 5 |
5,327 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5HifiGan | from ...utils import auto_docstring, logging
from ...modeling_utils import EmbeddingAccessMixin, PreTrainedModel
from .configuration_speecht5 import SpeechT5Config, SpeechT5HifiGanConfig
import torch
from torch import nn
@auto_docstring(custom_intro='\n HiFi-GAN vocoder.\n ')
class SpeechT5HifiGan(PreTrainedMode... | @auto_docstring(custom_intro='\n HiFi-GAN vocoder.\n ')
class SpeechT5HifiGan(PreTrainedModel):
def __init__(self, config: SpeechT5HifiGanConfig):
pass
def _init_weights(self, module: nn.Module):
'''Initialize the weights.'''
pass
def apply_weight_norm(self):
pass
... | 8 | 2 | 21 | 3 | 15 | 3 | 4 | 0.2 | 1 | 6 | 2 | 0 | 5 | 6 | 5 | 5 | 115 | 20 | 79 | 26 | 73 | 16 | 64 | 26 | 58 | 6 | 1 | 2 | 20 |
5,328 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5LayerNormConvLayer | from ...modeling_layers import GradientCheckpointingLayer
from torch import nn
from ...activations import ACT2FN
class SpeechT5LayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id > 0... |
class SpeechT5LayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 12 | 2 | 10 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 5 | 2 | 12 | 25 | 4 | 21 | 8 | 18 | 0 | 15 | 8 | 12 | 2 | 1 | 0 | 3 |
5,329 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5Model | import torch
from torch import nn
from ...utils import auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput, Seq2SeqSpectrogramOutput
from typing import Optional, Union
from .configuration_speecht5 import SpeechT5Config, ... | @auto_docstring(custom_intro='\n The bare SpeechT5 Encoder-Decoder Model outputting raw hidden-states without any specific pre- or post-nets.\n ')
class SpeechT5Model(SpeechT5PreTrainedModel):
def __init__(self, config: SpeechT5Config, encoder: Optional[nn.Module]=None, decoder: Optional[nn.Module]=None):
... | 9 | 3 | 19 | 1 | 15 | 3 | 4 | 0.19 | 1 | 13 | 9 | 0 | 7 | 3 | 7 | 8 | 142 | 16 | 106 | 36 | 75 | 20 | 43 | 14 | 35 | 12 | 2 | 1 | 25 |
5,330 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5NoLayerNormConvLayer | from ...activations import ACT2FN
from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
class SpeechT5NoLayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
super().__init__()
self.in_conv_dim = config.conv_dim[layer_id - 1] if layer_id >... |
class SpeechT5NoLayerNormConvLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_id=0):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 9 | 1 | 8 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 19 | 2 | 17 | 7 | 14 | 0 | 11 | 7 | 8 | 2 | 1 | 0 | 3 |
5,331 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5PositionalConvEmbedding | from ...activations import ACT2FN
from ...integrations.deepspeed import is_deepspeed_zero3_enabled
from torch import nn
class SpeechT5PositionalConvEmbedding(nn.Module):
def __init__(self, config):
super().__init__()
self.conv = nn.Conv1d(config.hidden_size, config.hidden_size, kernel_size=config.... |
class SpeechT5PositionalConvEmbedding(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 21 | 3 | 18 | 0 | 3 | 0 | 1 | 2 | 1 | 0 | 2 | 3 | 2 | 12 | 43 | 7 | 36 | 10 | 32 | 0 | 28 | 10 | 24 | 4 | 1 | 2 | 5 |
5,332 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5PreTrainedModel | from .configuration_speecht5 import SpeechT5Config, SpeechT5HifiGanConfig
import math
from ...modeling_utils import EmbeddingAccessMixin, PreTrainedModel
from torch import nn
from ...utils import auto_docstring, logging
@auto_docstring
class SpeechT5PreTrainedModel(PreTrainedModel):
config: SpeechT5Config
base... | @auto_docstring
class SpeechT5PreTrainedModel(PreTrainedModel):
def _init_weights(self, module: nn.Module):
'''Initialize the weights'''
pass | 3 | 1 | 29 | 0 | 28 | 1 | 10 | 0.15 | 1 | 2 | 2 | 12 | 1 | 0 | 1 | 1 | 40 | 2 | 33 | 7 | 31 | 5 | 24 | 7 | 22 | 10 | 1 | 2 | 10 |
5,333 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5RelativePositionalEncoding | import torch
class SpeechT5RelativePositionalEncoding(torch.nn.Module):
def __init__(self, dim, max_length=1000):
super().__init__()
self.dim = dim
self.max_length = max_length
self.pe_k = torch.nn.Embedding(2 * max_length, dim)
def forward(self, hidden_states):
seq_le... |
class SpeechT5RelativePositionalEncoding(torch.nn.Module):
def __init__(self, dim, max_length=1000):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 8 | 1 | 7 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 17 | 3 | 14 | 8 | 11 | 0 | 14 | 8 | 11 | 1 | 1 | 0 | 2 |
5,334 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5SamePadLayer | from torch import nn
class SpeechT5SamePadLayer(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 = hidd... |
class SpeechT5SamePadLayer(nn.Module):
def __init__(self, num_conv_pos_embeddings):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 9 | 1 | 8 | 4 | 5 | 0 | 8 | 4 | 5 | 2 | 1 | 1 | 4 |
5,335 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5ScaledPositionalEncoding | import torch
import math
from torch import nn
class SpeechT5ScaledPositionalEncoding(nn.Module):
"""
Scaled positional encoding, see §3.2 in https://huggingface.co/papers/1809.08895
"""
def __init__(self, dropout, dim, max_len=5000):
pe = torch.zeros(max_len, dim)
position = torch.aran... |
class SpeechT5ScaledPositionalEncoding(nn.Module):
'''
Scaled positional encoding, see §3.2 in https://huggingface.co/papers/1809.08895
'''
def __init__(self, dropout, dim, max_len=5000):
pass
def forward(self, emb):
pass | 3 | 1 | 8 | 0 | 8 | 0 | 1 | 0.18 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 22 | 2 | 17 | 9 | 14 | 3 | 17 | 9 | 14 | 1 | 1 | 0 | 2 |
5,336 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5SinusoidalPositionalEmbedding | from torch import nn
import math
from typing import Optional, Union
import torch
class SpeechT5SinusoidalPositionalEmbedding(nn.Module):
"""This module produces sinusoidal positional embeddings of any length."""
def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]=None):
... |
class SpeechT5SinusoidalPositionalEmbedding(nn.Module):
'''This module produces sinusoidal positional embeddings of any length.'''
def __init__(self, num_positions: int, embedding_dim: int, padding_idx: Optional[int]=None):
pass
def make_weights(self, num_embeddings: int, embedding_dim: int, padd... | 8 | 3 | 12 | 1 | 8 | 3 | 2 | 0.4 | 1 | 3 | 0 | 0 | 4 | 4 | 5 | 15 | 68 | 9 | 42 | 22 | 32 | 17 | 36 | 18 | 30 | 3 | 1 | 1 | 9 |
5,337 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5SpectrogramLoss | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, L1Loss
import torch
from torch import nn
from typing import Optional, Union
from .configuration_speecht5 import SpeechT5Config, SpeechT5HifiGanConfig
class SpeechT5SpectrogramLoss(nn.Module):
"""
Loss computation used by SpeechT5ForTextToSpeech.
"""... |
class SpeechT5SpectrogramLoss(nn.Module):
'''
Loss computation used by SpeechT5ForTextToSpeech.
'''
def __init__(self, config: SpeechT5Config):
pass
def forward(self, attention_mask: torch.LongTensor, outputs_before_postnet: torch.FloatTensor, outputs_after_postnet: torch.FloatTensor, log... | 3 | 1 | 27 | 5 | 19 | 3 | 3 | 0.23 | 1 | 4 | 2 | 0 | 2 | 6 | 2 | 12 | 59 | 11 | 39 | 27 | 28 | 9 | 31 | 19 | 28 | 3 | 1 | 2 | 5 |
5,338 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5SpeechDecoderPostnet | import torch
from torch import nn
class SpeechT5SpeechDecoderPostnet(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.feat_out = nn.Linear(config.hidden_size, config.num_mel_bins * config.reduction_factor)
self.prob_out = nn.Linear(config.hidden_... |
class SpeechT5SpeechDecoderPostnet(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor):
pass
def postnet(self, hidden_states: torch.Tensor):
pass | 4 | 0 | 7 | 1 | 6 | 0 | 1 | 0 | 1 | 4 | 1 | 0 | 3 | 4 | 3 | 13 | 23 | 4 | 19 | 13 | 15 | 0 | 17 | 13 | 13 | 2 | 1 | 1 | 4 |
5,339 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5SpeechDecoderPrenet | import torch
from torch import nn
from typing import Optional, Union
class SpeechT5SpeechDecoderPrenet(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.layers = nn.ModuleList([nn.Linear(config.num_mel_bins if i == 0 else config.speech_decoder_prenet_unit... |
class SpeechT5SpeechDecoderPrenet(nn.Module):
def __init__(self, config):
pass
def _consistent_dropout(self, inputs_embeds, p):
pass
def forward(self, input_values: torch.Tensor, speaker_embeddings: Optional[torch.Tensor]=None):
pass | 4 | 0 | 16 | 2 | 13 | 0 | 2 | 0.02 | 1 | 4 | 1 | 0 | 3 | 5 | 3 | 13 | 50 | 8 | 41 | 17 | 33 | 1 | 25 | 13 | 21 | 3 | 1 | 1 | 6 |
5,340 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5SpeechEncoderPrenet | from typing import Optional, Union
import torch
from torch import nn
class SpeechT5SpeechEncoderPrenet(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.feature_encoder = SpeechT5FeatureEncoder(config)
self.feature_projection = SpeechT5FeatureProj... |
class SpeechT5SpeechEncoderPrenet(nn.Module):
def __init__(self, config):
pass
def freeze_feature_encoder(self):
pass
def forward(self, input_values: torch.Tensor, attention_mask: Optional[torch.LongTensor]=None, mask_time_indices: Optional[torch.FloatTensor]=None):
pass
def... | 8 | 2 | 18 | 2 | 13 | 3 | 2 | 0.23 | 1 | 9 | 4 | 0 | 6 | 6 | 6 | 16 | 133 | 22 | 90 | 35 | 72 | 21 | 56 | 25 | 48 | 5 | 1 | 1 | 15 |
5,341 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5TextDecoderPostnet | import torch
from torch import nn
from ...modeling_utils import EmbeddingAccessMixin, PreTrainedModel
class SpeechT5TextDecoderPostnet(nn.Module, EmbeddingAccessMixin):
def __init__(self, config):
super().__init__()
self.config = config
self.lm_head = nn.Linear(config.hidden_size, config.v... |
class SpeechT5TextDecoderPostnet(nn.Module, EmbeddingAccessMixin):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, new_embeddings):
pass | 5 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 4 | 2 | 4 | 14 | 14 | 3 | 11 | 7 | 6 | 0 | 11 | 7 | 6 | 1 | 1 | 0 | 4 |
5,342 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5TextDecoderPrenet | from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
import math
from torch import nn
from typing import Optional, Union
from ...modeling_utils import EmbeddingAccessMixin, PreTrainedModel
import torch
class SpeechT5TextDecoderPrenet(nn.Module, EmbeddingAccessMixin):
def __init__(self, config):
... |
class SpeechT5TextDecoderPrenet(nn.Module, EmbeddingAccessMixin):
def __init__(self, config):
pass
def forward(self, input_ids: torch.Tensor, attention_mask: Optional[torch.LongTensor]=None, past_key_values: Optional[Cache]=None):
pass | 3 | 0 | 9 | 1 | 8 | 0 | 2 | 0 | 1 | 4 | 1 | 0 | 4 | 5 | 4 | 14 | 41 | 8 | 33 | 19 | 23 | 0 | 23 | 14 | 18 | 3 | 1 | 1 | 7 |
5,343 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/modeling_speecht5.py | transformers.models.speecht5.modeling_speecht5.SpeechT5TextEncoderPrenet | import torch
from torch import nn
from ...modeling_utils import EmbeddingAccessMixin, PreTrainedModel
class SpeechT5TextEncoderPrenet(nn.Module, EmbeddingAccessMixin):
def __init__(self, config):
super().__init__()
self.config = config
self.embed_tokens = nn.Embedding(config.vocab_size, co... |
class SpeechT5TextEncoderPrenet(nn.Module, EmbeddingAccessMixin):
def __init__(self, config):
pass
def forward(self, input_ids: torch.Tensor):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 4 | 3 | 4 | 14 | 21 | 3 | 18 | 9 | 13 | 0 | 14 | 9 | 9 | 1 | 1 | 0 | 4 |
5,344 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/number_normalizer.py | transformers.models.speecht5.number_normalizer.EnglishNumberNormalizer | import re
class EnglishNumberNormalizer:
def __init__(self):
self.ones = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
self.teens = ['', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']
self.tens = ['', 't... |
class EnglishNumberNormalizer:
def __init__(self):
pass
def spell_number(self, num):
pass
def convert(self, number):
'''
Converts an individual number passed in string form to spelt-out form
'''
pass
def __call__(self, text):
'''
Conve... | 5 | 2 | 42 | 5 | 34 | 4 | 7 | 0.12 | 0 | 3 | 0 | 0 | 4 | 5 | 4 | 4 | 173 | 21 | 136 | 31 | 131 | 16 | 80 | 31 | 75 | 15 | 0 | 5 | 27 |
5,345 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/processing_speecht5.py | transformers.models.speecht5.processing_speecht5.SpeechT5Processor | from ...processing_utils import ProcessorMixin
class SpeechT5Processor(ProcessorMixin):
"""
Constructs a SpeechT5 processor which wraps a feature extractor and a tokenizer into a single processor.
[`SpeechT5Processor`] offers all the functionalities of [`SpeechT5FeatureExtractor`] and [`SpeechT5Tokenizer`... |
class SpeechT5Processor(ProcessorMixin):
'''
Constructs a SpeechT5 processor which wraps a feature extractor and a tokenizer into a single processor.
[`SpeechT5Processor`] offers all the functionalities of [`SpeechT5FeatureExtractor`] and [`SpeechT5Tokenizer`]. See
the docstring of [`~SpeechT5Processor... | 4 | 3 | 29 | 5 | 16 | 8 | 5 | 0.56 | 1 | 3 | 0 | 0 | 5 | 0 | 5 | 22 | 164 | 31 | 85 | 24 | 79 | 48 | 69 | 24 | 63 | 11 | 2 | 2 | 24 |
5,346 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/speecht5/tokenization_speecht5.py | transformers.models.speecht5.tokenization_speecht5.SpeechT5Tokenizer | from ...utils.import_utils import requires
from ...tokenization_utils import PreTrainedTokenizer
from .number_normalizer import EnglishNumberNormalizer
import os
from shutil import copyfile
from typing import Any, Optional
import sentencepiece as spm
@requires(backends=('sentencepiece',))
class SpeechT5Tokenizer(PreTr... | @requires(backends=('sentencepiece',))
class SpeechT5Tokenizer(PreTrainedTokenizer):
'''
Construct a SpeechT5 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
... | 20 | 6 | 8 | 0 | 7 | 1 | 2 | 0.39 | 1 | 7 | 1 | 0 | 15 | 6 | 15 | 104 | 186 | 29 | 113 | 51 | 82 | 44 | 84 | 35 | 68 | 5 | 3 | 3 | 30 |
5,347 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/configuration_splinter.py | transformers.models.splinter.configuration_splinter.SplinterConfig | from ...configuration_utils import PretrainedConfig
class SplinterConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`SplinterModel`]. It is used to instantiate an
Splinter model according to the specified arguments, defining the model architecture. Instantiating... |
class SplinterConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`SplinterModel`]. It is used to instantiate an
Splinter model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a ... | 2 | 1 | 35 | 1 | 34 | 0 | 1 | 1.39 | 1 | 1 | 0 | 0 | 1 | 14 | 1 | 1 | 97 | 11 | 36 | 35 | 16 | 50 | 18 | 17 | 16 | 1 | 1 | 0 | 1 |
5,348 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/modeling_splinter.py | transformers.models.splinter.modeling_splinter.QuestionAwareSpanSelectionHead | from torch import nn
import torch
class QuestionAwareSpanSelectionHead(nn.Module):
"""
Implementation of Question-Aware Span Selection (QASS) head, described in Splinter's paper:
"""
def __init__(self, config):
super().__init__()
self.query_start_transform = SplinterFullyConnectedLaye... |
class QuestionAwareSpanSelectionHead(nn.Module):
'''
Implementation of Question-Aware Span Selection (QASS) head, described in Splinter's paper:
'''
def __init__(self, config):
pass
def forward(self, inputs, positions):
pass | 3 | 1 | 15 | 3 | 12 | 4 | 1 | 0.46 | 1 | 2 | 1 | 0 | 2 | 6 | 2 | 12 | 36 | 9 | 24 | 19 | 21 | 11 | 24 | 19 | 21 | 1 | 1 | 0 | 2 |
5,349 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/modeling_splinter.py | transformers.models.splinter.modeling_splinter.SplinterAttention | from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
import torch
from torch import nn
from typing import Callable, Optional, Union
class SplinterAttention(nn.Module):
def __init__(self, config):
super().__init__()
self.self = SplinterSelfAtt... |
class SplinterAttention(nn.Module):
def __init__(self, config):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=False, *... | 4 | 0 | 15 | 1 | 14 | 1 | 1 | 0.07 | 1 | 5 | 1 | 0 | 3 | 3 | 3 | 13 | 49 | 4 | 43 | 20 | 30 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
5,350 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/modeling_splinter.py | transformers.models.splinter.modeling_splinter.SplinterEmbeddings | import torch
from typing import Callable, Optional, Union
from torch import nn
class SplinterEmbeddings(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
super().__init__()
self.word_embeddings = nn.Embedding(config.vocab_size... |
class SplinterEmbeddings(nn.Module):
'''Construct the embeddings from word, position and token_type embeddings.'''
def __init__(self, config):
pass
def forward(self, input_ids: Optional[torch.LongTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids: Optional[torch.LongTenso... | 3 | 1 | 24 | 4 | 19 | 2 | 4 | 0.1 | 1 | 2 | 0 | 0 | 2 | 6 | 2 | 12 | 52 | 9 | 39 | 21 | 29 | 4 | 29 | 14 | 26 | 6 | 1 | 1 | 7 |
5,351 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/modeling_splinter.py | transformers.models.splinter.modeling_splinter.SplinterEncoder | from torch import nn
from ...modeling_outputs import BaseModelOutput, ModelOutput, QuestionAnsweringModelOutput
from ...utils import auto_docstring, can_return_tuple, logging
from typing import Callable, Optional, Union
import torch
class SplinterEncoder(nn.Module):
def __init__(self, config):
super().__i... |
class SplinterEncoder(nn.Module):
def __init__(self, config):
pass
@can_return_tuple
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=False, output_hidden_states: Optional... | 4 | 0 | 45 | 4 | 41 | 0 | 9 | 0 | 1 | 8 | 2 | 0 | 2 | 3 | 2 | 12 | 91 | 8 | 83 | 26 | 68 | 0 | 35 | 14 | 32 | 17 | 1 | 3 | 18 |
5,352 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/modeling_splinter.py | transformers.models.splinter.modeling_splinter.SplinterForPreTraining | import torch
from ...utils import auto_docstring, can_return_tuple, logging
from torch.nn import CrossEntropyLoss
from typing import Callable, Optional, Union
@auto_docstring(custom_intro='\n Splinter Model for the recurring span selection task as done during the pretraining. The difference to the QA task\n is t... | @auto_docstring(custom_intro='\n Splinter Model for the recurring span selection task as done during the pretraining. The difference to the QA task\n is that we do not have a question, but multiple question tokens that replace the occurrences of recurring spans\n instead.\n ')
class SplinterForPreTraining(S... | 6 | 1 | 40 | 4 | 28 | 8 | 4 | 0.26 | 1 | 7 | 3 | 0 | 3 | 3 | 3 | 4 | 126 | 14 | 89 | 39 | 68 | 23 | 41 | 22 | 37 | 9 | 2 | 1 | 11 |
5,353 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/modeling_splinter.py | transformers.models.splinter.modeling_splinter.SplinterForPreTrainingOutput | import torch
from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutput, ModelOutput, QuestionAnsweringModelOutput
from ...utils import auto_docstring, can_return_tuple, logging
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro='\n Class for outputs of Splin... | @dataclass
@auto_docstring(custom_intro='\n Class for outputs of Splinter as a span selection model.\n ')
class SplinterForPreTrainingOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when start and end positions are provided):
Total span extraction loss is t... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 29 | 4 | 6 | 6 | 5 | 19 | 6 | 6 | 5 | 0 | 1 | 0 | 0 |
5,354 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/modeling_splinter.py | transformers.models.splinter.modeling_splinter.SplinterForQuestionAnswering | import torch
from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutput, ModelOutput, QuestionAnsweringModelOutput
from torch.nn import CrossEntropyLoss
from ...utils import auto_docstring, can_return_tuple, logging
@auto_docstring
class SplinterForQuestionAnswering(SplinterPreTrained... | @auto_docstring
class SplinterForQuestionAnswering(SplinterPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, position_ids: Optional[to... | 5 | 1 | 52 | 6 | 38 | 9 | 6 | 0.22 | 1 | 6 | 3 | 0 | 2 | 3 | 2 | 3 | 112 | 12 | 82 | 32 | 59 | 18 | 41 | 17 | 38 | 11 | 2 | 2 | 12 |
5,355 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/modeling_splinter.py | transformers.models.splinter.modeling_splinter.SplinterFullyConnectedLayer | from ...activations import ACT2FN
from torch import nn
import torch
class SplinterFullyConnectedLayer(nn.Module):
def __init__(self, input_dim, output_dim, hidden_act='gelu'):
super().__init__()
self.input_dim = input_dim
self.output_dim = output_dim
self.dense = nn.Linear(self.inp... |
class SplinterFullyConnectedLayer(nn.Module):
def __init__(self, input_dim, output_dim, hidden_act='gelu'):
pass
def forward(self, inputs: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 7 | 1 | 6 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 5 | 2 | 12 | 16 | 3 | 13 | 9 | 10 | 0 | 13 | 9 | 10 | 1 | 1 | 0 | 2 |
5,356 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/modeling_splinter.py | transformers.models.splinter.modeling_splinter.SplinterIntermediate | from ...activations import ACT2FN
from torch import nn
import torch
class SplinterIntermediate(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.intermediat... |
class SplinterIntermediate(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 12 | 5 | 9 | 0 | 11 | 5 | 8 | 2 | 1 | 1 | 3 |
5,357 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/modeling_splinter.py | transformers.models.splinter.modeling_splinter.SplinterLayer | from ...modeling_layers import GradientCheckpointingLayer
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
import torch
from typing import Callable, Optional, Union
class SplinterLayer(GradientCheckpointingLayer):
def __init__(self, config):
supe... |
class SplinterLayer(GradientCheckpointingLayer):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=False, **kwargs) -> tuple[torch.Tensor]:
... | 4 | 0 | 27 | 2 | 23 | 2 | 4 | 0.1 | 1 | 7 | 3 | 0 | 3 | 8 | 3 | 13 | 84 | 9 | 70 | 32 | 57 | 7 | 41 | 23 | 37 | 7 | 1 | 2 | 11 |
5,358 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/modeling_splinter.py | transformers.models.splinter.modeling_splinter.SplinterModel | from ...modeling_outputs import BaseModelOutput, ModelOutput, QuestionAnsweringModelOutput
from ...utils import auto_docstring, can_return_tuple, logging
from typing import Callable, Optional, Union
import torch
@auto_docstring
class SplinterModel(SplinterPreTrainedModel):
"""
The model is an encoder (with onl... | @auto_docstring
class SplinterModel(SplinterPreTrainedModel):
'''
The model is an encoder (with only self-attention) following the architecture described in [Attention is all you
need](https://huggingface.co/papers/1706.03762) by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones,
A... | 9 | 3 | 28 | 3 | 19 | 7 | 4 | 0.38 | 1 | 7 | 3 | 0 | 5 | 3 | 5 | 6 | 157 | 19 | 100 | 37 | 73 | 38 | 49 | 21 | 43 | 16 | 2 | 2 | 21 |
5,359 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/modeling_splinter.py | transformers.models.splinter.modeling_splinter.SplinterOutput | import torch
from torch import nn
class SplinterOutput(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.Drop... |
class SplinterOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
5,360 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/modeling_splinter.py | transformers.models.splinter.modeling_splinter.SplinterPreTrainedModel | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from torch import nn
from ...utils import auto_docstring, can_return_tuple, logging
from .configuration_splinter import SplinterConfig
@auto_docstring
class SplinterPreTrainedModel(PreTrainedModel):
config: SplinterConfig
base_model_prefix ... | @auto_docstring
class SplinterPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.5 | 1 | 0 | 0 | 3 | 1 | 0 | 1 | 1 | 26 | 2 | 16 | 5 | 14 | 8 | 14 | 5 | 12 | 6 | 1 | 2 | 6 |
5,361 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/modeling_splinter.py | transformers.models.splinter.modeling_splinter.SplinterSelfAttention | from torch import nn
import torch
from typing import Callable, Optional, Union
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
class SplinterSelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
if config.hidden_size % config.num_attention_heads != 0 and (... |
class SplinterSelfAttention(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=False, **kwargs) -> tuple[torch.Tensor]:
pas... | 3 | 0 | 43 | 7 | 31 | 6 | 6 | 0.19 | 1 | 5 | 0 | 0 | 3 | 11 | 3 | 13 | 132 | 22 | 93 | 44 | 80 | 18 | 72 | 35 | 68 | 13 | 1 | 2 | 17 |
5,362 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/modeling_splinter.py | transformers.models.splinter.modeling_splinter.SplinterSelfOutput | from torch import nn
import torch
class SplinterSelfOutput(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.Dropou... |
class SplinterSelfOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
5,363 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/tokenization_splinter.py | transformers.models.splinter.tokenization_splinter.BasicTokenizer | from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
import unicodedata
class BasicTokenizer:
"""
Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.).
Args:
do_lower_case (`bool`, *optional*, defaul... |
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... | 8 | 7 | 17 | 1 | 13 | 5 | 4 | 0.57 | 0 | 2 | 0 | 0 | 7 | 4 | 7 | 7 | 147 | 14 | 89 | 30 | 81 | 51 | 76 | 30 | 68 | 8 | 0 | 4 | 27 |
5,364 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/tokenization_splinter.py | transformers.models.splinter.tokenization_splinter.SplinterTokenizer | import os
import collections
from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
from typing import Optional
class SplinterTokenizer(PreTrainedTokenizer):
"""
Construct a Splinter tokenizer. Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokeni... |
class SplinterTokenizer(PreTrainedTokenizer):
'''
Construct a Splinter tokenizer. Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.
Args:
vocab... | 17 | 8 | 14 | 1 | 10 | 4 | 2 | 0.67 | 1 | 9 | 2 | 0 | 13 | 6 | 13 | 102 | 247 | 29 | 131 | 58 | 93 | 88 | 74 | 33 | 60 | 6 | 3 | 3 | 29 |
5,365 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/tokenization_splinter.py | transformers.models.splinter.tokenization_splinter.WordpieceTokenizer | 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 WordpieceTokenizer:
'''Runs WordPiece tokenization.'''
def __init__(self, vocab, unk_token, max_input_chars_per_word=100):
pass
def tokenize(self, text):
'''
Tokenizes a piece of text into its word pieces. This uses a greedy longest-match-first algorithm to perform
to... | 3 | 2 | 26 | 3 | 18 | 6 | 5 | 0.33 | 0 | 1 | 0 | 0 | 2 | 3 | 2 | 2 | 55 | 8 | 36 | 15 | 33 | 12 | 35 | 15 | 32 | 9 | 0 | 4 | 10 |
5,366 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/splinter/tokenization_splinter_fast.py | transformers.models.splinter.tokenization_splinter_fast.SplinterTokenizerFast | from .tokenization_splinter import SplinterTokenizer
from tokenizers import normalizers
from typing import Optional
import json
from ...tokenization_utils_fast import PreTrainedTokenizerFast
class SplinterTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" Splinter tokenizer (backed by HuggingFace's... |
class SplinterTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" Splinter 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 superclass for... | 7 | 4 | 22 | 2 | 14 | 6 | 2 | 0.96 | 1 | 4 | 0 | 0 | 5 | 1 | 5 | 93 | 159 | 18 | 72 | 37 | 47 | 69 | 35 | 18 | 29 | 3 | 3 | 1 | 10 |
5,367 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/configuration_squeezebert.py | transformers.models.squeezebert.configuration_squeezebert.SqueezeBertConfig | from ...configuration_utils import PretrainedConfig
class SqueezeBertConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`SqueezeBertModel`]. It is used to instantiate a
SqueezeBERT model according to the specified arguments, defining the model architecture. Insta... |
class SqueezeBertConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`SqueezeBertModel`]. It is used to instantiate a
SqueezeBERT model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will ... | 2 | 1 | 45 | 1 | 44 | 0 | 1 | 1.33 | 1 | 1 | 0 | 0 | 1 | 19 | 1 | 1 | 120 | 13 | 46 | 45 | 21 | 61 | 23 | 22 | 21 | 1 | 1 | 0 | 1 |
5,368 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/configuration_squeezebert.py | transformers.models.squeezebert.configuration_squeezebert.SqueezeBertOnnxConfig | from ...onnx import OnnxConfig
from collections.abc import Mapping
from collections import OrderedDict
class SqueezeBertOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
if self.task == 'multiple-choice':
dynamic_axis = {0: 'batch', 1: 'choice', 2: 'seq... |
class SqueezeBertOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass | 3 | 0 | 12 | 0 | 12 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 1 | 14 | 0 | 14 | 4 | 11 | 0 | 6 | 3 | 4 | 2 | 1 | 1 | 2 |
5,369 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.ConvActivation | from ...activations import ACT2FN
from torch import nn
class ConvActivation(nn.Module):
"""
ConvActivation: Conv, Activation
"""
def __init__(self, cin, cout, groups, act):
super().__init__()
self.conv1d = nn.Conv1d(in_channels=cin, out_channels=cout, kernel_size=1, groups=groups)
... |
class ConvActivation(nn.Module):
'''
ConvActivation: Conv, Activation
'''
def __init__(self, cin, cout, groups, act):
pass
def forward(self, x):
pass | 3 | 1 | 4 | 0 | 4 | 0 | 1 | 0.38 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 2 | 8 | 6 | 5 | 3 | 8 | 6 | 5 | 1 | 1 | 0 | 2 |
5,370 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.ConvDropoutLayerNorm | from torch import nn
class ConvDropoutLayerNorm(nn.Module):
"""
ConvDropoutLayerNorm: Conv, Dropout, LayerNorm
"""
def __init__(self, cin, cout, groups, dropout_prob):
super().__init__()
self.conv1d = nn.Conv1d(in_channels=cin, out_channels=cout, kernel_size=1, groups=groups)
s... |
class ConvDropoutLayerNorm(nn.Module):
'''
ConvDropoutLayerNorm: Conv, Dropout, LayerNorm
'''
def __init__(self, cin, cout, groups, dropout_prob):
pass
def forward(self, hidden_states, input_tensor):
pass | 3 | 1 | 6 | 1 | 6 | 0 | 1 | 0.25 | 1 | 2 | 1 | 0 | 2 | 3 | 2 | 12 | 18 | 3 | 12 | 7 | 9 | 3 | 12 | 7 | 9 | 1 | 1 | 0 | 2 |
5,371 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.MatMulWrapper | from torch import nn
import torch
class MatMulWrapper(nn.Module):
"""
Wrapper for torch.matmul(). This makes flop-counting easier to implement. Note that if you directly call
torch.matmul() in your code, the flop counter will typically ignore the flops of the matmul.
"""
def __init__(self):
... |
class MatMulWrapper(nn.Module):
'''
Wrapper for torch.matmul(). This makes flop-counting easier to implement. Note that if you directly call
torch.matmul() in your code, the flop counter will typically ignore the flops of the matmul.
'''
def __init__(self):
pass
def forward(self, mat1... | 3 | 2 | 6 | 1 | 2 | 3 | 1 | 1.8 | 1 | 1 | 0 | 0 | 2 | 0 | 2 | 12 | 18 | 4 | 5 | 3 | 2 | 9 | 5 | 3 | 2 | 1 | 1 | 0 | 2 |
5,372 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.SqueezeBertEmbeddings | import torch
from torch import nn
class SqueezeBertEmbeddings(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
super().__init__()
self.word_embeddings = nn.Embedding(config.vocab_size, config.embedding_size, padding_idx=confi... |
class SqueezeBertEmbeddings(nn.Module):
'''Construct the embeddings from word, position and token_type embeddings.'''
def __init__(self, config):
pass
def forward(self, input_ids=None, token_type_ids=None, position_ids=None, inputs_embeds=None):
pass | 3 | 1 | 19 | 4 | 14 | 2 | 3 | 0.14 | 1 | 1 | 0 | 0 | 2 | 5 | 2 | 12 | 42 | 9 | 29 | 13 | 26 | 4 | 26 | 13 | 23 | 5 | 1 | 1 | 6 |
5,373 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.SqueezeBertEncoder | from torch import nn
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
class SqueezeBertEncoder(nn.Module):
def __init__(self, config):
super().__init__()
... |
class SqueezeBertEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, output_attentions=False, output_hidden_states=False, return_dict=True):
pass | 3 | 0 | 29 | 6 | 22 | 1 | 6 | 0.04 | 1 | 5 | 2 | 0 | 2 | 1 | 2 | 12 | 59 | 12 | 45 | 17 | 34 | 2 | 29 | 9 | 26 | 10 | 1 | 2 | 11 |
5,374 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.SqueezeBertForMaskedLM | from typing import Optional, Union
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...... | @auto_docstring
class SqueezeBertForMaskedLM(SqueezeBertPreTrainedModel):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, new_embeddings):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, ... | 7 | 1 | 16 | 2 | 13 | 2 | 2 | 0.14 | 1 | 6 | 3 | 0 | 4 | 2 | 4 | 5 | 76 | 11 | 58 | 27 | 35 | 8 | 25 | 14 | 20 | 5 | 2 | 1 | 8 |
5,375 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.SqueezeBertForMultipleChoice | from ...utils import auto_docstring, logging
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
import torch
from typing import Optional, Union
from torch import nn
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringMod... | @auto_docstring
class SqueezeBertForMultipleChoice(SqueezeBertPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, position_ids: Optional... | 5 | 1 | 37 | 5 | 29 | 4 | 6 | 0.1 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 84 | 10 | 67 | 29 | 44 | 7 | 28 | 14 | 25 | 11 | 2 | 1 | 12 |
5,376 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.SqueezeBertForQuestionAnswering | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from typing import Optional, Union
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from torch import nn
... | @auto_docstring
class SqueezeBertForQuestionAnswering(SqueezeBertPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, position_ids: Optio... | 5 | 0 | 41 | 5 | 30 | 7 | 4 | 0.19 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 90 | 10 | 67 | 30 | 45 | 13 | 32 | 16 | 29 | 7 | 2 | 2 | 8 |
5,377 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.SqueezeBertForSequenceClassification | from ...utils import auto_docstring, logging
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELos... | @auto_docstring(custom_intro='\n SqueezeBERT Model transformer with a sequence classification/regression head on top (a linear layer on top of the\n pooled output) e.g. for GLUE tasks.\n ')
class SqueezeBertForSequenceClassification(SqueezeBertPreTrainedModel):
def __init__(self, config):
pass
... | 5 | 1 | 41 | 5 | 33 | 4 | 7 | 0.1 | 1 | 6 | 2 | 0 | 2 | 5 | 2 | 3 | 90 | 10 | 73 | 27 | 52 | 7 | 35 | 14 | 32 | 12 | 2 | 3 | 13 |
5,378 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.SqueezeBertForTokenClassification | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Optional, Union
from ...utils import auto_docstring, logging
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceCla... | @auto_docstring
class SqueezeBertForTokenClassification(SqueezeBertPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, position_ids: Opt... | 5 | 1 | 31 | 4 | 24 | 3 | 3 | 0.09 | 1 | 5 | 2 | 0 | 2 | 4 | 2 | 3 | 69 | 9 | 55 | 26 | 34 | 5 | 22 | 13 | 19 | 5 | 2 | 1 | 6 |
5,379 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.SqueezeBertLMPredictionHead | import torch
from torch import nn
class SqueezeBertLMPredictionHead(nn.Module):
def __init__(self, config):
super().__init__()
self.transform = SqueezeBertPredictionHeadTransform(config)
self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
self.bias = nn.Para... |
class SqueezeBertLMPredictionHead(nn.Module):
def __init__(self, config):
pass
def _tie_weights(self) -> None:
pass
def forward(self, hidden_states):
pass | 4 | 0 | 6 | 1 | 4 | 1 | 1 | 0.23 | 1 | 2 | 1 | 0 | 3 | 3 | 3 | 13 | 21 | 5 | 13 | 7 | 9 | 3 | 13 | 7 | 9 | 1 | 1 | 0 | 3 |
5,380 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.SqueezeBertLayerNorm | from torch import nn
class SqueezeBertLayerNorm(nn.LayerNorm):
"""
This is a nn.LayerNorm subclass that accepts NCW data layout and performs normalization in the C dimension.
N = batch C = channels W = sequence length
"""
def __init__(self, hidden_size, eps=1e-12):
nn.LayerNorm.__init__(s... |
class SqueezeBertLayerNorm(nn.LayerNorm):
'''
This is a nn.LayerNorm subclass that accepts NCW data layout and performs normalization in the C dimension.
N = batch C = channels W = sequence length
'''
def __init__(self, hidden_size, eps=1e-12):
pass
def forward(self, x):
pass | 3 | 1 | 3 | 0 | 3 | 1 | 1 | 0.71 | 1 | 0 | 0 | 0 | 2 | 0 | 2 | 2 | 14 | 3 | 7 | 3 | 4 | 5 | 7 | 3 | 4 | 1 | 1 | 0 | 2 |
5,381 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.SqueezeBertModel | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch
from ...utils import auto_docstring, logging
from typing import Optional, Union
@auto_docstring
class Squeez... | @auto_docstring
class SqueezeBertModel(SqueezeBertPreTrainedModel):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, new_embeddings):
pass
def _prune_heads(self, heads_to_prune):
'''
Prunes heads of the model... | 8 | 1 | 17 | 2 | 13 | 2 | 3 | 0.14 | 1 | 8 | 4 | 0 | 5 | 3 | 5 | 6 | 97 | 13 | 74 | 29 | 51 | 10 | 38 | 17 | 32 | 11 | 2 | 1 | 16 |
5,382 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.SqueezeBertModule | from torch import nn
class SqueezeBertModule(nn.Module):
def __init__(self, config):
"""
- hidden_size = input chans = output chans for Q, K, V (they are all the same ... for now) = output chans for
the module
- intermediate_size = output chans for intermediate layer
- gr... |
class SqueezeBertModule(nn.Module):
def __init__(self, config):
'''
- hidden_size = input chans = output chans for Q, K, V (they are all the same ... for now) = output chans for
the module
- intermediate_size = output chans for intermediate layer
- groups = number of grou... | 3 | 1 | 19 | 3 | 13 | 4 | 2 | 0.26 | 1 | 4 | 3 | 0 | 2 | 4 | 2 | 12 | 40 | 6 | 27 | 17 | 24 | 7 | 21 | 17 | 18 | 2 | 1 | 1 | 3 |
5,383 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.SqueezeBertOnlyMLMHead | from torch import nn
class SqueezeBertOnlyMLMHead(nn.Module):
def __init__(self, config):
super().__init__()
self.predictions = SqueezeBertLMPredictionHead(config)
def forward(self, sequence_output):
prediction_scores = self.predictions(sequence_output)
return prediction_score... |
class SqueezeBertOnlyMLMHead(nn.Module):
def __init__(self, config):
pass
def forward(self, sequence_output):
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 2 | 1 | 2 | 12 | 8 | 1 | 7 | 5 | 4 | 0 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
5,384 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.SqueezeBertPooler | from torch import nn
class SqueezeBertPooler(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):
first_token_tensor = hidden_states[:, 0]
... |
class SqueezeBertPooler(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.2 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 10 | 7 | 7 | 2 | 10 | 7 | 7 | 1 | 1 | 0 | 2 |
5,385 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.SqueezeBertPreTrainedModel | from torch import nn
from ...utils import auto_docstring, logging
from .configuration_squeezebert import SqueezeBertConfig
from ...modeling_utils import PreTrainedModel
@auto_docstring
class SqueezeBertPreTrainedModel(PreTrainedModel):
config: SqueezeBertConfig
base_model_prefix = 'transformer'
def _init_... | @auto_docstring
class SqueezeBertPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.47 | 1 | 1 | 1 | 6 | 1 | 0 | 1 | 1 | 24 | 2 | 15 | 4 | 13 | 7 | 13 | 4 | 11 | 6 | 1 | 2 | 6 |
5,386 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.SqueezeBertPredictionHeadTransform | from torch import nn
from ...activations import ACT2FN
class SqueezeBertPredictionHeadTransform(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
if isinstance(config.hidden_act, str):
self.transform_act_fn... |
class SqueezeBertPredictionHeadTransform(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 15 | 1 | 14 | 6 | 11 | 0 | 13 | 6 | 10 | 2 | 1 | 1 | 3 |
5,387 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/modeling_squeezebert.py | transformers.models.squeezebert.modeling_squeezebert.SqueezeBertSelfAttention | import math
from torch import nn
class SqueezeBertSelfAttention(nn.Module):
def __init__(self, config, cin, q_groups=1, k_groups=1, v_groups=1):
"""
config = used for some things; ignored for others (work in progress...) cin = input channels = output channels
groups = number of groups to u... |
class SqueezeBertSelfAttention(nn.Module):
def __init__(self, config, cin, q_groups=1, k_groups=1, v_groups=1):
'''
config = used for some things; ignored for others (work in progress...) cin = input channels = output channels
groups = number of groups to use in conv1d layers
'''
... | 6 | 5 | 17 | 2 | 9 | 6 | 1 | 0.65 | 1 | 4 | 1 | 0 | 5 | 10 | 5 | 15 | 88 | 14 | 48 | 29 | 42 | 31 | 46 | 29 | 40 | 2 | 1 | 1 | 7 |
5,388 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/tokenization_squeezebert.py | transformers.models.squeezebert.tokenization_squeezebert.BasicTokenizer | from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
import unicodedata
class BasicTokenizer:
"""
Constructs a BasicTokenizer that will run basic tokenization (punctuation splitting, lower casing, etc.).
Args:
do_lower_case (`bool`, *optional*, defaul... |
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... | 8 | 7 | 19 | 1 | 14 | 5 | 4 | 0.55 | 0 | 2 | 0 | 0 | 7 | 5 | 7 | 7 | 159 | 14 | 98 | 39 | 83 | 54 | 78 | 32 | 70 | 8 | 0 | 4 | 27 |
5,389 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/tokenization_squeezebert.py | transformers.models.squeezebert.tokenization_squeezebert.SqueezeBertTokenizer | from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
import collections
import os
from typing import Optional
class SqueezeBertTokenizer(PreTrainedTokenizer):
"""
Construct a SqueezeBERT tokenizer. Based on WordPiece.
This tokenizer inherits from [`PreTrained... |
class SqueezeBertTokenizer(PreTrainedTokenizer):
'''
Construct a SqueezeBERT tokenizer. Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.
Args:
... | 14 | 6 | 15 | 1 | 10 | 4 | 2 | 0.72 | 1 | 9 | 2 | 0 | 12 | 5 | 12 | 101 | 236 | 29 | 121 | 53 | 85 | 87 | 65 | 29 | 52 | 6 | 3 | 3 | 27 |
5,390 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/squeezebert/tokenization_squeezebert_fast.py | transformers.models.squeezebert.tokenization_squeezebert_fast.SqueezeBertTokenizerFast | from .tokenization_squeezebert import SqueezeBertTokenizer
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from typing import Optional
import json
from tokenizers import normalizers
class SqueezeBertTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" SqueezeBERT tokenizer (backed by H... |
class SqueezeBertTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" SqueezeBERT 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 supercla... | 4 | 2 | 24 | 3 | 14 | 7 | 2 | 1.12 | 1 | 4 | 0 | 0 | 4 | 1 | 4 | 92 | 141 | 18 | 58 | 29 | 38 | 65 | 27 | 14 | 22 | 2 | 3 | 1 | 7 |
5,391 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/stablelm/configuration_stablelm.py | transformers.models.stablelm.configuration_stablelm.StableLmConfig | from ...modeling_rope_utils import rope_config_validation
from ...configuration_utils import PretrainedConfig
class StableLmConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`~StableLmModel`].
It is used to instantiate an StableLM model according to the specifie... |
class StableLmConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`~StableLmModel`].
It is used to instantiate an StableLM model according to the specified arguments, defining the model
architecture. Instantiating a configuration with the defaults will yield a... | 2 | 1 | 59 | 3 | 54 | 2 | 2 | 1.88 | 1 | 1 | 0 | 0 | 1 | 19 | 1 | 1 | 175 | 11 | 57 | 48 | 30 | 107 | 27 | 23 | 25 | 2 | 1 | 1 | 2 |
5,392 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/stablelm/modeling_stablelm.py | transformers.models.stablelm.modeling_stablelm.StableLmAttention | from torch import nn
from .configuration_stablelm import StableLmConfig
from typing import Optional, Union
import math
from ...cache_utils import Cache, DynamicCache
from ...utils.deprecation import deprecate_kwarg
import torch
class StableLmAttention(nn.Module):
"""Multi-headed attention from 'Attention Is All Yo... |
class StableLmAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: StableLmConfig, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states... | 4 | 1 | 62 | 11 | 48 | 4 | 5 | 0.09 | 1 | 9 | 4 | 2 | 2 | 19 | 2 | 12 | 127 | 23 | 97 | 43 | 84 | 9 | 64 | 33 | 61 | 6 | 1 | 1 | 10 |
5,393 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/stablelm/modeling_stablelm.py | transformers.models.stablelm.modeling_stablelm.StableLmDecoderLayer | import torch
from torch import nn
from ...cache_utils import Cache, DynamicCache
from .configuration_stablelm import StableLmConfig
from typing import Optional, Union
from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class StableLmDecoderLayer(Gr... |
class StableLmDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: StableLmConfig, layer_idx: int):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[Cache]=None, ou... | 3 | 1 | 44 | 5 | 25 | 16 | 3 | 0.62 | 1 | 6 | 2 | 0 | 2 | 7 | 2 | 12 | 90 | 10 | 50 | 24 | 37 | 31 | 30 | 14 | 27 | 4 | 1 | 1 | 6 |
5,394 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/stablelm/modeling_stablelm.py | transformers.models.stablelm.modeling_stablelm.StableLmFlashAttention2 | from ...cache_utils import Cache, DynamicCache
import torch
from ...modeling_flash_attention_utils import flash_attn_supports_top_left_mask, is_flash_attn_available
from typing import Optional, Union
from ...utils.deprecation import deprecate_kwarg
class StableLmFlashAttention2(StableLmAttention):
"""
StableLM... |
class StableLmFlashAttention2(StableLmAttention):
'''
StableLM flash attention module. This module inherits from `StableLmAttention` 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
flash attention and... | 4 | 1 | 47 | 8 | 33 | 6 | 3 | 0.25 | 1 | 4 | 1 | 0 | 2 | 1 | 2 | 14 | 101 | 18 | 67 | 26 | 53 | 17 | 35 | 15 | 32 | 5 | 2 | 1 | 6 |
5,395 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/stablelm/modeling_stablelm.py | transformers.models.stablelm.modeling_stablelm.StableLmForCausalLM | from ...cache_utils import Cache, DynamicCache
import torch
from ...utils import auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging
from typing import Optional, Union
from torch import nn
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from ...generation import Gener... |
class StableLmForCausalLM(StableLmPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past... | 5 | 1 | 14 | 2 | 9 | 3 | 2 | 0.45 | 2 | 7 | 2 | 0 | 8 | 3 | 8 | 9 | 134 | 22 | 77 | 35 | 50 | 35 | 35 | 19 | 26 | 8 | 2 | 1 | 15 |
5,396 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/stablelm/modeling_stablelm.py | transformers.models.stablelm.modeling_stablelm.StableLmForSequenceClassification | from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class StableLmForSequenceClassification(GenericForSequenceClassification, StableLmPreTrainedModel):
... |
class StableLmForSequenceClassification(GenericForSequenceClassification, StableLmPreTrainedModel):
pass | 1 | 0 | 21 | 2 | 17 | 2 | 3 | 0.11 | 1 | 7 | 3 | 0 | 4 | 3 | 4 | 5 | 90 | 11 | 71 | 31 | 53 | 8 | 36 | 18 | 31 | 9 | 2 | 1 | 12 |
5,397 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/stablelm/modeling_stablelm.py | transformers.models.stablelm.modeling_stablelm.StableLmForTokenClassification | from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class StableLmForTokenClassification(GenericForTokenClassification, StableLmPreTrainedModel):
... |
class StableLmForTokenClassification(GenericForTokenClassification, StableLmPreTrainedModel):
pass | 1 | 0 | 17 | 1 | 14 | 2 | 3 | 0.11 | 1 | 5 | 2 | 0 | 4 | 4 | 4 | 5 | 79 | 8 | 64 | 28 | 41 | 7 | 29 | 15 | 24 | 5 | 2 | 1 | 10 |
5,398 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/stablelm/modeling_stablelm.py | transformers.models.stablelm.modeling_stablelm.StableLmLayerNormPerHead | import torch
from torch import nn
class StableLmLayerNormPerHead(nn.Module):
def __init__(self, dim, num_heads, eps=1e-05, bias=False):
super().__init__()
self.dim = dim
self.num_heads = num_heads
self.norms = nn.ModuleList([nn.LayerNorm(dim, eps=eps, bias=bias) for _ in range(self... |
class StableLmLayerNormPerHead(nn.Module):
def __init__(self, dim, num_heads, eps=1e-05, bias=False):
pass
def forward(self, hidden_states: torch.Tensor):
pass | 3 | 0 | 6 | 0 | 4 | 2 | 1 | 0.33 | 1 | 4 | 0 | 0 | 2 | 3 | 2 | 12 | 13 | 1 | 9 | 7 | 6 | 3 | 9 | 7 | 6 | 1 | 1 | 0 | 2 |
5,399 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/stablelm/modeling_stablelm.py | transformers.models.stablelm.modeling_stablelm.StableLmMLP | from torch import nn
from ...activations import ACT2FN
class StableLmMLP(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.hidden_size = config.hidden_size
self.intermediate_size = config.intermediate_size
self.gate_proj = nn.Linear(self.h... |
class StableLmMLP(nn.Module):
def __init__(self, config):
pass
def forward(self, x):
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 7 | 2 | 12 | 14 | 1 | 13 | 11 | 10 | 0 | 13 | 11 | 10 | 1 | 1 | 0 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.