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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,500 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py | transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerConvolutionModule | from .configuration_fastspeech2_conformer import FastSpeech2ConformerConfig, FastSpeech2ConformerHifiGanConfig, FastSpeech2ConformerWithHifiGanConfig
from torch import nn
import torch
class FastSpeech2ConformerConvolutionModule(nn.Module):
def __init__(self, config: FastSpeech2ConformerConfig, module_config):
... |
class FastSpeech2ConformerConvolutionModule(nn.Module):
def __init__(self, config: FastSpeech2ConformerConfig, module_config):
pass
def forward(self, hidden_states):
'''
Compute convolution module.
Args:
hidden_states (`torch.Tensor` of shape `(batch, time, channel... | 3 | 1 | 20 | 4 | 10 | 6 | 1 | 0.6 | 1 | 2 | 1 | 0 | 2 | 4 | 2 | 12 | 41 | 9 | 20 | 9 | 17 | 12 | 18 | 9 | 15 | 1 | 1 | 0 | 2 |
2,501 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py | transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerDurationPredictor | import torch
from torch import nn
from .configuration_fastspeech2_conformer import FastSpeech2ConformerConfig, FastSpeech2ConformerHifiGanConfig, FastSpeech2ConformerWithHifiGanConfig
class FastSpeech2ConformerDurationPredictor(nn.Module):
"""
Duration predictor module.
This is a module of duration predic... |
class FastSpeech2ConformerDurationPredictor(nn.Module):
'''
Duration predictor module.
This is a module of duration predictor described in the paper 'FastSpeech: Fast, Robust and Controllable Text to
Speech' https://huggingface.co/papers/1905.09263 The duration predictor predicts a duration of each fra... | 3 | 2 | 21 | 4 | 12 | 6 | 3 | 0.88 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 12 | 57 | 12 | 24 | 12 | 21 | 21 | 19 | 12 | 16 | 3 | 1 | 1 | 6 |
2,502 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py | transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerEncoder | from ...modeling_outputs import BaseModelOutput
from .configuration_fastspeech2_conformer import FastSpeech2ConformerConfig, FastSpeech2ConformerHifiGanConfig, FastSpeech2ConformerWithHifiGanConfig
import torch
from torch import nn
from typing import Optional, Union
class FastSpeech2ConformerEncoder(nn.Module):
""... |
class FastSpeech2ConformerEncoder(nn.Module):
'''
FastSpeech2ConformerEncoder encoder module.
Args:
config (`FastSpeech2ConformerConfig`):
FastSpeech2ConformerConfig instance.
module_config (`dict`):
Dictionary containing the encoder or decoder module configuration f... | 3 | 2 | 42 | 7 | 22 | 13 | 6 | 0.8 | 1 | 8 | 4 | 0 | 2 | 3 | 2 | 12 | 98 | 17 | 45 | 25 | 30 | 36 | 27 | 12 | 24 | 9 | 1 | 2 | 11 |
2,503 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py | transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerEncoderLayer | import torch
from .configuration_fastspeech2_conformer import FastSpeech2ConformerConfig, FastSpeech2ConformerHifiGanConfig, FastSpeech2ConformerWithHifiGanConfig
from typing import Optional, Union
from torch import nn
class FastSpeech2ConformerEncoderLayer(nn.Module):
def __init__(self, config: FastSpeech2Confor... |
class FastSpeech2ConformerEncoderLayer(nn.Module):
def __init__(self, config: FastSpeech2ConformerConfig, module_config):
pass
def forward(self, hidden_states: torch.Tensor, pos_emb: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, output_attentions: Optional[torch.Tensor]=Fa... | 3 | 1 | 57 | 9 | 38 | 10 | 9 | 0.25 | 1 | 6 | 4 | 0 | 2 | 17 | 2 | 12 | 115 | 19 | 77 | 30 | 68 | 19 | 67 | 24 | 64 | 14 | 1 | 2 | 18 |
2,504 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py | transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerHifiGan | from torch import nn
from ...utils import ModelOutput, auto_docstring, logging
from .configuration_fastspeech2_conformer import FastSpeech2ConformerConfig, FastSpeech2ConformerHifiGanConfig, FastSpeech2ConformerWithHifiGanConfig
from ...modeling_utils import PreTrainedModel
import torch
@auto_docstring(custom_intro='\... | @auto_docstring(custom_intro='\n HiFi-GAN vocoder.\n ')
class FastSpeech2ConformerHifiGan(PreTrainedModel):
def __init__(self, config: FastSpeech2ConformerHifiGanConfig):
pass
def _init_weights(self, module: nn.Module):
'''Initialize the weights.'''
pass
def apply_weight_nor... | 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 |
2,505 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py | transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerLoss | from .configuration_fastspeech2_conformer import FastSpeech2ConformerConfig, FastSpeech2ConformerHifiGanConfig, FastSpeech2ConformerWithHifiGanConfig
from torch import nn
import torch
class FastSpeech2ConformerLoss(nn.Module):
def __init__(self, config: FastSpeech2ConformerConfig):
super().__init__()
... |
class FastSpeech2ConformerLoss(nn.Module):
def __init__(self, config: FastSpeech2ConformerConfig):
pass
def forward(self, outputs_after_postnet, outputs_before_postnet, duration_outputs, pitch_outputs, energy_outputs, spectrogram_labels, duration_labels, pitch_labels, energy_labels, duration_mask, sp... | 3 | 1 | 53 | 6 | 31 | 16 | 4 | 0.51 | 1 | 3 | 1 | 0 | 2 | 6 | 2 | 12 | 108 | 13 | 63 | 33 | 47 | 32 | 46 | 20 | 43 | 5 | 1 | 2 | 8 |
2,506 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py | transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerModel | from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
import torch
from torch import nn
from .configuration_fastspeech2_conformer import FastSpeech2ConformerConfig, FastSpeech2ConformerHifiGanConfig, FastSpeech2ConformerWithHifiGanConfig
@auto_docstring(custom_intro='\n FastSp... | @auto_docstring(custom_intro='\n FastSpeech2Conformer Model.\n ')
class FastSpeech2ConformerModel(FastSpeech2ConformerPreTrainedModel):
'''
FastSpeech 2 module.
This is a module of FastSpeech 2 described in 'FastSpeech 2: Fast and High-Quality End-to-End Text to Speech'
https://huggingface.co/pape... | 5 | 2 | 135 | 18 | 87 | 30 | 11 | 0.38 | 1 | 11 | 8 | 0 | 2 | 22 | 2 | 4 | 281 | 39 | 175 | 64 | 157 | 67 | 89 | 49 | 86 | 17 | 2 | 2 | 21 |
2,507 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py | transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerModelOutput | import torch
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro='\n Output type of [`FastSpeech2ConformerModel`].\n ')
class FastSpeech2ConformerModelOutput(ModelOutput):
"""
loss (`torch.F... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`FastSpeech2ConformerModel`].\n ')
class FastSpeech2ConformerModelOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Spectrogram generation loss.
duration_outputs (`tor... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.09 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 52 | 7 | 11 | 11 | 10 | 34 | 11 | 11 | 10 | 0 | 1 | 0 | 0 |
2,508 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py | transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerMultiLayeredConv1d | import torch
from .configuration_fastspeech2_conformer import FastSpeech2ConformerConfig, FastSpeech2ConformerHifiGanConfig, FastSpeech2ConformerWithHifiGanConfig
from torch import nn
class FastSpeech2ConformerMultiLayeredConv1d(nn.Module):
"""
Multi-layered conv1d for Transformer block.
This is a module ... |
class FastSpeech2ConformerMultiLayeredConv1d(nn.Module):
'''
Multi-layered conv1d for Transformer block.
This is a module of multi-layered conv1d designed to replace positionwise feed-forward network in Transformer
block, which is introduced in 'FastSpeech: Fast, Robust and Controllable Text to Speech'... | 3 | 3 | 17 | 2 | 8 | 8 | 1 | 1.24 | 1 | 2 | 1 | 0 | 2 | 3 | 2 | 12 | 44 | 6 | 17 | 9 | 14 | 21 | 17 | 9 | 14 | 1 | 1 | 0 | 2 |
2,509 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py | transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerPreTrainedModel | from torch import nn
from .configuration_fastspeech2_conformer import FastSpeech2ConformerConfig, FastSpeech2ConformerHifiGanConfig, FastSpeech2ConformerWithHifiGanConfig
from ...modeling_utils import PreTrainedModel
from ...utils import ModelOutput, auto_docstring, logging
import math
@auto_docstring
class FastSpeech... | @auto_docstring
class FastSpeech2ConformerPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass
def _set_gradient_checkpointing(self, module, value=False):
pass | 4 | 1 | 10 | 0 | 10 | 1 | 5 | 0.22 | 1 | 2 | 2 | 1 | 2 | 0 | 2 | 2 | 32 | 4 | 23 | 7 | 20 | 5 | 20 | 7 | 17 | 7 | 1 | 2 | 9 |
2,510 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py | transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerPredictorLayer | from torch import nn
class FastSpeech2ConformerPredictorLayer(nn.Module):
def __init__(self, input_channels, num_chans, kernel_size, dropout_rate):
super().__init__()
self.conv = nn.Conv1d(input_channels, num_chans, kernel_size, stride=1, padding=(kernel_size - 1) // 2)
self.activation = n... |
class FastSpeech2ConformerPredictorLayer(nn.Module):
def __init__(self, input_channels, num_chans, kernel_size, dropout_rate):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 12 | 2 | 10 | 1 | 1 | 0.05 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 26 | 4 | 21 | 7 | 18 | 1 | 15 | 7 | 12 | 1 | 1 | 0 | 2 |
2,511 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py | transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerRelPositionalEncoding | from torch import nn
from .configuration_fastspeech2_conformer import FastSpeech2ConformerConfig, FastSpeech2ConformerHifiGanConfig, FastSpeech2ConformerWithHifiGanConfig
import torch
import math
class FastSpeech2ConformerRelPositionalEncoding(nn.Module):
"""
Args:
Relative positional encoding module (new ... |
class FastSpeech2ConformerRelPositionalEncoding(nn.Module):
'''
Args:
Relative positional encoding module (new implementation). Details can be found in
https://github.com/espnet/espnet/pull/2816. See : Appendix Batch in https://huggingface.co/papers/1901.02860
config (`FastSpeech2ConformerConfi... | 4 | 4 | 18 | 1 | 11 | 6 | 2 | 0.8 | 1 | 2 | 1 | 0 | 3 | 5 | 3 | 13 | 68 | 5 | 35 | 17 | 31 | 28 | 33 | 17 | 29 | 4 | 1 | 3 | 6 |
2,512 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py | transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerSpeechDecoderPostnet | from torch import nn
import torch
class FastSpeech2ConformerSpeechDecoderPostnet(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.layers = nn.ModuleList(... |
class FastSpeech2ConformerSpeechDecoderPostnet(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor):
pass | 3 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 1 | 4 | 1 | 0 | 2 | 3 | 2 | 12 | 16 | 1 | 15 | 10 | 12 | 0 | 13 | 10 | 10 | 2 | 1 | 1 | 3 |
2,513 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py | transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerVarianceEmbedding | from torch import nn
class FastSpeech2ConformerVarianceEmbedding(nn.Module):
def __init__(self, in_channels=1, out_channels=384, kernel_size=1, padding=0, dropout_rate=0.0):
super().__init__()
self.conv = nn.Conv1d(in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size, paddin... |
class FastSpeech2ConformerVarianceEmbedding(nn.Module):
def __init__(self, in_channels=1, out_channels=384, kernel_size=1, padding=0, dropout_rate=0.0):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 11 | 0 | 11 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 24 | 1 | 23 | 12 | 13 | 0 | 11 | 5 | 8 | 1 | 1 | 0 | 2 |
2,514 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py | transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerVariancePredictor | from torch import nn
from .configuration_fastspeech2_conformer import FastSpeech2ConformerConfig, FastSpeech2ConformerHifiGanConfig, FastSpeech2ConformerWithHifiGanConfig
class FastSpeech2ConformerVariancePredictor(nn.Module):
def __init__(self, config: FastSpeech2ConformerConfig, num_layers=2, num_chans=384, ker... |
class FastSpeech2ConformerVariancePredictor(nn.Module):
def __init__(self, config: FastSpeech2ConformerConfig, num_layers=2, num_chans=384, kernel_size=3, dropout_rate=0.5):
'''
Initialize variance predictor module.
Args:
input_dim (`int`): Input dimension.
num_laye... | 3 | 2 | 25 | 3 | 12 | 10 | 3 | 0.83 | 1 | 4 | 2 | 0 | 2 | 2 | 2 | 12 | 51 | 7 | 24 | 17 | 14 | 20 | 17 | 10 | 14 | 3 | 1 | 1 | 6 |
2,515 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py | transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerWithHifiGan | from .configuration_fastspeech2_conformer import FastSpeech2ConformerConfig, FastSpeech2ConformerHifiGanConfig, FastSpeech2ConformerWithHifiGanConfig
from ...utils import ModelOutput, auto_docstring, logging
from typing import Optional, Union
from ...modeling_utils import PreTrainedModel
import torch
@auto_docstring(c... | @auto_docstring(custom_intro='\n The FastSpeech2ConformerModel with a FastSpeech2ConformerHifiGan vocoder head that performs text-to-speech (waveform).\n ')
class FastSpeech2ConformerWithHifiGan(PreTrainedModel):
def __init__(self, config: FastSpeech2ConformerWithHifiGanConfig):
pass
@auto_docstr... | 5 | 1 | 56 | 6 | 28 | 23 | 4 | 0.77 | 1 | 7 | 5 | 0 | 2 | 3 | 2 | 2 | 119 | 13 | 60 | 28 | 40 | 46 | 22 | 11 | 19 | 7 | 1 | 2 | 8 |
2,516 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py | transformers.models.fastspeech2_conformer.modeling_fastspeech2_conformer.FastSpeech2ConformerWithHifiGanOutput | from typing import Optional, Union
from dataclasses import dataclass
import torch
from ...utils import ModelOutput, auto_docstring, logging
@dataclass
@auto_docstring(custom_intro='\n Output type of [`FastSpeech2ConformerWithHifiGan`].\n ')
class FastSpeech2ConformerWithHifiGanOutput(FastSpeech2ConformerModelOut... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`FastSpeech2ConformerWithHifiGan`].\n ')
class FastSpeech2ConformerWithHifiGanOutput(FastSpeech2ConformerModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Spectrogram generation ... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 18 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 44 | 6 | 2 | 2 | 1 | 36 | 2 | 2 | 1 | 0 | 2 | 0 | 0 |
2,517 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fastspeech2_conformer/tokenization_fastspeech2_conformer.py | transformers.models.fastspeech2_conformer.tokenization_fastspeech2_conformer.FastSpeech2ConformerTokenizer | from typing import Optional
import regex
from ...utils import logging, requires_backends
from ...tokenization_utils import PreTrainedTokenizer
import json
import os
class FastSpeech2ConformerTokenizer(PreTrainedTokenizer):
"""
Construct a FastSpeech2Conformer tokenizer.
Args:
vocab_file (`str`):
... |
class FastSpeech2ConformerTokenizer(PreTrainedTokenizer):
'''
Construct a FastSpeech2Conformer tokenizer.
Args:
vocab_file (`str`):
Path to the vocabulary file.
bos_token (`str`, *optional*, defaults to `"<sos/eos>"`):
The begin of sequence token. Note that for FastS... | 14 | 6 | 10 | 2 | 7 | 1 | 1 | 0.41 | 1 | 6 | 0 | 0 | 12 | 5 | 12 | 101 | 154 | 33 | 86 | 37 | 61 | 35 | 60 | 25 | 45 | 3 | 3 | 1 | 16 |
2,518 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flaubert/configuration_flaubert.py | transformers.models.flaubert.configuration_flaubert.FlaubertConfig | from ...configuration_utils import PretrainedConfig
class FlaubertConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`FlaubertModel`] or a [`TFFlaubertModel`]. It is
used to instantiate a FlauBERT model according to the specified arguments, defining the model arc... |
class FlaubertConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`FlaubertModel`] or a [`TFFlaubertModel`]. It is
used to instantiate a FlauBERT model according to the specified arguments, defining the model architecture.
Instantiating a configuration with th... | 2 | 2 | 78 | 2 | 75 | 1 | 2 | 1.16 | 1 | 1 | 0 | 0 | 1 | 34 | 1 | 1 | 190 | 12 | 83 | 76 | 43 | 96 | 40 | 38 | 38 | 2 | 1 | 1 | 2 |
2,519 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flaubert/configuration_flaubert.py | transformers.models.flaubert.configuration_flaubert.FlaubertOnnxConfig | from collections.abc import Mapping
from ...onnx import OnnxConfig
from collections import OrderedDict
class FlaubertOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
if self.task == 'multiple-choice':
dynamic_axis = {0: 'batch', 1: 'choice', 2: 'sequen... |
class FlaubertOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass | 3 | 0 | 11 | 0 | 11 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 1 | 13 | 0 | 13 | 4 | 10 | 0 | 6 | 3 | 4 | 2 | 1 | 1 | 2 |
2,520 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flaubert/modeling_flaubert.py | transformers.models.flaubert.modeling_flaubert.FlaubertForMultipleChoice | import torch
from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from typing import Callable, Optional, Union
from torch.nn import BCEWithLogits... | @auto_docstring
class FlaubertForMultipleChoice(FlaubertPreTrainedModel):
def __init__(self, config, *inputs, **kwargs):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, langs: Optional[torch.Tensor]=None, token_type_ids: Op... | 5 | 1 | 43 | 4 | 36 | 4 | 7 | 0.09 | 1 | 6 | 2 | 0 | 2 | 3 | 2 | 5 | 96 | 9 | 80 | 31 | 54 | 7 | 32 | 13 | 29 | 13 | 2 | 1 | 14 |
2,521 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flaubert/modeling_flaubert.py | transformers.models.flaubert.modeling_flaubert.FlaubertForQuestionAnswering | import torch
from typing import Callable, Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
@auto_docstring
class FlaubertForQuestionAnswering(FlaubertPreTrainedModel):
def __init__(self, config):
super().__init__(config)
self.transformer = FlaubertModel(config)
sel... | @auto_docstring
class FlaubertForQuestionAnswering(FlaubertPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, langs: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Ten... | 5 | 1 | 54 | 7 | 31 | 17 | 2 | 0.51 | 1 | 6 | 2 | 0 | 2 | 2 | 2 | 5 | 112 | 14 | 65 | 28 | 41 | 33 | 14 | 8 | 11 | 3 | 2 | 1 | 4 |
2,522 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flaubert/modeling_flaubert.py | transformers.models.flaubert.modeling_flaubert.FlaubertForQuestionAnsweringSimple | import torch
from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from typing import Callable, Optional, Union
from torch.nn import BCEWithLogits... | @auto_docstring(custom_intro='\n Flaubert Model with a span classification head on top for extractive question-answering tasks like SQuAD (a linear\n layers on top of the hidden-states output to compute `span start logits` and `span end logits`).\n ')
class FlaubertForQuestionAnsweringSimple(FlaubertPreTrained... | 5 | 1 | 44 | 5 | 33 | 7 | 4 | 0.18 | 1 | 6 | 2 | 0 | 2 | 2 | 2 | 5 | 95 | 10 | 72 | 32 | 47 | 13 | 31 | 15 | 28 | 7 | 2 | 2 | 8 |
2,523 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flaubert/modeling_flaubert.py | transformers.models.flaubert.modeling_flaubert.FlaubertForSequenceClassification | import torch
from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from typing import Callable, Optional, Union
from torch.nn import BCEWithLogits... | @auto_docstring(custom_intro='\n Flaubert Model with a sequence classification/regression head on top (a linear layer on top of the pooled output)\n e.g. for GLUE tasks.\n ')
class FlaubertForSequenceClassification(FlaubertPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
... | 5 | 1 | 43 | 4 | 35 | 4 | 7 | 0.09 | 1 | 7 | 2 | 0 | 2 | 4 | 2 | 5 | 93 | 9 | 77 | 28 | 53 | 7 | 33 | 12 | 30 | 12 | 2 | 3 | 13 |
2,524 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flaubert/modeling_flaubert.py | transformers.models.flaubert.modeling_flaubert.FlaubertForTokenClassification | import torch
from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from typing import Callable, Optional, Union
from torch.nn import BCEWithLogits... | @auto_docstring
class FlaubertForTokenClassification(FlaubertPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, langs: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.T... | 5 | 1 | 34 | 4 | 27 | 3 | 3 | 0.08 | 1 | 6 | 2 | 0 | 2 | 4 | 2 | 5 | 75 | 9 | 61 | 29 | 37 | 5 | 22 | 13 | 19 | 5 | 2 | 1 | 6 |
2,525 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flaubert/modeling_flaubert.py | transformers.models.flaubert.modeling_flaubert.FlaubertModel | from ...cache_utils import DynamicCache, EncoderDecoderCache
import torch
from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from typing import... | @auto_docstring
class FlaubertModel(FlaubertPreTrainedModel):
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. head... | 8 | 2 | 49 | 6 | 32 | 12 | 8 | 0.39 | 1 | 13 | 3 | 0 | 5 | 24 | 5 | 8 | 261 | 35 | 167 | 61 | 141 | 65 | 131 | 46 | 125 | 29 | 2 | 3 | 40 |
2,526 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flaubert/modeling_flaubert.py | transformers.models.flaubert.modeling_flaubert.FlaubertPreTrainedModel | from torch import nn
import torch
from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_utils import PreTrainedModel
from .configuration_flaubert import FlaubertConfig
@auto_docstring
class FlaubertPreTrainedModel(PreTrainedModel):
config: FlaubertConfig
base_model_prefix = 'transformer'
... | @auto_docstring
class FlaubertPreTrainedModel(PreTrainedModel):
def __init__(self, *inputs, **kwargs):
pass
@property
def dummy_inputs(self):
pass
def _init_weights(self, module):
'''Initialize the weights.'''
pass | 6 | 1 | 10 | 0 | 9 | 0 | 4 | 0.15 | 1 | 2 | 1 | 7 | 3 | 0 | 3 | 3 | 42 | 4 | 33 | 11 | 28 | 5 | 29 | 10 | 25 | 9 | 1 | 3 | 12 |
2,527 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flaubert/modeling_flaubert.py | transformers.models.flaubert.modeling_flaubert.FlaubertPredLayer | from ...utils import ModelOutput, auto_docstring, logging
from torch import nn
@auto_docstring(custom_intro='\n The bare Flaubert Model transformer outputting raw hidden-states without any specific head on top.\n ')
class FlaubertPredLayer(nn.Module):
"""
Prediction layer (cross_entropy or adaptive_softm... | @auto_docstring(custom_intro='\n The bare Flaubert Model transformer outputting raw hidden-states without any specific head on top.\n ')
class FlaubertPredLayer(nn.Module):
'''
Prediction layer (cross_entropy or adaptive_softmax).
'''
def __init__(self, config):
pass
def forward(self... | 4 | 2 | 17 | 1 | 16 | 1 | 3 | 0.16 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 40 | 4 | 32 | 12 | 29 | 5 | 24 | 12 | 21 | 4 | 1 | 2 | 6 |
2,528 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flaubert/modeling_flaubert.py | transformers.models.flaubert.modeling_flaubert.FlaubertWithLMHeadModel | from ...generation import GenerationMixin
from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutput, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...utils import ModelOutput, auto_docstring, logging
impor... | @auto_docstring(custom_intro='\n The Flaubert Model transformer with a language modeling head on top (linear layer with weights tied to the input\n embeddings).\n ')
class FlaubertWithLMHeadModel(FlaubertPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_output_embedd... | 8 | 1 | 15 | 1 | 12 | 2 | 2 | 0.13 | 2 | 7 | 3 | 0 | 5 | 2 | 5 | 8 | 90 | 12 | 70 | 33 | 42 | 9 | 29 | 17 | 23 | 5 | 2 | 1 | 10 |
2,529 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flaubert/modeling_flaubert.py | transformers.models.flaubert.modeling_flaubert.MultiHeadAttention | import math
from ...cache_utils import DynamicCache, EncoderDecoderCache
import torch
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from torch import nn
class MultiHeadAttention(nn.Module):
def __init__(self, n_heads, dim, config, layer_idx: int=0):
... |
class MultiHeadAttention(nn.Module):
def __init__(self, n_heads, dim, config, layer_idx: int=0):
pass
def prune_heads(self, heads):
pass
def forward(self, input, mask, kv=None, cache=None, head_mask=None, output_attentions=False, cache_position=None):
'''
Self-attention (... | 4 | 1 | 19 | 2 | 14 | 6 | 3 | 0.37 | 1 | 2 | 0 | 0 | 3 | 9 | 3 | 13 | 94 | 13 | 70 | 31 | 64 | 26 | 67 | 31 | 61 | 11 | 1 | 3 | 16 |
2,530 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flaubert/modeling_flaubert.py | transformers.models.flaubert.modeling_flaubert.TransformerFFN | from torch import nn
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from ...activations import gelu, get_activation
class TransformerFFN(nn.Module):
def __init__(self, in_dim, dim_hidden, out_dim, config):
super().__init__()
self.dropou... |
class TransformerFFN(nn.Module):
def __init__(self, in_dim, dim_hidden, out_dim, config):
pass
def forward(self, input):
pass
def ff_chunk(self, input):
pass | 4 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 3 | 6 | 3 | 13 | 19 | 2 | 17 | 11 | 13 | 0 | 17 | 11 | 13 | 2 | 1 | 0 | 4 |
2,531 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flaubert/tokenization_flaubert.py | transformers.models.flaubert.tokenization_flaubert.FlaubertTokenizer | from ...tokenization_utils import PreTrainedTokenizer
from typing import Optional
import unicodedata
import os
import json
class FlaubertTokenizer(PreTrainedTokenizer):
"""
Construct a Flaubert tokenizer. Based on Byte-Pair Encoding. The tokenization process is the following:
- Moses preprocessing and tok... |
class FlaubertTokenizer(PreTrainedTokenizer):
'''
Construct a Flaubert tokenizer. Based on Byte-Pair Encoding. The tokenization process is the following:
- Moses preprocessing and tokenization.
- Normalizing all inputs text.
- The arguments `special_tokens` and the function `set_special_tokens`, ca... | 22 | 7 | 18 | 2 | 13 | 3 | 3 | 0.47 | 1 | 13 | 0 | 0 | 20 | 15 | 20 | 109 | 443 | 66 | 257 | 102 | 199 | 120 | 180 | 64 | 156 | 10 | 3 | 3 | 51 |
2,532 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/configuration_flava.py | transformers.models.flava.configuration_flava.FlavaConfig | from ...configuration_utils import PretrainedConfig
from typing import Any, Optional
class FlavaConfig(PretrainedConfig):
"""
[`FlavaConfig`] is the configuration class to store the configuration of a [`FlavaModel`]. It is used to
instantiate FLAVA model according to the specified arguments, defining the t... |
class FlavaConfig(PretrainedConfig):
'''
[`FlavaConfig`] is the configuration class to store the configuration of a [`FlavaModel`]. It is used to
instantiate FLAVA model according to the specified arguments, defining the text model, image model, image codebook
and multimodal model configs. Instantiatin... | 4 | 2 | 112 | 13 | 82 | 18 | 14 | 0.55 | 1 | 10 | 4 | 0 | 1 | 21 | 2 | 2 | 304 | 36 | 173 | 67 | 139 | 95 | 90 | 36 | 87 | 26 | 1 | 4 | 27 |
2,533 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/configuration_flava.py | transformers.models.flava.configuration_flava.FlavaImageCodebookConfig | from ...configuration_utils import PretrainedConfig
class FlavaImageCodebookConfig(PretrainedConfig):
model_type = 'flava_image_codebook'
base_config_key = 'image_codebook_config'
"\n [`FlavaImageCodebookConfig`] is the configuration class to store the configuration of a [`FlavaImageCodebook`]. It\n ... |
class FlavaImageCodebookConfig(PretrainedConfig):
def __init__(self, num_groups: int=4, input_channels: int=3, num_blocks_per_group: int=2, hidden_size: int=256, vocab_size: int=8192, freeze: int=True, initializer_range: float=0.02, **kwargs):
pass | 2 | 0 | 19 | 0 | 19 | 0 | 1 | 1.64 | 1 | 3 | 0 | 0 | 1 | 7 | 1 | 1 | 66 | 8 | 22 | 21 | 10 | 36 | 12 | 11 | 10 | 1 | 1 | 0 | 1 |
2,534 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/configuration_flava.py | transformers.models.flava.configuration_flava.FlavaImageConfig | from ...configuration_utils import PretrainedConfig
class FlavaImageConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`FlavaImageModel`]. It is used to instantiate an
FLAVA model according to the specified arguments, defining the model architecture.
Instant... |
class FlavaImageConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`FlavaImageModel`]. It is used to instantiate an
FLAVA model according to the specified arguments, defining the model architecture.
Instantiating a configuration with the defaults will yield a... | 2 | 1 | 36 | 1 | 35 | 0 | 1 | 1.32 | 1 | 4 | 0 | 0 | 1 | 15 | 1 | 1 | 100 | 12 | 38 | 37 | 18 | 50 | 20 | 19 | 18 | 1 | 1 | 0 | 1 |
2,535 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/configuration_flava.py | transformers.models.flava.configuration_flava.FlavaMultimodalConfig | from ...configuration_utils import PretrainedConfig
class FlavaMultimodalConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`FlavaMultimodalModel`]. It is used to instantiate
an FLAVA model according to the specified arguments, defining the model architecture.
... |
class FlavaMultimodalConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`FlavaMultimodalModel`]. It is used to instantiate
an FLAVA model according to the specified arguments, defining the model architecture.
Instantiating a configuration with the defaults wi... | 2 | 1 | 28 | 1 | 27 | 0 | 1 | 1.37 | 1 | 4 | 0 | 0 | 1 | 11 | 1 | 1 | 84 | 13 | 30 | 29 | 14 | 41 | 16 | 15 | 14 | 1 | 1 | 0 | 1 |
2,536 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/configuration_flava.py | transformers.models.flava.configuration_flava.FlavaTextConfig | from ...configuration_utils import PretrainedConfig
class FlavaTextConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`FlavaTextModel`]. It is used to instantiate an
FLAVA model according to the specified arguments, defining the model architecture.
Instantia... |
class FlavaTextConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`FlavaTextModel`]. It is used to instantiate an
FLAVA model according to the specified arguments, defining the model architecture.
Instantiating a configuration with the defaults will yield a s... | 2 | 1 | 36 | 1 | 35 | 0 | 1 | 1.61 | 1 | 5 | 0 | 0 | 1 | 15 | 1 | 1 | 111 | 12 | 38 | 37 | 18 | 61 | 20 | 19 | 18 | 1 | 1 | 0 | 1 |
2,537 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/feature_extraction_flava.py | transformers.models.flava.feature_extraction_flava.FlavaFeatureExtractor | from ...utils.import_utils import requires
import warnings
from .image_processing_flava import FlavaImageProcessor
@requires(backends=('vision',))
class FlavaFeatureExtractor(FlavaImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn('The class FlavaFeatureExtractor is deprecated and... | @requires(backends=('vision',))
class FlavaFeatureExtractor(FlavaImageProcessor):
def __init__(self, *args, **kwargs) -> None:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 28 | 8 | 0 | 8 | 2 | 6 | 0 | 4 | 2 | 2 | 1 | 4 | 0 | 1 |
2,538 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/image_processing_flava.py | transformers.models.flava.image_processing_flava.FlavaImageProcessor | import numpy as np
from collections.abc import Iterable
from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...utils.import_utils import requires
from ...utils import TensorType, filter_out_non_signature_kwargs, is_vision_available, logging
from ...image_transforms import resize, ... | @requires(backends=('vision',))
class FlavaImageProcessor(BaseImageProcessor):
'''
Constructs a Flava image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by the
... | 12 | 5 | 66 | 4 | 46 | 17 | 8 | 0.64 | 1 | 10 | 3 | 1 | 6 | 29 | 7 | 27 | 565 | 34 | 324 | 146 | 214 | 207 | 126 | 44 | 118 | 33 | 3 | 1 | 58 |
2,539 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/image_processing_flava.py | transformers.models.flava.image_processing_flava.FlavaMaskingGenerator | import random
import numpy as np
from typing import Any, Optional, Union
import math
class FlavaMaskingGenerator:
def __init__(self, input_size: Union[int, tuple[int, int]]=14, total_mask_patches: int=75, mask_group_max_patches: Optional[int]=None, mask_group_min_patches: int=16, mask_group_min_aspect_ratio: Opti... |
class FlavaMaskingGenerator:
def __init__(self, input_size: Union[int, tuple[int, int]]=14, total_mask_patches: int=75, mask_group_max_patches: Optional[int]=None, mask_group_min_patches: int=16, mask_group_min_aspect_ratio: Optional[float]=0.3, mask_group_max_aspect_ratio: Optional[float]=None):
pass
... | 6 | 0 | 14 | 1 | 13 | 0 | 3 | 0.02 | 0 | 4 | 0 | 0 | 5 | 7 | 5 | 5 | 76 | 11 | 64 | 36 | 50 | 1 | 47 | 28 | 41 | 8 | 0 | 6 | 16 |
2,540 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaAttention | from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
from torch import nn
from typing import Any, Optional, Union
import torch
class FlavaAttention(nn.Module):
def __init__(self, config: FlavaPossibleConfigs) -> None:
super().__init__()
self.attention = FlavaSelfAttent... |
class FlavaAttention(nn.Module):
def __init__(self, config: FlavaPossibleConfigs) -> None:
pass
def prune_heads(self, heads: set[int]) -> None:
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, output_... | 4 | 0 | 12 | 1 | 10 | 1 | 1 | 0.09 | 1 | 7 | 2 | 0 | 3 | 3 | 3 | 13 | 40 | 6 | 32 | 17 | 22 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
2,541 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaEncoder | from torch import nn
from .configuration_flava import FlavaConfig, FlavaImageCodebookConfig, FlavaImageConfig, FlavaMultimodalConfig, FlavaTextConfig
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from typing import Any, Optional, Union
class FlavaEncoder(nn.Module):
def ... |
class FlavaEncoder(nn.Module):
def __init__(self, config: FlavaConfig) -> None:
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, output_hidden_states: bool=False, return_dict: bool=T... | 3 | 0 | 24 | 4 | 20 | 0 | 6 | 0 | 1 | 9 | 3 | 0 | 2 | 3 | 2 | 12 | 49 | 8 | 41 | 19 | 30 | 0 | 24 | 11 | 21 | 10 | 1 | 2 | 11 |
2,542 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaForPreTraining | from torch import nn
from .configuration_flava import FlavaConfig, FlavaImageCodebookConfig, FlavaImageConfig, FlavaMultimodalConfig, FlavaTextConfig
import torch
from typing import Any, Optional, Union
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, logging, torch_int
@auto_docstrin... | @auto_docstring(custom_intro='\n The FLAVA model for pretraining which outputs losses, embeddings, logits and transformer outputs.\n ')
class FlavaForPreTraining(FlavaPreTrainedModel):
def __init__(self, config: FlavaConfig, image_codebook: Optional[nn.Module]=None):
'''
image_codebook ([`nn.... | 6 | 2 | 118 | 15 | 91 | 13 | 15 | 0.14 | 1 | 14 | 8 | 0 | 3 | 18 | 3 | 4 | 370 | 47 | 283 | 70 | 256 | 40 | 151 | 48 | 147 | 40 | 2 | 3 | 44 |
2,543 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaForPreTrainingOutput | import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from typing import Any, Optional, Union
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, logging, torch_int
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro="\n Output ... | @dataclass
@auto_docstring(custom_intro="\n Output from FlavaForPreTraining containing embeddings, and outputs from individual encoders.\n\n Note that `image_embeddings` and `text_embeddings` returned are similar to pooled output returned from a\n transformer. If you want embeddings for contrastive loss or ret... | 4 | 1 | 10 | 0 | 10 | 0 | 2 | 1.84 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 97 | 6 | 32 | 24 | 30 | 59 | 25 | 24 | 23 | 2 | 1 | 0 | 2 |
2,544 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaGlobalContrastiveHead | from torch import nn
import torch
class FlavaGlobalContrastiveHead(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.global_backprop_contrastive = config.global_backprop_contrastive
def forward(self, image_embeddings, text_embeddings, logit_scale):
... |
class FlavaGlobalContrastiveHead(nn.Module):
def __init__(self, config):
pass
def forward(self, image_embeddings, text_embeddings, logit_scale):
pass | 3 | 0 | 18 | 3 | 15 | 1 | 2 | 0.07 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 38 | 6 | 30 | 14 | 27 | 2 | 26 | 13 | 23 | 3 | 1 | 2 | 4 |
2,545 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaITMHead | from torch import nn
class FlavaITMHead(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.pooler = FlavaPooler(config)
self.seq_relationship = nn.Linear(config.hidden_size, 2)
def forward(self, x):
x = self.pooler(x)
x = self.... |
class FlavaITMHead(nn.Module):
def __init__(self, config):
pass
def forward(self, x):
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 2 | 3 | 2 | 12 | 11 | 1 | 10 | 6 | 7 | 0 | 10 | 6 | 7 | 1 | 1 | 0 | 2 |
2,546 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaImageCodebook | from torch import nn
from .configuration_flava import FlavaConfig, FlavaImageCodebookConfig, FlavaImageConfig, FlavaMultimodalConfig, FlavaTextConfig
import torch
from typing import Any, Optional, Union
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, logging, torch_int
from collection... | @auto_docstring(custom_intro="\n The FLAVA's image codebook model inspired from DALL-E's original encoder. Outputs raw hidden states and can be used\n to generate image tokens for an image based on DALL-E's vocab. Used to generate labels for MIM. Use\n `get_codebook_indices` to get image tokens for an image.\n... | 6 | 0 | 27 | 5 | 22 | 0 | 2 | 0 | 1 | 7 | 2 | 0 | 4 | 7 | 4 | 5 | 115 | 22 | 93 | 26 | 84 | 0 | 43 | 22 | 38 | 3 | 2 | 2 | 8 |
2,547 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaImageCodebookBlock | from torch import nn
import torch
class FlavaImageCodebookBlock(nn.Module):
def __init__(self, in_size: int, out_size: int, num_layers: int, **kwargs):
super().__init__()
self.post_gain = 1 / num_layers ** 2
if in_size != out_size:
self.id_path = nn.Conv2d(in_size, out_size, ke... |
class FlavaImageCodebookBlock(nn.Module):
def __init__(self, in_size: int, out_size: int, num_layers: int, **kwargs):
pass
def forward(self, x: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 7 | 2 | 5 | 0 | 2 | 0 | 1 | 4 | 1 | 0 | 2 | 3 | 2 | 12 | 15 | 4 | 11 | 6 | 8 | 0 | 10 | 6 | 7 | 2 | 1 | 1 | 3 |
2,548 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaImageCodebookLayerGroup | from torch import nn
import torch
from collections import OrderedDict
class FlavaImageCodebookLayerGroup(nn.Module):
def __init__(self, num_blocks: int, num_layers: int, in_size: int, out_size: int, use_pool: bool=True):
super().__init__()
blocks = OrderedDict()
for i in range(num_blocks):... |
class FlavaImageCodebookLayerGroup(nn.Module):
def __init__(self, num_blocks: int, num_layers: int, in_size: int, out_size: int, use_pool: bool=True):
pass
def forward(self, x: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 8 | 1 | 7 | 0 | 3 | 0 | 1 | 7 | 1 | 0 | 2 | 1 | 2 | 12 | 17 | 3 | 14 | 6 | 11 | 0 | 13 | 6 | 10 | 4 | 1 | 2 | 5 |
2,549 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaImageCodebookResPath | from torch import nn
import torch
from collections import OrderedDict
class FlavaImageCodebookResPath(nn.Module):
def __init__(self, in_size: int, out_size: int, **kwargs):
super().__init__()
hid_size = out_size // 4
path = OrderedDict()
path['relu_1'] = nn.ReLU()
path['con... |
class FlavaImageCodebookResPath(nn.Module):
def __init__(self, in_size: int, out_size: int, **kwargs):
pass
def forward(self, x: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 9 | 1 | 8 | 0 | 1 | 0 | 1 | 4 | 0 | 0 | 2 | 1 | 2 | 12 | 19 | 3 | 16 | 6 | 13 | 0 | 16 | 6 | 13 | 1 | 1 | 0 | 2 |
2,550 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaImageEmbeddings | from torch import nn
from .configuration_flava import FlavaConfig, FlavaImageCodebookConfig, FlavaImageConfig, FlavaMultimodalConfig, FlavaTextConfig
import torch
from typing import Any, Optional, Union
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, logging, torch_int
class FlavaIma... |
class FlavaImageEmbeddings(nn.Module):
'''
Construct the CLS token, position and patch embeddings. Optionally, also the mask token.
'''
def __init__(self, config: FlavaImageConfig, use_mask_token: bool=False) -> None:
pass
def interpolate_pos_encoding(self, embeddings: torch.Tensor, heigh... | 4 | 2 | 29 | 5 | 20 | 4 | 3 | 0.26 | 1 | 6 | 2 | 0 | 3 | 7 | 3 | 13 | 96 | 19 | 61 | 31 | 52 | 16 | 45 | 26 | 41 | 4 | 1 | 2 | 8 |
2,551 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaImageModel | from torch import nn
from .configuration_flava import FlavaConfig, FlavaImageCodebookConfig, FlavaImageConfig, FlavaMultimodalConfig, FlavaTextConfig
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from typing import Any, Optional, Union
from ...utils import ModelOutput, auto_do... | @auto_docstring
class FlavaImageModel(FlavaPreTrainedModel):
def __init__(self, config: FlavaImageConfig, add_pooling_layer: bool=True):
'''
add_pooling_layer (bool, *optional*, defaults to `True`):
Whether to add a pooling layer
'''
pass
def get_input_embeddings(se... | 8 | 3 | 15 | 2 | 11 | 2 | 3 | 0.15 | 1 | 11 | 5 | 0 | 5 | 5 | 5 | 6 | 93 | 15 | 68 | 30 | 44 | 10 | 34 | 19 | 28 | 7 | 2 | 1 | 13 |
2,552 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaIntermediate | import torch
from torch import nn
from ...activations import ACT2FN
class FlavaIntermediate(nn.Module):
def __init__(self, config: FlavaPossibleConfigs) -> None:
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isinstance(config.hidden_act, str):
... |
class FlavaIntermediate(nn.Module):
def __init__(self, config: FlavaPossibleConfigs) -> None:
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 1 | 6 | 0 | 2 | 0.08 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 15 | 2 | 12 | 5 | 9 | 1 | 11 | 5 | 8 | 2 | 1 | 1 | 3 |
2,553 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaLayer | from torch import nn
from typing import Any, Optional, Union
from ...modeling_layers import GradientCheckpointingLayer
import torch
class FlavaLayer(GradientCheckpointingLayer):
"""This corresponds to the Block class in the timm implementation."""
def __init__(self, config: FlavaPossibleConfigs) -> None:
... |
class FlavaLayer(GradientCheckpointingLayer):
'''This corresponds to the Block class in the timm implementation.'''
def __init__(self, config: FlavaPossibleConfigs) -> None:
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, head_mask: Optional[torch.... | 3 | 1 | 20 | 3 | 15 | 3 | 1 | 0.23 | 1 | 6 | 3 | 0 | 2 | 7 | 2 | 12 | 44 | 8 | 31 | 20 | 22 | 7 | 20 | 14 | 17 | 1 | 1 | 0 | 2 |
2,554 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaLosses | from dataclasses import dataclass
from typing import Any, Optional, Union
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, logging, torch_int
import torch
@dataclass
@auto_docstring(custom_intro='\n Class representing pretraining losses from FLAVA model\n ')
class FlavaLosses(Mo... | @dataclass
@auto_docstring(custom_intro='\n Class representing pretraining losses from FLAVA model\n ')
class FlavaLosses(ModelOutput):
'''
mim (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `mim_labels` and `pixel_values` are present, `input_ids_masked` is absent and `mim_weight` > 0.):
... | 4 | 1 | 7 | 0 | 7 | 0 | 3 | 1.21 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 34 | 3 | 14 | 10 | 12 | 17 | 14 | 10 | 12 | 3 | 1 | 2 | 3 |
2,555 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaMaskedPredictionHead | from torch import nn
import torch
class FlavaMaskedPredictionHead(nn.Module):
def __init__(self, config, weight=None):
super().__init__()
self.config = config
self.transform = FlavaPredictionHeadTransform(config)
self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=... |
class FlavaMaskedPredictionHead(nn.Module):
def __init__(self, config, weight=None):
pass
def _tie_weights(self):
pass
def forward(self, x):
pass | 4 | 0 | 6 | 0 | 5 | 0 | 1 | 0.06 | 1 | 2 | 1 | 0 | 3 | 4 | 3 | 13 | 20 | 3 | 16 | 8 | 12 | 1 | 16 | 8 | 12 | 2 | 1 | 1 | 4 |
2,556 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaModel | from torch import nn
from .configuration_flava import FlavaConfig, FlavaImageCodebookConfig, FlavaImageConfig, FlavaMultimodalConfig, FlavaTextConfig
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from typing import Any, Optional, Union
from ...utils import ModelOutput, auto_do... | @auto_docstring
class FlavaModel(FlavaPreTrainedModel):
def __init__(self, config: FlavaConfig):
pass
@filter_out_non_signature_kwargs()
@auto_docstring
def get_text_features(self, input_ids: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None,... | 11 | 3 | 64 | 10 | 48 | 7 | 4 | 0.15 | 1 | 15 | 9 | 0 | 4 | 12 | 4 | 5 | 267 | 42 | 198 | 78 | 155 | 29 | 74 | 41 | 69 | 9 | 2 | 3 | 15 |
2,557 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaModelOutput | from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, logging, torch_int
from dataclasses import dataclass
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from typing import Any, Optional, Union
@dataclass
@auto_docstring(custom_intro="\n Output ... | @dataclass
@auto_docstring(custom_intro="\n Output from FlavaModel containing embeddings and outputs from individual encoders.\n\n Note that `image_embeddings` and `text_embeddigns` returned are similar to pooled output returned from a\n transformer. If you want embeddings for contrastive loss or retrieval use... | 4 | 1 | 5 | 0 | 5 | 0 | 2 | 1.58 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 35 | 4 | 12 | 8 | 10 | 19 | 9 | 8 | 7 | 2 | 1 | 0 | 2 |
2,558 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaMultimodalModel | from torch import nn
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, logging, torch_int
from typing import Any, Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
import torch
from .configuration_flava import FlavaConfig, FlavaImageCodebookConf... | @auto_docstring
class FlavaMultimodalModel(FlavaPreTrainedModel):
def __init__(self, config: FlavaMultimodalConfig, add_pooling_layer=True):
'''
add_pooling_layer (bool, *optional*, defaults to `True`):
Whether to add a pooling layer
'''
pass
def _prune_heads(self, ... | 6 | 3 | 25 | 3 | 19 | 3 | 4 | 0.14 | 1 | 9 | 4 | 0 | 3 | 6 | 3 | 4 | 92 | 13 | 69 | 31 | 49 | 10 | 37 | 20 | 33 | 8 | 2 | 1 | 13 |
2,559 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaOutput | import torch
from torch import nn
class FlavaOutput(nn.Module):
def __init__(self, config: FlavaPossibleConfigs) -> None:
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.dropout = nn.Dropout(config.hidden_dropout_prob)
def forward(self, hid... |
class FlavaOutput(nn.Module):
def __init__(self, config: FlavaPossibleConfigs) -> None:
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 1 | 5 | 0 | 1 | 0.1 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 14 | 3 | 10 | 5 | 7 | 1 | 10 | 5 | 7 | 1 | 1 | 0 | 2 |
2,560 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaPooler | from torch import nn
import torch
class FlavaPooler(nn.Module):
def __init__(self, config: FlavaPossibleConfigs):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
def forward(self, hidden_states: torch.Tensor):
first... |
class FlavaPooler(nn.Module):
def __init__(self, config: FlavaPossibleConfigs):
pass
def forward(self, hidden_states: torch.Tensor):
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.2 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 10 | 7 | 7 | 2 | 10 | 7 | 7 | 1 | 1 | 0 | 2 |
2,561 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaPreTrainedModel | from torch import nn
from .configuration_flava import FlavaConfig, FlavaImageCodebookConfig, FlavaImageConfig, FlavaMultimodalConfig, FlavaTextConfig
from ...modeling_utils import PreTrainedModel
from typing import Any, Optional, Union
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, l... | @auto_docstring
class FlavaPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: Union[nn.Linear, nn.Conv2d, nn.LayerNorm]) -> None:
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.44 | 1 | 0 | 0 | 6 | 1 | 0 | 1 | 1 | 25 | 2 | 16 | 5 | 14 | 7 | 14 | 5 | 12 | 6 | 1 | 2 | 6 |
2,562 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaPredictionHeadTransform | from torch import nn
from ...activations import ACT2FN
class FlavaPredictionHeadTransform(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 = ACT... |
class FlavaPredictionHeadTransform(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 |
2,563 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaSelfAttention | import torch
from torch import nn
from typing import Any, Optional, Union
import math
class FlavaSelfAttention(nn.Module):
def __init__(self, config: FlavaPossibleConfigs) -> None:
super().__init__()
if config.hidden_size % config.num_attention_heads != 0 and (not hasattr(config, 'embedding_size')... |
class FlavaSelfAttention(nn.Module):
def __init__(self, config: FlavaPossibleConfigs) -> None:
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False) -> Union[tuple[torch.Tensor, torch.Ten... | 3 | 0 | 21 | 4 | 14 | 2 | 2 | 0.14 | 1 | 5 | 0 | 0 | 3 | 7 | 3 | 13 | 65 | 15 | 44 | 27 | 34 | 6 | 35 | 21 | 31 | 4 | 1 | 1 | 7 |
2,564 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaSelfOutput | from torch import nn
import torch
class FlavaSelfOutput(nn.Module):
"""
The residual connection is defined in FlavaLayer (same as ViTLayer) instead of here (as is the case with other
models), due to the layernorm applied before each block.
"""
def __init__(self, config: FlavaPossibleConfigs) -> No... |
class FlavaSelfOutput(nn.Module):
'''
The residual connection is defined in FlavaLayer (same as ViTLayer) instead of here (as is the case with other
models), due to the layernorm applied before each block.
'''
def __init__(self, config: FlavaPossibleConfigs) -> None:
pass
def forward(... | 3 | 1 | 5 | 1 | 4 | 0 | 1 | 0.44 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 16 | 3 | 9 | 5 | 6 | 4 | 9 | 5 | 6 | 1 | 1 | 0 | 2 |
2,565 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaTextEmbeddings | from torch import nn
from typing import Any, Optional, Union
import torch
class FlavaTextEmbeddings(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, co... |
class FlavaTextEmbeddings(nn.Module):
'''Construct the embeddings from word, position and token_type embeddings.'''
def __init__(self, config):
pass
def forward(self, input_ids: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, position_ids: Optional[torch.Tensor]=None):
... | 3 | 1 | 26 | 3 | 20 | 3 | 3 | 0.17 | 1 | 2 | 0 | 0 | 2 | 6 | 2 | 12 | 55 | 7 | 41 | 22 | 33 | 7 | 31 | 17 | 28 | 5 | 1 | 2 | 6 |
2,566 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.FlavaTextModel | from torch import nn
from .configuration_flava import FlavaConfig, FlavaImageCodebookConfig, FlavaImageConfig, FlavaMultimodalConfig, FlavaTextConfig
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from typing import Any, Optional, Union
from ...utils import ModelOutput, auto_do... | @auto_docstring
class FlavaTextModel(FlavaPreTrainedModel):
def __init__(self, config: FlavaTextConfig, add_pooling_layer: bool=True):
'''
add_pooling_layer (bool, *optional*, defaults to `True`):
Whether to add a pooling layer
'''
pass
def get_input_embeddings(self... | 8 | 3 | 17 | 2 | 13 | 2 | 3 | 0.14 | 1 | 12 | 6 | 0 | 5 | 5 | 5 | 6 | 99 | 16 | 73 | 31 | 51 | 10 | 37 | 20 | 31 | 8 | 2 | 1 | 14 |
2,567 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/modeling_flava.py | transformers.models.flava.modeling_flava.PatchEmbeddings | from typing import Any, Optional, Union
import collections
from torch import nn
import torch
class PatchEmbeddings(nn.Module):
"""
Image to Patch Embedding.
"""
def __init__(self, image_size: int=224, patch_size: Union[int, tuple[int, int]]=16, num_channels: int=3, embed_dim: int=768):
super()... |
class PatchEmbeddings(nn.Module):
'''
Image to Patch Embedding.
'''
def __init__(self, image_size: int=224, patch_size: Union[int, tuple[int, int]]=16, num_channels: int=3, embed_dim: int=768):
pass
def forward(self, pixel_values: torch.Tensor, interpolate_pos_encoding: bool=False) -> tor... | 3 | 1 | 14 | 1 | 14 | 0 | 3 | 0.11 | 1 | 5 | 0 | 0 | 2 | 4 | 2 | 12 | 34 | 3 | 28 | 16 | 19 | 3 | 19 | 10 | 16 | 3 | 1 | 2 | 6 |
2,568 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/flava/processing_flava.py | transformers.models.flava.processing_flava.FlavaProcessor | from ...processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin
import warnings
class FlavaProcessor(ProcessorMixin):
"""
Constructs a FLAVA processor which wraps a FLAVA image processor and a FLAVA tokenizer into a single processor.
[`FlavaProcessor`] offers all the functionalities of [`Fl... |
class FlavaProcessor(ProcessorMixin):
'''
Constructs a FLAVA processor which wraps a FLAVA image processor and a FLAVA tokenizer into a single processor.
[`FlavaProcessor`] offers all the functionalities of [`FlavaImageProcessor`] and [`BertTokenizerFast`]. See the
[`~FlavaProcessor.__call__`] and [`~F... | 6 | 1 | 16 | 1 | 13 | 2 | 2 | 0.21 | 1 | 10 | 2 | 0 | 7 | 1 | 7 | 24 | 138 | 16 | 101 | 41 | 69 | 21 | 42 | 17 | 34 | 6 | 2 | 1 | 16 |
2,569 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/configuration_fnet.py | transformers.models.fnet.configuration_fnet.FNetConfig | from ...configuration_utils import PretrainedConfig
class FNetConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`FNetModel`]. It is used to instantiate an FNet
model according to the specified arguments, defining the model architecture. Instantiating a configura... |
class FNetConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`FNetModel`]. It is used to instantiate an FNet
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar conf... | 2 | 1 | 33 | 1 | 32 | 0 | 1 | 1.41 | 1 | 1 | 0 | 0 | 1 | 12 | 1 | 1 | 93 | 11 | 34 | 33 | 14 | 48 | 16 | 15 | 14 | 1 | 1 | 0 | 1 |
2,570 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetBasicFourierTransform | from ...utils import logging
from ...utils import auto_docstring, is_scipy_available
from functools import partial
import torch
from torch import nn
class FNetBasicFourierTransform(nn.Module):
def __init__(self, config):
super().__init__()
self._init_fourier_transform(config)
def _init_fourie... |
class FNetBasicFourierTransform(nn.Module):
def __init__(self, config):
pass
def _init_fourier_transform(self, config):
pass
def forward(self, hidden_states):
pass | 4 | 0 | 11 | 0 | 9 | 1 | 2 | 0.14 | 1 | 2 | 0 | 0 | 3 | 2 | 3 | 13 | 36 | 3 | 29 | 7 | 25 | 4 | 17 | 6 | 13 | 4 | 1 | 2 | 6 |
2,571 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetBasicOutput | from torch import nn
class FNetBasicOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
def forward(self, hidden_states, input_tensor):
hidden_states = self.LayerNorm(input_tensor + hidden_state... |
class FNetBasicOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, input_tensor):
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 8 | 1 | 7 | 4 | 4 | 0 | 7 | 4 | 4 | 1 | 1 | 0 | 2 |
2,572 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetEmbeddings | from torch import nn
import torch
class FNetEmbeddings(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.hidden_size, padding_idx=config.pad_toke... |
class FNetEmbeddings(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 | 28 | 5 | 20 | 4 | 4 | 0.2 | 1 | 1 | 0 | 0 | 2 | 6 | 2 | 12 | 59 | 11 | 40 | 16 | 37 | 8 | 34 | 16 | 31 | 6 | 1 | 2 | 7 |
2,573 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetEncoder | from torch import nn
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, ModelOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
class FNetEncoder(nn.Module):
def __init__(self, conf... |
class FNetEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, output_hidden_states=False, return_dict=True):
pass | 3 | 0 | 13 | 3 | 10 | 0 | 4 | 0 | 1 | 6 | 2 | 0 | 2 | 3 | 2 | 12 | 28 | 7 | 21 | 9 | 18 | 0 | 20 | 9 | 17 | 7 | 1 | 2 | 8 |
2,574 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetForMaskedLM | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Optional, Union
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, ModelOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOutput, SequenceClassi... | @auto_docstring
class FNetForMaskedLM(FNetPreTrainedModel):
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, token_type_ids... | 7 | 1 | 13 | 2 | 10 | 2 | 2 | 0.17 | 1 | 6 | 3 | 0 | 4 | 2 | 4 | 5 | 65 | 11 | 47 | 24 | 27 | 8 | 25 | 14 | 20 | 5 | 2 | 1 | 8 |
2,575 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetForMultipleChoice | from ...utils import auto_docstring, is_scipy_available
from typing import Optional, Union
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, ModelOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput... | @auto_docstring
class FNetForMultipleChoice(FNetPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, position_ids: Optional[torch.Tensor]=None, inputs_embeds: Optional[torch.Tensor]=... | 5 | 1 | 31 | 5 | 23 | 4 | 6 | 0.13 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 70 | 10 | 53 | 24 | 35 | 7 | 27 | 14 | 24 | 10 | 2 | 1 | 11 |
2,576 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetForNextSentencePrediction | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...utils import auto_docstring, is_scipy_available
from typing import Optional, Union
import torch
import warnings
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, ModelOutput, MultipleChoiceModelOutput, N... | @auto_docstring(custom_intro='\n FNet Model with a `next sentence prediction (classification)` head on top.\n ')
class FNetForNextSentencePrediction(FNetPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, token_type_ids:... | 5 | 1 | 41 | 8 | 23 | 11 | 4 | 0.43 | 1 | 7 | 3 | 0 | 2 | 2 | 2 | 3 | 86 | 16 | 49 | 22 | 34 | 21 | 22 | 11 | 19 | 6 | 2 | 1 | 7 |
2,577 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetForPreTraining | import torch
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...utils import auto_docstring, is_scipy_available
from typing import Optional, Union
@auto_docstring(custom_intro='\n FNet Model with two heads on top as done during the pretraining: a `masked language modeling` head and a `next\n ... | @auto_docstring(custom_intro='\n FNet Model with two heads on top as done during the pretraining: a `masked language modeling` head and a `next\n sentence prediction (classification)` head.\n ')
class FNetForPreTraining(FNetPreTrainedModel):
def __init__(self, config):
pass
def get_output_emb... | 7 | 1 | 21 | 3 | 12 | 6 | 2 | 0.49 | 1 | 6 | 3 | 0 | 4 | 2 | 4 | 5 | 92 | 16 | 51 | 27 | 34 | 25 | 27 | 16 | 22 | 5 | 2 | 1 | 8 |
2,578 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetForPreTrainingOutput | from dataclasses import dataclass
import torch
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, ModelOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutpu... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`FNetForPreTraining`].\n ')
class FNetForPreTrainingOutput(ModelOutput):
'''
loss (*optional*, returned when `labels` is provided, `torch.FloatTensor` of shape `(1,)`):
Total loss as the sum of the masked language modeling loss and the ne... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 23 | 2 | 5 | 5 | 4 | 16 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
2,579 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetForQuestionAnswering | from ...utils import auto_docstring, is_scipy_available
from torch import nn
import torch
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, ModelOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, Qu... | @auto_docstring
class FNetForQuestionAnswering(FNetPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, position_ids: Optional[torch.Tensor]=None, inputs_embeds: Optional[torch.Tenso... | 5 | 0 | 37 | 5 | 25 | 7 | 4 | 0.23 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 81 | 11 | 57 | 27 | 38 | 13 | 32 | 16 | 29 | 7 | 2 | 2 | 8 |
2,580 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetForSequenceClassification | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Optional, Union
from torch import nn
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, ModelOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOutput, Sequen... | @auto_docstring(custom_intro='\n FNet Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled\n output) e.g. for GLUE tasks.\n ')
class FNetForSequenceClassification(FNetPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
... | 5 | 1 | 34 | 4 | 27 | 4 | 7 | 0.11 | 1 | 6 | 2 | 0 | 2 | 4 | 2 | 3 | 76 | 8 | 61 | 23 | 43 | 7 | 34 | 13 | 31 | 12 | 2 | 3 | 13 |
2,581 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetForTokenClassification | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, ModelOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, T... | @auto_docstring
class FNetForTokenClassification(FNetPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, position_ids: Optional[torch.Tensor]=None, inputs_embeds: Optional[torch.Ten... | 5 | 1 | 26 | 5 | 19 | 3 | 3 | 0.14 | 1 | 5 | 2 | 0 | 2 | 4 | 2 | 3 | 60 | 10 | 44 | 23 | 26 | 6 | 22 | 13 | 19 | 5 | 2 | 1 | 6 |
2,582 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetFourierTransform | from torch import nn
class FNetFourierTransform(nn.Module):
def __init__(self, config):
super().__init__()
self.self = FNetBasicFourierTransform(config)
self.output = FNetBasicOutput(config)
def forward(self, hidden_states):
self_outputs = self.self(hidden_states)
four... |
class FNetFourierTransform(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 3 | 2 | 0 | 2 | 2 | 2 | 12 | 11 | 1 | 10 | 8 | 7 | 0 | 10 | 8 | 7 | 1 | 1 | 0 | 2 |
2,583 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetIntermediate | from torch import nn
from ...activations import ACT2FN
import torch
class FNetIntermediate(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_ac... |
class FNetIntermediate(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 |
2,584 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetLMPredictionHead | from torch import nn
import torch
class FNetLMPredictionHead(nn.Module):
def __init__(self, config):
super().__init__()
self.transform = FNetPredictionHeadTransform(config)
self.decoder = nn.Linear(config.hidden_size, config.vocab_size)
self.bias = nn.Parameter(torch.zeros(config.v... |
class FNetLMPredictionHead(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass
def _tie_weights(self) -> None:
pass | 4 | 0 | 7 | 1 | 5 | 1 | 1 | 0.25 | 1 | 2 | 1 | 0 | 3 | 3 | 3 | 13 | 24 | 4 | 16 | 7 | 12 | 4 | 15 | 7 | 11 | 2 | 1 | 1 | 4 |
2,585 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetLayer | from ...modeling_layers import GradientCheckpointingLayer
from ...pytorch_utils import apply_chunking_to_forward
class FNetLayer(GradientCheckpointingLayer):
def __init__(self, config):
super().__init__()
self.chunk_size_feed_forward = config.chunk_size_feed_forward
self.seq_len_dim = 1
... |
class FNetLayer(GradientCheckpointingLayer):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass
def feed_forward_chunk(self, fourier_output):
pass | 4 | 0 | 7 | 1 | 6 | 0 | 1 | 0.05 | 1 | 4 | 3 | 0 | 3 | 5 | 3 | 13 | 25 | 5 | 20 | 15 | 16 | 1 | 18 | 15 | 14 | 1 | 1 | 0 | 3 |
2,586 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetModel | import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, MaskedLMOutput, ModelOutput, MultipleChoiceModelOutput, NextSentencePredictorOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from typing import Optional, Union
from ...utils import auto_docstr... | @auto_docstring
class FNetModel(FNetPreTrainedModel):
'''
The model can behave as an encoder, following the architecture described in [FNet: Mixing Tokens with Fourier
Transforms](https://huggingface.co/papers/2105.03824) by James Lee-Thorp, Joshua Ainslie, Ilya Eckstein, Santiago Ontanon.
'''
def ... | 7 | 2 | 21 | 3 | 18 | 0 | 4 | 0.06 | 1 | 9 | 5 | 0 | 4 | 4 | 4 | 5 | 100 | 17 | 78 | 27 | 59 | 5 | 38 | 18 | 33 | 12 | 2 | 2 | 16 |
2,587 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetOnlyMLMHead | from torch import nn
class FNetOnlyMLMHead(nn.Module):
def __init__(self, config):
super().__init__()
self.predictions = FNetLMPredictionHead(config)
def forward(self, sequence_output):
prediction_scores = self.predictions(sequence_output)
return prediction_scores |
class FNetOnlyMLMHead(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 |
2,588 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetOnlyNSPHead | from torch import nn
class FNetOnlyNSPHead(nn.Module):
def __init__(self, config):
super().__init__()
self.seq_relationship = nn.Linear(config.hidden_size, 2)
def forward(self, pooled_output):
seq_relationship_score = self.seq_relationship(pooled_output)
return seq_relationshi... |
class FNetOnlyNSPHead(nn.Module):
def __init__(self, config):
pass
def forward(self, pooled_output):
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 8 | 1 | 7 | 5 | 4 | 0 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
2,589 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetOutput | import torch
from torch import nn
class FNetOutput(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(... |
class FNetOutput(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 |
2,590 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetPooler | import torch
from torch import nn
class FNetPooler(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: torch.Tensor) -> torch.Tensor:
first_token_... |
class FNetPooler(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.2 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 10 | 7 | 7 | 2 | 10 | 7 | 7 | 1 | 1 | 0 | 2 |
2,591 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetPreTrainedModel | from ...utils import auto_docstring, is_scipy_available
from .configuration_fnet import FNetConfig
from torch import nn
from ...modeling_utils import PreTrainedModel
@auto_docstring
class FNetPreTrainedModel(PreTrainedModel):
config: FNetConfig
base_model_prefix = 'fnet'
supports_gradient_checkpointing = T... | @auto_docstring
class FNetPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 16 | 0 | 12 | 4 | 6 | 0.5 | 1 | 0 | 0 | 8 | 1 | 0 | 1 | 1 | 26 | 2 | 16 | 5 | 14 | 8 | 14 | 5 | 12 | 6 | 1 | 2 | 6 |
2,592 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetPreTrainingHeads | from torch import nn
class FNetPreTrainingHeads(nn.Module):
def __init__(self, config):
super().__init__()
self.predictions = FNetLMPredictionHead(config)
self.seq_relationship = nn.Linear(config.hidden_size, 2)
def forward(self, sequence_output, pooled_output):
prediction_sco... |
class FNetPreTrainingHeads(nn.Module):
def __init__(self, config):
pass
def forward(self, sequence_output, pooled_output):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 2 | 2 | 2 | 12 | 10 | 1 | 9 | 7 | 6 | 0 | 9 | 7 | 6 | 1 | 1 | 0 | 2 |
2,593 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/modeling_fnet.py | transformers.models.fnet.modeling_fnet.FNetPredictionHeadTransform | from torch import nn
from ...activations import ACT2FN
import torch
class FNetPredictionHeadTransform(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_... |
class FNetPredictionHeadTransform(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 12 | 15 | 1 | 14 | 6 | 11 | 0 | 13 | 6 | 10 | 2 | 1 | 1 | 3 |
2,594 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/tokenization_fnet.py | transformers.models.fnet.tokenization_fnet.FNetTokenizer | from ...tokenization_utils import AddedToken, PreTrainedTokenizer
import unicodedata
from ...utils.import_utils import requires
import os
from shutil import copyfile
import sentencepiece as spm
from typing import Any, Optional
@requires(backends=('sentencepiece',))
class FNetTokenizer(PreTrainedTokenizer):
"""
... | @requires(backends=('sentencepiece',))
class FNetTokenizer(PreTrainedTokenizer):
'''
Construct an FNet tokenizer. Adapted from [`AlbertTokenizer`]. Based on
[SentencePiece](https://github.com/google/sentencepiece). This tokenizer inherits from [`PreTrainedTokenizer`]
which contains most of the main meth... | 17 | 7 | 16 | 1 | 11 | 3 | 3 | 0.6 | 1 | 6 | 0 | 0 | 15 | 7 | 15 | 104 | 304 | 42 | 164 | 71 | 121 | 98 | 111 | 43 | 95 | 6 | 3 | 4 | 40 |
2,595 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/fnet/tokenization_fnet_fast.py | transformers.models.fnet.tokenization_fnet_fast.FNetTokenizerFast | from ...tokenization_utils import AddedToken
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from shutil import copyfile
import os
from typing import Optional
class FNetTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" FNetTokenizer (backed by HuggingFace's *tokenizers* library). Ad... |
class FNetTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" FNetTokenizer (backed by HuggingFace's *tokenizers* library). Adapted from
[`AlbertTokenizerFast`]. Based on
[Unigram](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=unigram#models). This
tokeni... | 4 | 2 | 21 | 2 | 12 | 6 | 3 | 0.94 | 1 | 4 | 0 | 0 | 5 | 4 | 5 | 93 | 149 | 19 | 67 | 36 | 43 | 63 | 35 | 18 | 29 | 4 | 3 | 1 | 14 |
2,596 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/focalnet/configuration_focalnet.py | transformers.models.focalnet.configuration_focalnet.FocalNetConfig | from ...configuration_utils import PretrainedConfig
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices
class FocalNetConfig(BackboneConfigMixin, PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`FocalNetModel`]. It is used ... |
class FocalNetConfig(BackboneConfigMixin, PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`FocalNetModel`]. It is used to instantiate a
FocalNet model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the de... | 2 | 1 | 54 | 1 | 53 | 0 | 1 | 1.31 | 2 | 2 | 0 | 0 | 1 | 24 | 1 | 6 | 137 | 10 | 55 | 52 | 27 | 72 | 27 | 26 | 25 | 1 | 1 | 0 | 1 |
2,597 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/focalnet/modeling_focalnet.py | transformers.models.focalnet.modeling_focalnet.FocalNetBackbone | import torch
from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_outputs import BackboneOutput
from .configuration_focalnet import FocalNetConfig
from typing import Optional, Union
from ...utils.backbone_utils import BackboneMixin
@auto_docstring(custom_intro='\n FocalNet backbone, to be used... | @auto_docstring(custom_intro='\n FocalNet backbone, to be used with frameworks like X-Decoder.\n ')
class FocalNetBackbone(FocalNetPreTrainedModel, BackboneMixin):
def __init__(self, config: FocalNetConfig):
pass
@auto_docstring
def forward(self, pixel_values: torch.Tensor, output_hidden_stat... | 5 | 1 | 30 | 6 | 16 | 8 | 5 | 0.46 | 2 | 7 | 3 | 0 | 2 | 2 | 2 | 15 | 64 | 13 | 35 | 16 | 25 | 16 | 22 | 10 | 19 | 8 | 2 | 2 | 9 |
2,598 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/focalnet/modeling_focalnet.py | transformers.models.focalnet.modeling_focalnet.FocalNetDropPath | from torch import nn
import torch
from typing import Optional, Union
class FocalNetDropPath(nn.Module):
"""Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks)."""
def __init__(self, drop_prob: Optional[float]=None) -> None:
super().__init__()
self.drop_prob ... |
class FocalNetDropPath(nn.Module):
'''Drop paths (Stochastic Depth) per sample (when applied in main path of residual blocks).'''
def __init__(self, drop_prob: Optional[float]=None) -> None:
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass
def extra_repr(self... | 4 | 1 | 2 | 0 | 2 | 0 | 1 | 0.13 | 1 | 4 | 0 | 0 | 3 | 1 | 3 | 13 | 12 | 3 | 8 | 5 | 4 | 1 | 8 | 5 | 4 | 1 | 1 | 0 | 3 |
2,599 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/focalnet/modeling_focalnet.py | transformers.models.focalnet.modeling_focalnet.FocalNetEmbeddings | from typing import Optional, Union
import torch
from torch import nn
class FocalNetEmbeddings(nn.Module):
"""
Construct the patch embeddings and layernorm. Optionally, also the mask token.
"""
def __init__(self, config, use_mask_token=False):
super().__init__()
self.patch_embeddings = ... |
class FocalNetEmbeddings(nn.Module):
'''
Construct the patch embeddings and layernorm. Optionally, also the mask token.
'''
def __init__(self, config, use_mask_token=False):
pass
def forward(self, pixel_values: Optional[torch.FloatTensor], bool_masked_pos: Optional[torch.BoolTensor]=None)... | 3 | 1 | 16 | 2 | 14 | 1 | 2 | 0.14 | 1 | 3 | 1 | 0 | 2 | 5 | 2 | 12 | 38 | 6 | 28 | 14 | 23 | 4 | 18 | 12 | 15 | 2 | 1 | 1 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.