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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1,000 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2TextEmbeddings | from typing import Any, Callable, Optional, Union
import torch
from torch import nn
class Blip2TextEmbeddings(nn.Module):
"""Construct the embeddings from word and position embeddings."""
def __init__(self, config):
super().__init__()
self.word_embeddings = nn.Embedding(config.vocab_size, conf... |
class Blip2TextEmbeddings(nn.Module):
'''Construct the embeddings from word and position embeddings.'''
def __init__(self, config):
pass
def forward(self, input_ids: Optional[torch.FloatTensor]=None, position_ids: Optional[torch.LongTensor]=None, query_embeds: Optional[torch.FloatTensor]=None) ->... | 3 | 1 | 19 | 3 | 16 | 1 | 4 | 0.06 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 41 | 7 | 32 | 14 | 24 | 2 | 23 | 9 | 20 | 6 | 1 | 2 | 7 |
1,001 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2TextModelWithProjection | from ...processing_utils import Unpack
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
import torch
from .configuration_blip_2 import Blip2Config, Blip2QFormerConfig, Blip2VisionConfig
from torch import nn
from typing import Any... | @auto_docstring
class Blip2TextModelWithProjection(Blip2PreTrainedModel):
def __init__(self, config: Blip2Config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optio... | 8 | 1 | 21 | 4 | 11 | 5 | 2 | 0.4 | 1 | 8 | 4 | 0 | 4 | 4 | 4 | 5 | 91 | 21 | 50 | 25 | 35 | 20 | 25 | 16 | 20 | 4 | 2 | 1 | 7 |
1,002 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2VisionEmbeddings | from .configuration_blip_2 import Blip2Config, Blip2QFormerConfig, Blip2VisionConfig
import torch
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
from torch import nn
class Blip2VisionEmbeddings(nn.Module):
def __init__(se... |
class Blip2VisionEmbeddings(nn.Module):
def __init__(self, config: Blip2VisionConfig):
pass
def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width: int) -> torch.Tensor:
'''
This method allows to interpolate the pre-trained position encodings, to be able to us... | 4 | 1 | 23 | 5 | 16 | 3 | 2 | 0.19 | 1 | 5 | 1 | 0 | 3 | 9 | 3 | 13 | 72 | 16 | 48 | 27 | 44 | 9 | 40 | 27 | 36 | 2 | 1 | 1 | 5 |
1,003 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2VisionModel | from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
from typing import Any, Callable, Optional, Union
from ...utils.generic import OutputRecorder, check_model_inputs
from torch import nn
from ...processing_utils import Unpack
from .... | @auto_docstring
class Blip2VisionModel(Blip2PreTrainedModel):
def __init__(self, config: Blip2VisionConfig):
pass
@check_model_inputs
@auto_docstring
def forward(self, pixel_values: Optional[torch.FloatTensor]=None, interpolate_pos_encoding: bool=False, **kwargs: Unpack[TransformersKwargs]) -> ... | 7 | 0 | 19 | 3 | 15 | 1 | 3 | 0.06 | 1 | 7 | 4 | 0 | 3 | 4 | 3 | 4 | 65 | 13 | 49 | 23 | 36 | 3 | 28 | 15 | 24 | 6 | 2 | 1 | 8 |
1,004 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2VisionModelWithProjection | from torch import nn
from ...processing_utils import Unpack
from .configuration_blip_2 import Blip2Config, Blip2QFormerConfig, Blip2VisionConfig
import torch
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
from typing import Any... | @auto_docstring
class Blip2VisionModelWithProjection(Blip2PreTrainedModel):
def __init__(self, config: Blip2Config):
pass
def get_input_embeddings(self) -> nn.Module:
pass
@can_return_tuple
@auto_docstring
def forward(self, pixel_values: Optional[torch.FloatTensor]=None, **kwargs: ... | 7 | 1 | 30 | 6 | 16 | 8 | 3 | 0.45 | 1 | 7 | 4 | 0 | 3 | 4 | 3 | 4 | 99 | 22 | 53 | 25 | 41 | 24 | 28 | 18 | 24 | 7 | 2 | 1 | 9 |
1,005 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/processing_blip_2.py | transformers.models.blip_2.processing_blip_2.Blip2Processor | from ...image_utils import ImageInput
from ...image_processing_utils import BatchFeature
from typing import Optional, Union
from ...processing_utils import ProcessingKwargs, ProcessorMixin, Unpack
from ...tokenization_utils_base import AddedToken, BatchEncoding, PreTokenizedInput, TextInput
class Blip2Processor(Proces... |
class Blip2Processor(ProcessorMixin):
'''
Constructs a BLIP-2 processor which wraps a BLIP image processor and an OPT/T5 tokenizer into a single processor.
[`BlipProcessor`] offers all the functionalities of [`BlipImageProcessor`] and [`AutoTokenizer`]. See the docstring
of [`~BlipProcessor.__call__`] ... | 3 | 2 | 22 | 1 | 14 | 7 | 3 | 0.64 | 1 | 9 | 3 | 0 | 5 | 3 | 5 | 22 | 138 | 15 | 75 | 32 | 61 | 48 | 50 | 24 | 44 | 9 | 2 | 3 | 14 |
1,006 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/processing_blip_2.py | transformers.models.blip_2.processing_blip_2.Blip2ProcessorKwargs | from ...processing_utils import ProcessingKwargs, ProcessorMixin, Unpack
class Blip2ProcessorKwargs(ProcessingKwargs, total=False):
_defaults = {'text_kwargs': {'add_special_tokens': True, 'padding': False, 'stride': 0, 'return_overflowing_tokens': False, 'return_special_tokens_mask': False, 'return_offsets_mappin... |
class Blip2ProcessorKwargs(ProcessingKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 15 | 0 | 15 | 2 | 14 | 0 | 2 | 2 | 1 | 0 | 3 | 0 | 0 |
1,007 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bloom/configuration_bloom.py | transformers.models.bloom.configuration_bloom.BloomConfig | from ...configuration_utils import PretrainedConfig
class BloomConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`BloomModel`]. It is used to instantiate a Bloom
model according to the specified arguments, defining the model architecture. Instantiating a configu... |
class BloomConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`BloomModel`]. It is used to instantiate a Bloom
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar co... | 2 | 1 | 37 | 2 | 34 | 2 | 2 | 1.37 | 1 | 1 | 0 | 0 | 1 | 14 | 1 | 1 | 108 | 12 | 41 | 37 | 22 | 56 | 21 | 20 | 19 | 2 | 1 | 0 | 2 |
1,008 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bloom/configuration_bloom.py | transformers.models.bloom.configuration_bloom.BloomOnnxConfig | from collections.abc import Mapping
from ...onnx import OnnxConfigWithPast, PatchingSpec
from typing import TYPE_CHECKING, Any, Optional
from ...configuration_utils import PretrainedConfig
from collections import OrderedDict
from ...utils import is_torch_available, logging
from packaging import version
class BloomOnnx... |
class BloomOnnxConfig(OnnxConfigWithPast):
def __init__(self, config: PretrainedConfig, task: str='default', patching_specs: Optional[list[PatchingSpec]]=None, use_past: bool=False):
pass
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def num_layers(s... | 13 | 0 | 11 | 1 | 9 | 1 | 2 | 0.07 | 1 | 9 | 0 | 0 | 7 | 0 | 7 | 7 | 91 | 13 | 73 | 38 | 46 | 5 | 39 | 19 | 30 | 4 | 1 | 2 | 12 |
1,009 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bloom/modeling_bloom.py | transformers.models.bloom.modeling_bloom.BloomAttention | from typing import Optional, Union
import math
from torch import nn
from ...cache_utils import Cache, DynamicCache, StaticCache
from torch.nn import functional as F
from .configuration_bloom import BloomConfig
import torch
class BloomAttention(nn.Module):
def __init__(self, config: BloomConfig, layer_idx: Optiona... |
class BloomAttention(nn.Module):
def __init__(self, config: BloomConfig, layer_idx: Optional[int]=None):
pass
def _reshape(self, fused_qkv: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
'''
Split the last dimension into (num_heads, head_dim) and reshapes to (bs, he... | 5 | 2 | 38 | 7 | 23 | 9 | 3 | 0.39 | 1 | 8 | 2 | 0 | 4 | 13 | 4 | 14 | 156 | 29 | 93 | 49 | 77 | 36 | 66 | 38 | 61 | 7 | 1 | 2 | 12 |
1,010 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bloom/modeling_bloom.py | transformers.models.bloom.modeling_bloom.BloomBlock | import torch
from ...modeling_layers import GradientCheckpointingLayer
from .configuration_bloom import BloomConfig
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
from ...cache_utils import Cache, DynamicCache, StaticCache
from typing import Optional, Union
class BloomBlock(GradientCheckp... |
class BloomBlock(GradientCheckpointingLayer):
def __init__(self, config: BloomConfig, layer_idx: Optional[int]=None):
pass
def forward(self, hidden_states: torch.Tensor, alibi: torch.Tensor, attention_mask: torch.Tensor, layer_past: Optional[Cache]=None, head_mask: Optional[torch.Tensor]=None, use_ca... | 3 | 0 | 35 | 7 | 25 | 4 | 3 | 0.14 | 1 | 8 | 4 | 0 | 2 | 7 | 2 | 12 | 71 | 14 | 51 | 27 | 38 | 7 | 28 | 17 | 25 | 4 | 1 | 1 | 5 |
1,011 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bloom/modeling_bloom.py | transformers.models.bloom.modeling_bloom.BloomForCausalLM | from typing import Optional, Union
import warnings
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast, TokenClassifierOutput
from torch import nn
from ...generation import GenerationMixin
from ...ut... | @auto_docstring(custom_intro='\n The Bloom Model transformer with a language modeling head on top (linear layer with weights tied to the input\n embeddings).\n ')
class BloomForCausalLM(BloomPreTrainedModel, GenerationMixin):
def __init__(self, config: BloomConfig):
pass
def set_output_embedd... | 7 | 1 | 28 | 2 | 21 | 6 | 3 | 0.27 | 2 | 11 | 5 | 0 | 6 | 2 | 6 | 8 | 182 | 19 | 131 | 50 | 93 | 36 | 50 | 23 | 43 | 7 | 2 | 2 | 18 |
1,012 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bloom/modeling_bloom.py | transformers.models.bloom.modeling_bloom.BloomForQuestionAnswering | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
import torch
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast, TokenClassifierOutput
from typing import Optional, Union... | @auto_docstring
class BloomForQuestionAnswering(BloomPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, position_ids: Optional[torch.LongTensor]=None, head_mask: Optional[... | 5 | 1 | 39 | 4 | 29 | 7 | 4 | 0.22 | 1 | 4 | 2 | 0 | 2 | 2 | 2 | 4 | 81 | 9 | 59 | 28 | 43 | 13 | 31 | 15 | 28 | 7 | 2 | 2 | 8 |
1,013 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bloom/modeling_bloom.py | transformers.models.bloom.modeling_bloom.BloomForSequenceClassification | from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast, TokenClassifierOutput
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
import torch
import warnings
from ...utils impo... | null | 5 | 1 | 56 | 5 | 46 | 5 | 10 | 0.09 | 1 | 10 | 4 | 0 | 2 | 3 | 2 | 4 | 119 | 11 | 99 | 31 | 77 | 9 | 49 | 17 | 46 | 18 | 2 | 3 | 19 |
1,014 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bloom/modeling_bloom.py | transformers.models.bloom.modeling_bloom.BloomForTokenClassification | import warnings
from .configuration_bloom import BloomConfig
from ...cache_utils import Cache, DynamicCache, StaticCache
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
import torch
from torch import nn
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutputWithPast... | @auto_docstring
class BloomForTokenClassification(BloomPreTrainedModel):
def __init__(self, config: BloomConfig):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[Union[Cache, tuple[tuple[torch.Tensor, torch.Tensor], ...]]]=None, attention... | 5 | 1 | 42 | 4 | 34 | 5 | 5 | 0.12 | 1 | 9 | 4 | 0 | 2 | 4 | 2 | 4 | 92 | 9 | 74 | 29 | 52 | 9 | 32 | 15 | 29 | 7 | 2 | 1 | 10 |
1,015 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bloom/modeling_bloom.py | transformers.models.bloom.modeling_bloom.BloomGelu | from torch import nn
import torch
class BloomGelu(nn.Module):
"""
BloomBiasGelu wrapper function that make use of the simple function on inference mode to make the model
torchscriptable and use the autograd function in training mode to get the accurate results of the gradients Partly
copied from Megatr... |
class BloomGelu(nn.Module):
'''
BloomBiasGelu wrapper function that make use of the simple function on inference mode to make the model
torchscriptable and use the autograd function in training mode to get the accurate results of the gradients Partly
copied from Megatron-DeepSpeed code and adapted for ... | 3 | 1 | 4 | 0 | 4 | 0 | 2 | 0.75 | 1 | 3 | 1 | 0 | 2 | 0 | 2 | 12 | 17 | 3 | 8 | 3 | 5 | 6 | 7 | 3 | 4 | 2 | 1 | 1 | 3 |
1,016 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bloom/modeling_bloom.py | transformers.models.bloom.modeling_bloom.BloomMLP | from torch import nn
from .configuration_bloom import BloomConfig
from torch.nn import functional as F
import torch
class BloomMLP(nn.Module):
def __init__(self, config: BloomConfig):
super().__init__()
hidden_size = config.hidden_size
self.pretraining_tp = config.pretraining_tp
se... |
class BloomMLP(nn.Module):
def __init__(self, config: BloomConfig):
pass
def forward(self, hidden_states: torch.Tensor, residual: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 14 | 2 | 12 | 0 | 2 | 0 | 1 | 6 | 2 | 0 | 2 | 6 | 2 | 12 | 29 | 5 | 24 | 14 | 21 | 0 | 20 | 14 | 17 | 3 | 1 | 2 | 4 |
1,017 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bloom/modeling_bloom.py | transformers.models.bloom.modeling_bloom.BloomModel | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
import warnings
from ...cache_utils import Cache, DynamicCache, StaticCache
from torch import nn
from .configuration_bloom import BloomConfig
import torch
from ...utils import auto_docstring, is_torch_flex_attn_available, logging
from ...model... | @auto_docstring
class BloomModel(BloomPreTrainedModel):
def __init__(self, config: BloomConfig):
pass
def build_alibi_tensor(self, attention_mask: torch.Tensor, num_heads: int, dtype: torch.dtype) -> torch.Tensor:
pass
def get_input_embeddings(self):
pass
def set_input_embedd... | 11 | 2 | 41 | 5 | 30 | 6 | 6 | 0.21 | 1 | 16 | 7 | 0 | 6 | 7 | 7 | 9 | 301 | 39 | 218 | 70 | 174 | 46 | 111 | 39 | 103 | 27 | 2 | 2 | 44 |
1,018 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bloom/modeling_bloom.py | transformers.models.bloom.modeling_bloom.BloomPreTrainedModel | from ...utils import auto_docstring, is_torch_flex_attn_available, logging
from ...modeling_utils import PreTrainedModel
from .configuration_bloom import BloomConfig
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, LayerNorm, MSELoss
from torch import nn
@auto_docstring
class BloomPreTrainedModel(PreTrainedMo... | @auto_docstring
class BloomPreTrainedModel(PreTrainedModel):
def __init__(self, *inputs, **kwargs):
pass
def _init_weights(self, module: nn.Module):
'''Initialize the weights.'''
pass | 4 | 1 | 9 | 0 | 7 | 2 | 4 | 0.13 | 1 | 1 | 0 | 5 | 2 | 0 | 2 | 2 | 28 | 2 | 23 | 11 | 20 | 3 | 21 | 11 | 18 | 6 | 1 | 2 | 7 |
1,019 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bloom/modeling_bloom.py | transformers.models.bloom.modeling_bloom.GeLUFunction | import torch
class GeLUFunction(torch.autograd.Function):
@staticmethod
def forward(ctx, input: torch.Tensor) -> torch.Tensor:
ctx.save_for_backward(input)
return bloom_gelu_forward(input)
@staticmethod
def backward(ctx, grad_output: torch.Tensor) -> torch.Tensor:
input = ctx.... |
class GeLUFunction(torch.autograd.Function):
@staticmethod
def forward(ctx, input: torch.Tensor) -> torch.Tensor:
pass
@staticmethod
def backward(ctx, grad_output: torch.Tensor) -> torch.Tensor:
pass | 5 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 2 | 32 | 11 | 1 | 10 | 6 | 5 | 0 | 8 | 4 | 5 | 1 | 5 | 0 | 2 |
1,020 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bloom/tokenization_bloom_fast.py | transformers.models.bloom.tokenization_bloom_fast.BloomTokenizerFast | from ...tokenization_utils_base import BatchEncoding
import pickle
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from typing import Optional
class BloomTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" Bloom tokenizer (backed by HuggingFace's *tokenizers* library). Based on byte-l... |
class BloomTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" Bloom tokenizer (backed by HuggingFace's *tokenizers* library). Based on byte-level
Byte-Pair-Encoding.
This tokenizer has been trained to treat spaces like parts of the tokens (a bit like sentencepiece) so a word will
be enc... | 5 | 1 | 15 | 1 | 13 | 1 | 2 | 0.79 | 1 | 5 | 1 | 0 | 4 | 1 | 4 | 92 | 120 | 20 | 56 | 26 | 39 | 44 | 27 | 14 | 22 | 2 | 3 | 1 | 7 |
1,021 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/configuration_bridgetower.py | transformers.models.bridgetower.configuration_bridgetower.BridgeTowerConfig | from ...configuration_utils import PretrainedConfig
class BridgeTowerConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`BridgeTowerModel`]. It is used to instantiate a
BridgeTower model according to the specified arguments, defining the model architecture. Insta... |
class BridgeTowerConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`BridgeTowerModel`]. It is used to instantiate a
BridgeTower model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will ... | 2 | 1 | 27 | 3 | 22 | 3 | 2 | 1.06 | 1 | 3 | 2 | 0 | 1 | 13 | 2 | 2 | 112 | 15 | 47 | 38 | 25 | 50 | 28 | 19 | 25 | 3 | 1 | 1 | 4 |
1,022 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/configuration_bridgetower.py | transformers.models.bridgetower.configuration_bridgetower.BridgeTowerTextConfig | from ...configuration_utils import PretrainedConfig
class BridgeTowerTextConfig(PretrainedConfig):
"""
This is the configuration class to store the text configuration of a [`BridgeTowerModel`]. The default values here
are copied from RoBERTa. Instantiating a configuration with the defaults will yield a sim... |
class BridgeTowerTextConfig(PretrainedConfig):
'''
This is the configuration class to store the text configuration of a [`BridgeTowerModel`]. The default values here
are copied from RoBERTa. Instantiating a configuration with the defaults will yield a similar configuration to that
of the bridgetower-ba... | 2 | 1 | 40 | 1 | 39 | 0 | 1 | 1.31 | 1 | 1 | 0 | 0 | 1 | 17 | 1 | 1 | 106 | 9 | 42 | 41 | 20 | 55 | 22 | 21 | 20 | 1 | 1 | 0 | 1 |
1,023 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/configuration_bridgetower.py | transformers.models.bridgetower.configuration_bridgetower.BridgeTowerVisionConfig | from ...configuration_utils import PretrainedConfig
class BridgeTowerVisionConfig(PretrainedConfig):
"""
This is the configuration class to store the vision configuration of a [`BridgeTowerModel`]. Instantiating a
configuration with the defaults will yield a similar configuration to that of the bridgetower... |
class BridgeTowerVisionConfig(PretrainedConfig):
'''
This is the configuration class to store the vision configuration of a [`BridgeTowerModel`]. Instantiating a
configuration with the defaults will yield a similar configuration to that of the bridgetower-base
[BridgeTower/bridgetower-base](https://hug... | 2 | 1 | 25 | 0 | 25 | 0 | 1 | 1.21 | 1 | 1 | 0 | 0 | 1 | 10 | 1 | 1 | 71 | 9 | 28 | 27 | 13 | 34 | 15 | 14 | 13 | 1 | 1 | 0 | 1 |
1,024 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/image_processing_bridgetower.py | transformers.models.bridgetower.image_processing_bridgetower.BridgeTowerImageProcessor | from ...utils import TensorType, filter_out_non_signature_kwargs, is_vision_available, logging
from collections.abc import Iterable
from typing import Any, Optional, Union
import numpy as np
from ...image_transforms import PaddingMode, center_crop, pad, resize, to_channel_dimension_format
from ...image_utils import OPE... |
class BridgeTowerImageProcessor(BaseImageProcessor):
'''
Constructs a BridgeTower 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
`do_resize`... | 8 | 6 | 60 | 4 | 37 | 20 | 6 | 0.73 | 1 | 9 | 3 | 0 | 6 | 12 | 6 | 26 | 417 | 30 | 224 | 100 | 152 | 163 | 82 | 35 | 75 | 22 | 3 | 1 | 33 |
1,025 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerAttention | from typing import Callable, Optional, Union
from ...processing_utils import Unpack
from ...cache_utils import Cache, EncoderDecoderCache
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
import torch
from torch import nn
from ...utils import TransformersKwargs... |
class BridgeTowerAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, is_causal=False, layer_idx=None, is_cross_attention=False):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=N... | 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 |
1,026 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerBertCrossLayer | from ...processing_utils import Unpack
from torch import nn
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging, torch_int
class BridgeTowerBertCrossLayer(nn.Module):
... |
class BridgeTowerBertCrossLayer(nn.Module):
def __init__(self, config, layer_idx=None):
pass
def forward(self, hidden_states, encoder_hidden_states, attention_mask=None, head_mask=None, encoder_attention_mask=None, past_key_value=None, **kwargs: Unpack[TransformersKwargs]):
pass
def feed... | 4 | 0 | 19 | 1 | 16 | 1 | 1 | 0.08 | 1 | 4 | 3 | 0 | 3 | 8 | 3 | 13 | 60 | 6 | 50 | 28 | 37 | 4 | 25 | 19 | 21 | 1 | 1 | 0 | 3 |
1,027 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerContrastiveHead | from torch import nn
class BridgeTowerContrastiveHead(nn.Module):
def __init__(self, hidden_size, embed_size):
super().__init__()
self.fc = nn.Linear(hidden_size, embed_size)
def forward(self, x):
x = self.fc(x)
return x |
class BridgeTowerContrastiveHead(nn.Module):
def __init__(self, hidden_size, embed_size):
pass
def forward(self, x):
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 |
1,028 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerContrastiveOutput | from dataclasses import dataclass
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging, torch_int
import torch
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, MaskedLMOutput, ModelOutput, SequenceClassifie... | @dataclass
@auto_docstring(custom_intro="\n Output type of ['BridgeTowerForContrastiveLearning']\n ")
class BridgeTowerContrastiveOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `return_loss` is `True`):
Image-text contrastive loss.
logits (`torch.... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.63 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 31 | 2 | 8 | 8 | 7 | 21 | 8 | 8 | 7 | 0 | 1 | 0 | 0 |
1,029 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerForContrastiveLearning | import torch
from torch import nn
from typing import Callable, Optional, Union
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging, torch_int
@auto_docstring(custom_intro='\n BridgeTower Model with a image-text contrastive head on top computing image-text contrastive loss.... | @auto_docstring(custom_intro='\n BridgeTower Model with a image-text contrastive head on top computing image-text contrastive loss.\n ')
class BridgeTowerForContrastiveLearning(BridgeTowerPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[... | 5 | 1 | 66 | 12 | 40 | 15 | 4 | 0.35 | 1 | 5 | 3 | 0 | 2 | 5 | 2 | 3 | 135 | 24 | 82 | 41 | 63 | 29 | 38 | 26 | 35 | 7 | 2 | 1 | 8 |
1,030 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerForImageAndTextRetrieval | from torch.nn import CrossEntropyLoss
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging, torch_int
import torch
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, MaskedLMOutput, ModelOutput, SequenceClass... | @auto_docstring(custom_intro='\n BridgeTower Model transformer with a classifier head on top (a linear layer on top of the final hidden state of the\n [CLS] token) for image-to-text matching.\n ')
class BridgeTowerForImageAndTextRetrieval(BridgeTowerPreTrainedModel):
def __init__(self, config):
pa... | 5 | 1 | 45 | 8 | 25 | 12 | 4 | 0.45 | 1 | 6 | 3 | 0 | 2 | 2 | 2 | 3 | 93 | 16 | 53 | 26 | 34 | 24 | 20 | 11 | 17 | 6 | 2 | 1 | 7 |
1,031 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerForMaskedLM | from torch.nn import CrossEntropyLoss
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging, torch_int
import torch
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, MaskedLMOutput, ModelOutput, SequenceClass... | @auto_docstring(custom_intro='\n BridgeTower Model with a language modeling head on top as done during pretraining.\n ')
class BridgeTowerForMaskedLM(BridgeTowerPreTrainedModel):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, n... | 7 | 1 | 23 | 4 | 13 | 7 | 2 | 0.46 | 1 | 6 | 3 | 0 | 4 | 2 | 4 | 5 | 100 | 18 | 57 | 28 | 36 | 26 | 24 | 13 | 19 | 6 | 2 | 1 | 9 |
1,032 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerITMHead | from torch import nn
class BridgeTowerITMHead(nn.Module):
def __init__(self, hidden_size):
super().__init__()
self.fc = nn.Linear(hidden_size, 2)
def forward(self, x):
itm_score = self.fc(x)
return itm_score |
class BridgeTowerITMHead(nn.Module):
def __init__(self, hidden_size):
pass
def forward(self, x):
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 |
1,033 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerIntermediate | import torch
from torch import nn
from ...activations import ACT2FN, QuickGELUActivation
class BridgeTowerIntermediate(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isinstance(config.hidden_act, str):
... |
class BridgeTowerIntermediate(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 |
1,034 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerLinkTower | import torch
from torch import nn
class BridgeTowerLinkTower(nn.Module):
def __init__(self, config):
super().__init__()
self.link_tower_type = config.link_tower_type
self.hidden_size = config.hidden_size
if config.link_tower_type in ['add', 'scaled_add', 'interpolate']:
... |
class BridgeTowerLinkTower(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, cross_modal_hidden_states, attention_mask):
pass | 3 | 0 | 11 | 0 | 11 | 0 | 4 | 0 | 1 | 2 | 0 | 0 | 2 | 5 | 2 | 12 | 23 | 1 | 22 | 8 | 19 | 0 | 17 | 8 | 14 | 4 | 1 | 2 | 8 |
1,035 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerMLMHead | import torch
from torch import nn
class BridgeTowerMLMHead(nn.Module):
def __init__(self, config, weight=None):
super().__init__()
self.config = config
self.transform = BridgeTowerPredictionHeadTransform(config)
self.decoder = nn.Linear(config.hidden_size, config.text_config.vocab_... |
class BridgeTowerMLMHead(nn.Module):
def __init__(self, config, weight=None):
pass
def forward(self, x):
pass | 3 | 0 | 6 | 0 | 6 | 0 | 2 | 0 | 1 | 2 | 1 | 0 | 2 | 4 | 2 | 12 | 14 | 1 | 13 | 8 | 10 | 0 | 13 | 8 | 10 | 2 | 1 | 1 | 3 |
1,036 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerModel | import torch
from torch import nn
from typing import Callable, Optional, Union
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging, torch_int
@auto_docstring(custom_intro='\n The bare BridgeTower Model transformer outputting BridgeTowerModelOutput object without any specif... | @auto_docstring(custom_intro='\n The bare BridgeTower Model transformer outputting BridgeTowerModelOutput object without any specific head on\n ')
class BridgeTowerModel(BridgeTowerPreTrainedModel):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_... | 8 | 1 | 59 | 10 | 41 | 8 | 7 | 0.19 | 1 | 13 | 6 | 0 | 5 | 14 | 5 | 6 | 301 | 52 | 210 | 72 | 186 | 39 | 116 | 54 | 110 | 26 | 2 | 2 | 34 |
1,037 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerModelOutput | from dataclasses import dataclass
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging, torch_int
import torch
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, MaskedLMOutput, ModelOutput, SequenceClassifie... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`BridgeTowerModel`].\n ')
class BridgeTowerModelOutput(ModelOutput):
'''
text_features (`torch.FloatTensor` of shape `(batch_size, text_sequence_length, hidden_size)`):
Sequence of hidden-states at the text output of the last layer of the... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 29 | 3 | 6 | 6 | 5 | 20 | 6 | 6 | 5 | 0 | 1 | 0 | 0 |
1,038 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerOutput | import torch
from torch import nn
class BridgeTowerOutput(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.D... |
class BridgeTowerOutput(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 |
1,039 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerPooler | import torch
from torch import nn
class BridgeTowerPooler(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... |
class BridgeTowerPooler(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 |
1,040 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerPreTrainedModel | from torch import nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_bridgetower import BridgeTowerConfig, BridgeTowerTextConfig, BridgeTowerVisionConfig
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging, torch_int
@auto_docstring
... | @auto_docstring
class BridgeTowerPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: nn.Module):
pass | 3 | 0 | 25 | 2 | 23 | 0 | 6 | 0.14 | 1 | 1 | 1 | 6 | 1 | 0 | 1 | 1 | 37 | 4 | 29 | 11 | 27 | 4 | 23 | 11 | 21 | 6 | 1 | 2 | 6 |
1,041 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerPredictionHeadTransform | from torch import nn
from ...activations import ACT2FN, QuickGELUActivation
class BridgeTowerPredictionHeadTransform(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
if isinstance(config.hidden_act, str):
... |
class BridgeTowerPredictionHeadTransform(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 |
1,042 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerResidualAttention | from collections import OrderedDict
from torch import nn
import torch
from typing import Callable, Optional, Union
from ...activations import ACT2FN, QuickGELUActivation
class BridgeTowerResidualAttention(nn.Module):
def __init__(self, config):
super().__init__()
self.attn = nn.MultiheadAttention(... |
class BridgeTowerResidualAttention(nn.Module):
def __init__(self, config):
pass
def attention(self, hidden_state: torch.Tensor, attention_mask: torch.Tensor):
pass
def forward(self, hidden_state: torch.Tensor, attention_mask: Optional[torch.Tensor]=None):
pass | 4 | 0 | 13 | 0 | 13 | 0 | 2 | 0 | 1 | 5 | 1 | 0 | 3 | 5 | 3 | 13 | 42 | 3 | 39 | 11 | 35 | 0 | 20 | 11 | 16 | 3 | 1 | 1 | 6 |
1,043 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerSelfAttention | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging, torch_int
from torch import nn
import torch
from ...cache_utils import Cache, EncoderDecoderCache
from ...processing_utils import Unpack
from typing impo... |
class BridgeTowerSelfAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, is_causal=False, layer_idx=None):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, past_key_value: Opti... | 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 |
1,044 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerSelfOutput | import torch
from torch import nn
class BridgeTowerSelfOutput(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.Dro... |
class BridgeTowerSelfOutput(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 |
1,045 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerTextEmbeddings | import torch
from torch import nn
from typing import Callable, Optional, Union
class BridgeTowerTextEmbeddings(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
super().__init__()
self.word_embeddings = nn.Embedding(config.voc... |
class BridgeTowerTextEmbeddings(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.Lo... | 7 | 3 | 26 | 3 | 18 | 5 | 3 | 0.32 | 1 | 1 | 0 | 0 | 3 | 7 | 3 | 13 | 87 | 13 | 56 | 23 | 50 | 18 | 43 | 21 | 39 | 8 | 1 | 2 | 10 |
1,046 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerTextEncoder | from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging, torch_int
from torch import nn
import torch
from ...cache_utils import Cache, EncoderDecoderCache
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, Maske... |
class BridgeTowerTextEncoder(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, encoder_hidden_states: Optional[torch.FloatTensor]=None, encoder_attention_mask: Opti... | 3 | 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 |
1,047 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerTextLayer | from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging, torch_int
import torch
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from ...cache_utils import Cache, EncoderDecoderCache
from ...processing_utils import Unpack... |
class BridgeTowerTextLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_idx=None):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.FloatTensor]=Non... | 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 |
1,048 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerTextModel | from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging, torch_int
from ...masking_utils import create_causal_mask
from ...utils.generic import can_return_tuple
import torch
fro... | null | 12 | 2 | 30 | 3 | 20 | 7 | 5 | 0.43 | 1 | 8 | 4 | 0 | 5 | 4 | 5 | 6 | 174 | 27 | 103 | 41 | 82 | 44 | 56 | 26 | 50 | 18 | 2 | 2 | 24 |
1,049 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerTransformer | import torch
from torch import nn
from typing import Callable, Optional, Union
class BridgeTowerTransformer(nn.Module):
def __init__(self, config):
super().__init__()
self.hidden_size = config.hidden_size
self.num_hidden_layers = config.num_hidden_layers
if config.remove_last_layer... |
class BridgeTowerTransformer(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_state: torch.Tensor, attention_mask: Optional[torch.Tensor]=None):
pass | 3 | 0 | 11 | 0 | 11 | 0 | 3 | 0 | 1 | 4 | 1 | 0 | 2 | 4 | 2 | 12 | 24 | 1 | 23 | 10 | 20 | 0 | 17 | 9 | 14 | 3 | 1 | 2 | 5 |
1,050 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerVisionEmbeddings | import torch
from torch import nn
from .configuration_bridgetower import BridgeTowerConfig, BridgeTowerTextConfig, BridgeTowerVisionConfig
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging, torch_int
class BridgeTowerVisionEmbeddings(nn.Module):
def __init__(self, conf... |
class BridgeTowerVisionEmbeddings(nn.Module):
def __init__(self, config: BridgeTowerVisionConfig):
pass
def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width: int) -> torch.Tensor:
'''
This method allows to interpolate the pre-trained position encodings, to b... | 4 | 1 | 26 | 5 | 19 | 3 | 2 | 0.16 | 1 | 5 | 1 | 0 | 3 | 9 | 3 | 13 | 81 | 16 | 57 | 27 | 53 | 9 | 43 | 27 | 39 | 3 | 1 | 1 | 6 |
1,051 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerVisionModel | from .configuration_bridgetower import BridgeTowerConfig, BridgeTowerTextConfig, BridgeTowerVisionConfig
class BridgeTowerVisionModel(BridgeTowerPreTrainedModel):
config: BridgeTowerVisionConfig
def __init__(self, config):
super().__init__(config)
self.visual = BridgeTowerVisionTransformer(con... |
class BridgeTowerVisionModel(BridgeTowerPreTrainedModel):
def __init__(self, config):
pass
@property
def dtype(self):
pass
def forward(self, image, image_mask=None, interpolate_pos_encoding=False):
pass | 5 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 3 | 1 | 3 | 4 | 13 | 3 | 10 | 7 | 5 | 0 | 9 | 6 | 5 | 1 | 2 | 0 | 3 |
1,052 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/modeling_bridgetower.py | transformers.models.bridgetower.modeling_bridgetower.BridgeTowerVisionTransformer | import torch
from torch import nn
class BridgeTowerVisionTransformer(nn.Module):
def __init__(self, config):
super().__init__()
self.embeddings = BridgeTowerVisionEmbeddings(config)
self.ln_pre = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.transformer = BridgeT... |
class BridgeTowerVisionTransformer(nn.Module):
def __init__(self, config):
pass
def forward(self, pixel_values: torch.Tensor, attention_mask, interpolate_pos_encoding: bool=False):
pass
def forward_pre(self, pixel_values: torch.Tensor, interpolate_pos_encoding: bool=False):
pass
... | 5 | 0 | 13 | 1 | 11 | 1 | 2 | 0.11 | 1 | 7 | 2 | 0 | 4 | 6 | 4 | 14 | 56 | 5 | 46 | 26 | 32 | 5 | 34 | 16 | 29 | 3 | 1 | 2 | 7 |
1,053 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/processing_bridgetower.py | transformers.models.bridgetower.processing_bridgetower.BridgeTowerProcessor | from ...processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin
class BridgeTowerProcessor(ProcessorMixin):
"""
Constructs a BridgeTower processor which wraps a Roberta tokenizer and BridgeTower image processor into a single
processor.
[`BridgeTowerProcessor`] offers all the functionali... |
class BridgeTowerProcessor(ProcessorMixin):
'''
Constructs a BridgeTower processor which wraps a Roberta tokenizer and BridgeTower image processor into a single
processor.
[`BridgeTowerProcessor`] offers all the functionalities of [`BridgeTowerImageProcessor`] and
[`RobertaTokenizerFast`]. See the ... | 2 | 1 | 9 | 0 | 5 | 3 | 1 | 0.81 | 1 | 5 | 2 | 0 | 5 | 0 | 5 | 22 | 68 | 10 | 32 | 22 | 18 | 26 | 20 | 14 | 14 | 1 | 2 | 0 | 5 |
1,054 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bridgetower/processing_bridgetower.py | transformers.models.bridgetower.processing_bridgetower.BridgeTowerProcessorKwargs | from ...processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin
class BridgeTowerProcessorKwargs(ProcessingKwargs, total=False):
images_kwargs: BridgeTowerImagesKwargs
_defaults = {'text_kwargs': {'add_special_tokens': True, 'padding': False, 'stride': 0, 'return_overflowing_tokens': False, 'ret... |
class BridgeTowerProcessorKwargs(ProcessingKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 17 | 0 | 17 | 2 | 16 | 0 | 2 | 2 | 1 | 0 | 3 | 0 | 0 |
1,055 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/configuration_bros.py | transformers.models.bros.configuration_bros.BrosConfig | from ...configuration_utils import PretrainedConfig
class BrosConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`BrosModel`] or a [`TFBrosModel`]. It is used to
instantiate a Bros model according to the specified arguments, defining the model architecture. Insta... |
class BrosConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`BrosModel`] or a [`TFBrosModel`]. It is used to
instantiate a Bros 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.2 | 1 | 1 | 0 | 0 | 1 | 7 | 1 | 1 | 112 | 11 | 46 | 30 | 24 | 55 | 11 | 10 | 9 | 1 | 1 | 0 | 1 |
1,056 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/modeling_bros.py | transformers.models.bros.modeling_bros.BrosAttention | import torch
from typing import Optional, Union
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from torch import nn
class BrosAttention(nn.Module):
def __init__(self, config):
super().__init__()
self.self = BrosSelfAttention(config)
... |
class BrosAttention(nn.Module):
def __init__(self, config):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states: torch.Tensor, bbox_pos_emb: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, encoder_hidden_states: Optio... | 4 | 0 | 16 | 1 | 15 | 1 | 1 | 0.07 | 1 | 6 | 2 | 0 | 3 | 3 | 3 | 13 | 52 | 4 | 46 | 21 | 32 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
1,057 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/modeling_bros.py | transformers.models.bros.modeling_bros.BrosBboxEmbeddings | from torch import nn
import torch
class BrosBboxEmbeddings(nn.Module):
def __init__(self, config):
super().__init__()
self.bbox_sinusoid_emb = BrosPositionalEmbedding2D(config)
self.bbox_projection = nn.Linear(config.dim_bbox_sinusoid_emb_2d, config.dim_bbox_projection, bias=False)
de... |
class BrosBboxEmbeddings(nn.Module):
def __init__(self, config):
pass
def forward(self, bbox: torch.Tensor):
pass | 3 | 0 | 6 | 1 | 5 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 2 | 2 | 2 | 12 | 13 | 2 | 11 | 8 | 8 | 0 | 11 | 8 | 8 | 1 | 1 | 0 | 2 |
1,058 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/modeling_bros.py | transformers.models.bros.modeling_bros.BrosEncoder | import torch
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, TokenClassifierOutput
from typing import Optional, Union
from torch import nn
from ...utils import ModelOutput, auto_docstring, can_return_tuple, logging
class BrosEncoder(nn.Module):
def... |
class BrosEncoder(nn.Module):
def __init__(self, config):
pass
@can_return_tuple
def forward(self, hidden_states: torch.Tensor, bbox_pos_emb: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.FloatTens... | 4 | 0 | 45 | 3 | 42 | 0 | 9 | 0 | 1 | 8 | 2 | 0 | 2 | 2 | 2 | 12 | 91 | 7 | 84 | 26 | 68 | 0 | 33 | 13 | 30 | 16 | 1 | 3 | 17 |
1,059 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/modeling_bros.py | transformers.models.bros.modeling_bros.BrosForTokenClassification | from typing import Optional, Union
from torch.nn import CrossEntropyLoss
from ...utils import ModelOutput, auto_docstring, can_return_tuple, logging
import torch
from torch import nn
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, TokenClassifierOutput
... | @auto_docstring
class BrosForTokenClassification(BrosPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, bbox: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, bbox_first_token_ma... | 6 | 1 | 45 | 8 | 30 | 7 | 4 | 0.2 | 1 | 5 | 2 | 0 | 2 | 4 | 2 | 3 | 95 | 18 | 64 | 30 | 45 | 13 | 27 | 15 | 24 | 6 | 2 | 2 | 8 |
1,060 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/modeling_bros.py | transformers.models.bros.modeling_bros.BrosIntermediate | from ...activations import ACT2FN
from torch import nn
import torch
class BrosIntermediate(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 BrosIntermediate(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 |
1,061 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/modeling_bros.py | transformers.models.bros.modeling_bros.BrosLayer | import torch
from ...modeling_layers import GradientCheckpointingLayer
from typing import Optional, Union
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
class BrosLayer(GradientCheckpointingLayer):
def __init__(self, config):
super().__init__()... |
class BrosLayer(GradientCheckpointingLayer):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, bbox_pos_emb: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.FloatTensor]=No... | 4 | 0 | 28 | 2 | 24 | 2 | 4 | 0.09 | 1 | 7 | 3 | 0 | 3 | 8 | 3 | 13 | 88 | 9 | 74 | 33 | 60 | 7 | 41 | 23 | 37 | 7 | 1 | 2 | 11 |
1,062 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/modeling_bros.py | transformers.models.bros.modeling_bros.BrosModel | from ...modeling_outputs import BaseModelOutputWithCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, TokenClassifierOutput
import torch
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, can_return_tuple, logging
@auto_docstring
class BrosModel(BrosPreTrainedModel):
... | @auto_docstring
class BrosModel(BrosPreTrainedModel):
def __init__(self, config, add_pooling_layer=True):
'''
add_pooling_layer (bool, *optional*, defaults to `True`):
Whether to add a pooling layer
'''
pass
def get_input_embeddings(self):
pass
def set_... | 9 | 3 | 32 | 5 | 22 | 6 | 5 | 0.26 | 1 | 9 | 5 | 0 | 5 | 5 | 5 | 6 | 169 | 28 | 112 | 45 | 88 | 29 | 61 | 28 | 55 | 20 | 2 | 2 | 26 |
1,063 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/modeling_bros.py | transformers.models.bros.modeling_bros.BrosOutput | from torch import nn
import torch
class BrosOutput(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 BrosOutput(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 |
1,064 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/modeling_bros.py | transformers.models.bros.modeling_bros.BrosPooler | import torch
from torch import nn
class BrosPooler(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 BrosPooler(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 |
1,065 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/modeling_bros.py | transformers.models.bros.modeling_bros.BrosPositionalEmbedding1D | import torch
from torch import nn
class BrosPositionalEmbedding1D(nn.Module):
def __init__(self, config):
super().__init__()
self.dim_bbox_sinusoid_emb_1d = config.dim_bbox_sinusoid_emb_1d
inv_freq = 1 / 10000 ** (torch.arange(0.0, self.dim_bbox_sinusoid_emb_1d, 2.0) / self.dim_bbox_sinuso... |
class BrosPositionalEmbedding1D(nn.Module):
def __init__(self, config):
pass
def forward(self, pos_seq: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 8 | 1 | 7 | 0 | 1 | 0.07 | 1 | 2 | 0 | 0 | 2 | 1 | 2 | 12 | 19 | 4 | 14 | 9 | 11 | 1 | 12 | 9 | 9 | 1 | 1 | 0 | 2 |
1,066 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/modeling_bros.py | transformers.models.bros.modeling_bros.BrosPositionalEmbedding2D | from torch import nn
import torch
class BrosPositionalEmbedding2D(nn.Module):
def __init__(self, config):
super().__init__()
self.dim_bbox = config.dim_bbox
self.x_pos_emb = BrosPositionalEmbedding1D(config)
self.y_pos_emb = BrosPositionalEmbedding1D(config)
def forward(self, ... |
class BrosPositionalEmbedding2D(nn.Module):
def __init__(self, config):
pass
def forward(self, bbox: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 8 | 1 | 7 | 0 | 2 | 0 | 1 | 4 | 1 | 0 | 2 | 3 | 2 | 12 | 17 | 2 | 15 | 9 | 12 | 0 | 14 | 9 | 11 | 3 | 1 | 2 | 4 |
1,067 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/modeling_bros.py | transformers.models.bros.modeling_bros.BrosPreTrainedModel | from torch import nn
from ...modeling_utils import PreTrainedModel
from .configuration_bros import BrosConfig
from ...utils import ModelOutput, auto_docstring, can_return_tuple, logging
@auto_docstring
class BrosPreTrainedModel(PreTrainedModel):
config: BrosConfig
base_model_prefix = 'bros'
def _init_weig... | @auto_docstring
class BrosPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: nn.Module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.47 | 1 | 0 | 0 | 4 | 1 | 0 | 1 | 1 | 24 | 2 | 15 | 4 | 13 | 7 | 13 | 4 | 11 | 6 | 1 | 2 | 6 |
1,068 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/modeling_bros.py | transformers.models.bros.modeling_bros.BrosRelationExtractor | from torch import nn
import torch
class BrosRelationExtractor(nn.Module):
def __init__(self, config):
super().__init__()
self.n_relations = config.n_relations
self.backbone_hidden_size = config.hidden_size
self.head_hidden_size = config.hidden_size
self.classifier_dropout_p... |
class BrosRelationExtractor(nn.Module):
def __init__(self, config):
pass
def forward(self, query_layer: torch.Tensor, key_layer: torch.Tensor):
pass | 3 | 0 | 15 | 4 | 12 | 1 | 1 | 0.04 | 1 | 2 | 0 | 0 | 2 | 8 | 2 | 12 | 32 | 8 | 24 | 13 | 21 | 1 | 20 | 13 | 17 | 1 | 1 | 0 | 2 |
1,069 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/modeling_bros.py | transformers.models.bros.modeling_bros.BrosSelfAttention | import math
from torch import nn
import torch
from typing import Optional, Union
class BrosSelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
if config.hidden_size % config.num_attention_heads != 0 and (not hasattr(config, 'embedding_size')):
raise ValueError(f'Th... |
class BrosSelfAttention(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, bbox_pos_emb: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, encoder_hidden_states: Optional[torch.Tensor]=None, encoder_attention_ma... | 3 | 0 | 44 | 7 | 31 | 6 | 5 | 0.2 | 1 | 4 | 0 | 0 | 3 | 11 | 3 | 13 | 136 | 24 | 94 | 46 | 80 | 19 | 74 | 36 | 70 | 12 | 1 | 2 | 16 |
1,070 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/modeling_bros.py | transformers.models.bros.modeling_bros.BrosSelfOutput | import torch
from torch import nn
class BrosSelfOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropout(co... |
class BrosSelfOutput(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 |
1,071 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/modeling_bros.py | transformers.models.bros.modeling_bros.BrosSpadeEEForTokenClassification | from ...utils import ModelOutput, auto_docstring, can_return_tuple, logging
import torch
from torch import nn
from typing import Optional, Union
from torch.nn import CrossEntropyLoss
@auto_docstring(custom_intro='\n Bros Model with a token classification head on top (initial_token_layers and subsequent_token_layer ... | @auto_docstring(custom_intro='\n Bros Model with a token classification head on top (initial_token_layers and subsequent_token_layer on top of the\n hidden-states output) e.g. for Named-Entity-Recognition (NER) tasks. The initial_token_classifier is used to\n predict the first token of each entity, and the sub... | 6 | 1 | 64 | 10 | 46 | 9 | 4 | 0.18 | 1 | 6 | 3 | 0 | 2 | 7 | 2 | 3 | 134 | 22 | 95 | 43 | 75 | 17 | 43 | 27 | 40 | 6 | 2 | 2 | 8 |
1,072 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/modeling_bros.py | transformers.models.bros.modeling_bros.BrosSpadeELForTokenClassification | from ...modeling_outputs import BaseModelOutputWithCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, TokenClassifierOutput
import torch
from torch.nn import CrossEntropyLoss
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, can_return_tuple, logging
@auto_docstring(custo... | @auto_docstring(custom_intro='\n Bros Model with a token classification head on top (a entity_linker layer on top of the hidden-states output) e.g.\n for Entity-Linking. The entity_linker is used to predict intra-entity links (one entity to another entity).\n ')
class BrosSpadeELForTokenClassification(BrosPreT... | 6 | 1 | 50 | 10 | 34 | 7 | 4 | 0.18 | 1 | 6 | 3 | 0 | 2 | 6 | 2 | 3 | 105 | 21 | 71 | 35 | 52 | 13 | 33 | 20 | 30 | 5 | 2 | 1 | 7 |
1,073 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/modeling_bros.py | transformers.models.bros.modeling_bros.BrosTextEmbeddings | from torch import nn
import torch
from typing import Optional, Union
class BrosTextEmbeddings(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.h... |
class BrosTextEmbeddings(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, inp... | 3 | 1 | 30 | 4 | 25 | 2 | 4 | 0.08 | 1 | 3 | 0 | 0 | 2 | 6 | 2 | 12 | 64 | 9 | 51 | 23 | 41 | 4 | 34 | 16 | 31 | 7 | 1 | 2 | 8 |
1,074 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bros/processing_bros.py | transformers.models.bros.processing_bros.BrosProcessor | from ...processing_utils import ProcessingKwargs, ProcessorMixin
class BrosProcessor(ProcessorMixin):
"""
Constructs a Bros processor which wraps a BERT tokenizer.
[`BrosProcessor`] offers all the functionalities of [`BertTokenizerFast`]. See the docstring of
[`~BrosProcessor.__call__`] and [`~BrosPro... |
class BrosProcessor(ProcessorMixin):
'''
Constructs a Bros processor which wraps a BERT tokenizer.
[`BrosProcessor`] offers all the functionalities of [`BertTokenizerFast`]. See the docstring of
[`~BrosProcessor.__call__`] and [`~BrosProcessor.decode`] for more information.
Args:
tokenizer ... | 2 | 1 | 13 | 1 | 10 | 2 | 1 | 0.38 | 1 | 9 | 2 | 0 | 5 | 0 | 5 | 22 | 84 | 11 | 53 | 29 | 28 | 20 | 17 | 10 | 11 | 2 | 2 | 1 | 6 |
1,075 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/byt5/tokenization_byt5.py | transformers.models.byt5.tokenization_byt5.ByT5Tokenizer | from ...tokenization_utils import AddedToken, PreTrainedTokenizer
import warnings
from typing import Optional
class ByT5Tokenizer(PreTrainedTokenizer):
"""
Construct a ByT5 tokenizer. ByT5 simply uses raw bytes utf-8 encoding.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the... |
class ByT5Tokenizer(PreTrainedTokenizer):
'''
Construct a ByT5 tokenizer. ByT5 simply uses raw bytes utf-8 encoding.
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 | 9 | 13 | 1 | 8 | 4 | 2 | 0.73 | 1 | 9 | 0 | 0 | 12 | 3 | 12 | 101 | 207 | 31 | 103 | 42 | 75 | 75 | 66 | 27 | 53 | 7 | 3 | 2 | 27 |
1,076 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/configuration_camembert.py | transformers.models.camembert.configuration_camembert.CamembertConfig | from ...configuration_utils import PretrainedConfig
class CamembertConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`CamembertModel`] or a [`TFCamembertModel`]. It is
used to instantiate a Camembert model according to the specified arguments, defining the model... |
class CamembertConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`CamembertModel`] or a [`TFCamembertModel`]. It is
used to instantiate a Camembert model according to the specified arguments, defining the model architecture.
Instantiating a configuration wit... | 2 | 1 | 39 | 1 | 38 | 0 | 1 | 1.45 | 1 | 1 | 0 | 0 | 1 | 15 | 1 | 1 | 109 | 11 | 40 | 39 | 17 | 58 | 19 | 18 | 17 | 1 | 1 | 0 | 1 |
1,077 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/configuration_camembert.py | transformers.models.camembert.configuration_camembert.CamembertOnnxConfig | from collections import OrderedDict
from ...onnx import OnnxConfig
from collections.abc import Mapping
class CamembertOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
if self.task == 'multiple-choice':
dynamic_axis = {0: 'batch', 1: 'choice', 2: 'seque... |
class CamembertOnnxConfig(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 |
1,078 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertAttention | from typing import Callable, Optional, Union
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...cache_utils import Cache, EncoderDecoderCache
import torch
from... |
class CamembertAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, is_causal=False, layer_idx=None, is_cross_attention=False):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=Non... | 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 |
1,079 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertClassificationHead | import torch
import torch.nn as nn
class CamembertClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
classifier_dropout = config.classifier_drop... |
class CamembertClassificationHead(nn.Module):
'''Head for sentence-level classification tasks.'''
def __init__(self, config):
pass
def forward(self, features, **kwargs):
pass | 3 | 1 | 8 | 0 | 8 | 1 | 2 | 0.12 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 20 | 2 | 17 | 8 | 14 | 2 | 15 | 8 | 12 | 2 | 1 | 0 | 3 |
1,080 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertEmbeddings | import torch
import torch.nn as nn
from typing import Callable, Optional, Union
class CamembertEmbeddings(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_si... |
class CamembertEmbeddings(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.LongTens... | 7 | 3 | 26 | 3 | 18 | 5 | 3 | 0.32 | 1 | 1 | 0 | 0 | 3 | 7 | 3 | 13 | 87 | 13 | 56 | 23 | 50 | 18 | 43 | 21 | 39 | 8 | 1 | 2 | 10 |
1,081 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertEncoder | from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
import torch.nn as nn
from ...processing_utils import Unpack
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLM... |
class CamembertEncoder(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, encoder_hidden_states: Optional[torch.FloatTensor]=None, encoder_attention_mask: Optional[t... | 3 | 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 |
1,082 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertForCausalLM | import torch
import torch.nn as nn
from ...generation import GenerationMixin
from ...processing_utils import Unpack
from ...utils.generic import can_return_tuple, check_model_inputs
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWit... | @auto_docstring(custom_intro='\n Camembert Model with a `language modeling` head on top for CLM fine-tuning.\n ')
class CamembertForCausalLM(CamembertPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(s... | 8 | 1 | 26 | 3 | 15 | 7 | 2 | 0.45 | 2 | 7 | 3 | 0 | 5 | 2 | 5 | 6 | 138 | 22 | 80 | 34 | 55 | 36 | 33 | 16 | 27 | 6 | 2 | 1 | 12 |
1,083 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertForMaskedLM | from ...utils.generic import can_return_tuple, check_model_inputs
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput,... | @auto_docstring
class CamembertForMaskedLM(CamembertPreTrainedModel):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, new_embeddings):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[to... | 8 | 1 | 19 | 2 | 15 | 3 | 2 | 0.14 | 1 | 6 | 3 | 0 | 4 | 2 | 4 | 5 | 91 | 11 | 70 | 29 | 42 | 10 | 27 | 14 | 22 | 5 | 2 | 1 | 9 |
1,084 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertForMultipleChoice | from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch.nn as nn
from ...utils import ... | @auto_docstring
class CamembertForMultipleChoice(CamembertPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTenso... | 6 | 1 | 38 | 4 | 30 | 4 | 6 | 0.12 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 85 | 9 | 68 | 34 | 45 | 8 | 29 | 19 | 26 | 11 | 2 | 1 | 12 |
1,085 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertForQuestionAnswering | from ...utils.generic import can_return_tuple, check_model_inputs
import torch
from typing import Callable, Optional, Union
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPooling... | @auto_docstring
class CamembertForQuestionAnswering(CamembertPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTe... | 6 | 1 | 41 | 5 | 30 | 7 | 4 | 0.19 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 92 | 10 | 69 | 30 | 45 | 13 | 32 | 16 | 29 | 7 | 2 | 2 | 8 |
1,086 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertForSequenceClassification | from ...processing_utils import Unpack
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
import torch
import torch.nn as nn
from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutput... | @auto_docstring(custom_intro='\n Camembert 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 CamembertForSequenceClassification(CamembertPreTrainedModel):
def __init__(self, config):
pass
@can_... | 6 | 1 | 40 | 4 | 33 | 4 | 7 | 0.11 | 1 | 7 | 3 | 0 | 2 | 4 | 2 | 3 | 90 | 8 | 74 | 26 | 51 | 8 | 34 | 13 | 31 | 12 | 2 | 3 | 13 |
1,087 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertForTokenClassification | from ...processing_utils import Unpack
import torch.nn as nn
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
import torch
from typing import Callable, Optional, Union
from ...utils.generic import can_return_... | @auto_docstring
class CamembertForTokenClassification(CamembertPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.Long... | 6 | 1 | 33 | 4 | 26 | 3 | 4 | 0.1 | 1 | 5 | 2 | 0 | 2 | 4 | 2 | 3 | 76 | 9 | 61 | 27 | 38 | 6 | 24 | 14 | 21 | 5 | 2 | 1 | 7 |
1,088 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertIntermediate | import torch
from ...activations import ACT2FN, gelu
import torch.nn as nn
class CamembertIntermediate(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.int... |
class CamembertIntermediate(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 |
1,089 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertLMHead | from ...activations import ACT2FN, gelu
import torch
import torch.nn as nn
class CamembertLMHead(nn.Module):
"""Camembert Head for masked language modeling."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.layer_norm ... |
class CamembertLMHead(nn.Module):
'''Camembert Head for masked language modeling.'''
def __init__(self, config):
pass
def forward(self, features, **kwargs):
pass
def _tie_weights(self):
pass | 4 | 1 | 8 | 1 | 6 | 1 | 1 | 0.21 | 1 | 1 | 0 | 0 | 3 | 4 | 3 | 13 | 29 | 6 | 19 | 9 | 15 | 4 | 18 | 9 | 14 | 2 | 1 | 1 | 4 |
1,090 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertLayer | from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
import torch.nn as nn
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...modeling_layers import GradientCheckpointingLayer
from typing import Callable, Optiona... |
class CamembertLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_idx=None):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.FloatTensor]=None, enc... | 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 |
1,091 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertModel | from ...masking_utils import create_causal_mask
from ...cache_utils import Cache, EncoderDecoderCache
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa
import torch.nn as nn
from ...utils.generic import can_return_tuple, check_model_inputs
from ...modeling_outputs i... | null | 12 | 2 | 37 | 4 | 25 | 8 | 5 | 0.37 | 1 | 8 | 4 | 0 | 5 | 6 | 5 | 6 | 216 | 31 | 135 | 45 | 108 | 50 | 65 | 29 | 59 | 21 | 2 | 2 | 27 |
1,092 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertOutput | import torch.nn as nn
import torch
class CamembertOutput(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.Dr... |
class CamembertOutput(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 |
1,093 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertPooler | import torch
import torch.nn as nn
class CamembertPooler(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_... |
class CamembertPooler(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 |
1,094 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertPreTrainedModel | import torch.nn as nn
from .configuration_camembert import CamembertConfig
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
@auto_docstring
class CamembertPreTrainedModel(PreTrainedModel):
config_cl... | @auto_docstring
class CamembertPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.47 | 1 | 0 | 0 | 7 | 1 | 0 | 1 | 1 | 27 | 2 | 17 | 6 | 15 | 8 | 15 | 6 | 13 | 6 | 1 | 2 | 6 |
1,095 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertSelfAttention | import torch.nn as nn
from typing import Callable, Optional, Union
import torch
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...utils import TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...processing_utils import Unpack
from ...cache_utils import Cache, E... |
class CamembertSelfAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, is_causal=False, layer_idx=None):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, past_key_value: Option... | 3 | 0 | 43 | 7 | 31 | 6 | 6 | 0.19 | 1 | 5 | 0 | 1 | 3 | 11 | 3 | 13 | 132 | 22 | 93 | 44 | 80 | 18 | 72 | 35 | 68 | 13 | 1 | 2 | 17 |
1,096 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/modeling_camembert.py | transformers.models.camembert.modeling_camembert.CamembertSelfOutput | import torch
import torch.nn as nn
class CamembertSelfOutput(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.Drop... |
class CamembertSelfOutput(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 |
1,097 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/tokenization_camembert.py | transformers.models.camembert.tokenization_camembert.CamembertTokenizer | from ...utils.import_utils import requires
import os
from typing import Any, Optional
from shutil import copyfile
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
import sentencepiece as spm
@requires(backends=('sentencepiece',))
class CamembertTokenizer(PreTrainedTokenizer):
"""
Adapted from ... | @requires(backends=('sentencepiece',))
class CamembertTokenizer(PreTrainedTokenizer):
'''
Adapted from [`RobertaTokenizer`] and [`XLNetTokenizer`]. Construct a CamemBERT tokenizer. Based on
[SentencePiece](https://github.com/google/sentencepiece).
This tokenizer inherits from [`PreTrainedTokenizer`] whi... | 16 | 7 | 15 | 2 | 10 | 4 | 2 | 0.84 | 1 | 6 | 0 | 0 | 13 | 6 | 13 | 102 | 284 | 48 | 129 | 55 | 95 | 108 | 82 | 34 | 68 | 6 | 3 | 3 | 31 |
1,098 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/camembert/tokenization_camembert_fast.py | transformers.models.camembert.tokenization_camembert_fast.CamembertTokenizerFast | from shutil import copyfile
from ...tokenization_utils import AddedToken
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from typing import Optional
import os
class CamembertTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" CamemBERT tokenizer (backed by HuggingFace's *tokenizers* l... |
class CamembertTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" CamemBERT tokenizer (backed by HuggingFace's *tokenizers* library). Adapted from
[`RobertaTokenizer`] and [`XLNetTokenizer`]. Based on
[BPE](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=BPE#m... | 5 | 3 | 20 | 2 | 12 | 5 | 3 | 0.97 | 1 | 5 | 0 | 0 | 5 | 1 | 5 | 93 | 159 | 27 | 67 | 33 | 43 | 65 | 32 | 15 | 26 | 5 | 3 | 1 | 13 |
1,099 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/canine/configuration_canine.py | transformers.models.canine.configuration_canine.CanineConfig | from ...configuration_utils import PretrainedConfig
class CanineConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`CanineModel`]. It is used to instantiate an
CANINE model according to the specified arguments, defining the model architecture. Instantiating a con... |
class CanineConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`CanineModel`]. It is used to instantiate an
CANINE model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a simila... | 2 | 1 | 43 | 2 | 40 | 2 | 1 | 1.48 | 1 | 1 | 0 | 0 | 1 | 16 | 1 | 1 | 115 | 12 | 42 | 41 | 18 | 62 | 20 | 19 | 18 | 1 | 1 | 0 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.