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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
900 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bit/modeling_bit.py | transformers.models.bit.modeling_bit.BitDropPath | from torch import Tensor, nn
import torch
from typing import Optional
class BitDropPath(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 = dr... |
class BitDropPath(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 |
901 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bit/modeling_bit.py | transformers.models.bit.modeling_bit.BitEmbeddings | from .configuration_bit import BitConfig
from torch import Tensor, nn
class BitEmbeddings(nn.Module):
"""
BiT Embeddings (stem) composed of a single aggressive convolution.
"""
def __init__(self, config: BitConfig):
super().__init__()
self.convolution = WeightStandardizedConv2d(config.... |
class BitEmbeddings(nn.Module):
'''
BiT Embeddings (stem) composed of a single aggressive convolution.
'''
def __init__(self, config: BitConfig):
pass
def forward(self, pixel_values: Tensor) -> Tensor:
pass | 3 | 1 | 21 | 5 | 16 | 1 | 3 | 0.13 | 1 | 7 | 4 | 0 | 2 | 5 | 2 | 12 | 48 | 12 | 32 | 10 | 29 | 4 | 21 | 10 | 18 | 3 | 1 | 1 | 5 |
902 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bit/modeling_bit.py | transformers.models.bit.modeling_bit.BitEncoder | from ...modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
import numpy as np
from .configuration_bit import BitConfig
from torch import Tensor, nn
import torch
class BitEncoder(nn.Module):
def __init__(self, confi... |
class BitEncoder(nn.Module):
def __init__(self, config: BitConfig):
pass
def _get_updated_hyperparameters(self, stage_idx, current_stride, current_hidden_size, dilation, config):
pass
def forward(self, hidden_state: Tensor, output_hidden_states: bool=False, return_dict: bool=True) -> Bas... | 4 | 0 | 22 | 4 | 17 | 1 | 4 | 0.04 | 1 | 10 | 3 | 0 | 3 | 1 | 3 | 13 | 68 | 14 | 52 | 18 | 46 | 2 | 32 | 16 | 28 | 6 | 1 | 2 | 11 |
903 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bit/modeling_bit.py | transformers.models.bit.modeling_bit.BitForImageClassification | import torch
from torch import Tensor, nn
from ...utils import auto_docstring, logging
from typing import Optional
from ...modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
@auto_docstring(custom_intro='\n BiT Model... | @auto_docstring(custom_intro='\n BiT Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for\n ImageNet.\n ')
class BitForImageClassification(BitPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, pixel_values... | 5 | 1 | 30 | 4 | 23 | 4 | 8 | 0.13 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 68 | 8 | 53 | 19 | 37 | 7 | 32 | 12 | 29 | 13 | 2 | 3 | 15 |
904 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bit/modeling_bit.py | transformers.models.bit.modeling_bit.BitGroupNormActivation | from torch import Tensor, nn
from ...activations import ACT2FN
class BitGroupNormActivation(nn.GroupNorm):
"""
A module that combines group normalization with an activation function.
"""
def __init__(self, config, num_channels, eps=1e-05, affine=True, apply_activation=True):
super().__init__(c... |
class BitGroupNormActivation(nn.GroupNorm):
'''
A module that combines group normalization with an activation function.
'''
def __init__(self, config, num_channels, eps=1e-05, affine=True, apply_activation=True):
pass
def forward(self, hidden_state):
pass | 3 | 1 | 5 | 0 | 5 | 0 | 2 | 0.27 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 2 | 16 | 2 | 11 | 4 | 8 | 3 | 10 | 4 | 7 | 2 | 1 | 1 | 3 |
905 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bit/modeling_bit.py | transformers.models.bit.modeling_bit.BitMaxPool2d | import collections
from torch import Tensor, nn
class BitMaxPool2d(nn.MaxPool2d):
def __init__(self, kernel_size: int, stride=None, dilation=1, ceil_mode=False, padding=(0, 0), padding_value=0, use_dynamic_padding=True):
kernel_size = kernel_size if isinstance(kernel_size, collections.abc.Iterable) else (... |
class BitMaxPool2d(nn.MaxPool2d):
def __init__(self, kernel_size: int, stride=None, dilation=1, ceil_mode=False, padding=(0, 0), padding_value=0, use_dynamic_padding=True):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 12 | 0 | 12 | 0 | 3 | 0.04 | 1 | 3 | 1 | 0 | 2 | 1 | 2 | 2 | 27 | 2 | 24 | 13 | 12 | 1 | 12 | 4 | 9 | 5 | 1 | 1 | 6 |
906 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bit/modeling_bit.py | transformers.models.bit.modeling_bit.BitModel | from typing import Optional
from ...modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from ...utils import auto_docstring, logging
from torch import Tensor, nn
@auto_docstring
class BitModel(BitPreTrainedModel):
d... | @auto_docstring
class BitModel(BitPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, pixel_values: Tensor, output_hidden_states: Optional[bool]=None, return_dict: Optional[bool]=None) -> BaseModelOutputWithPoolingAndNoAttention:
pass | 5 | 0 | 22 | 5 | 17 | 1 | 3 | 0.02 | 1 | 7 | 4 | 0 | 2 | 5 | 2 | 3 | 54 | 11 | 42 | 15 | 29 | 1 | 20 | 12 | 17 | 4 | 2 | 1 | 6 |
907 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bit/modeling_bit.py | transformers.models.bit.modeling_bit.BitPreActivationBottleneckLayer | from torch import Tensor, nn
class BitPreActivationBottleneckLayer(nn.Module):
"""Pre-activation (v2) bottleneck block.
Follows the implementation of "Identity Mappings in Deep Residual Networks":
https://github.com/KaimingHe/resnet-1k-layers/blob/master/resnet-pre-act.lua
Except it puts the stride on... |
class BitPreActivationBottleneckLayer(nn.Module):
'''Pre-activation (v2) bottleneck block.
Follows the implementation of "Identity Mappings in Deep Residual Networks":
https://github.com/KaimingHe/resnet-1k-layers/blob/master/resnet-pre-act.lua
Except it puts the stride on 3x3 conv when available.
... | 3 | 1 | 29 | 5 | 23 | 1 | 3 | 0.15 | 1 | 5 | 4 | 0 | 2 | 8 | 2 | 12 | 66 | 12 | 47 | 26 | 32 | 7 | 26 | 14 | 23 | 3 | 1 | 1 | 5 |
908 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bit/modeling_bit.py | transformers.models.bit.modeling_bit.BitPreTrainedModel | from torch import Tensor, nn
from ...modeling_utils import PreTrainedModel
from .configuration_bit import BitConfig
from ...utils import auto_docstring, logging
import math
@auto_docstring
class BitPreTrainedModel(PreTrainedModel):
config: BitConfig
base_model_prefix = 'bit'
main_input_name = 'pixel_values... | @auto_docstring
class BitPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 13 | 0 | 12 | 1 | 6 | 0.29 | 1 | 0 | 0 | 3 | 1 | 0 | 1 | 1 | 24 | 2 | 17 | 8 | 15 | 5 | 15 | 8 | 13 | 6 | 1 | 2 | 6 |
909 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bit/modeling_bit.py | transformers.models.bit.modeling_bit.BitStage | from torch import Tensor, nn
class BitStage(nn.Module):
"""
A ResNet v2 stage composed by stacked layers.
"""
def __init__(self, config, in_channels, out_channels, stride, dilation, depth, bottle_ratio=0.25, layer_dropout=None):
super().__init__()
first_dilation = 1 if dilation in (1, ... |
class BitStage(nn.Module):
'''
A ResNet v2 stage composed by stacked layers.
'''
def __init__(self, config, in_channels, out_channels, stride, dilation, depth, bottle_ratio=0.25, layer_dropout=None):
pass
def _get_updated_hyperparameters(self, layer_idx, stride, layer_dropout):
''... | 4 | 2 | 22 | 2 | 18 | 2 | 3 | 0.15 | 1 | 7 | 2 | 0 | 3 | 1 | 3 | 13 | 72 | 10 | 54 | 24 | 40 | 8 | 27 | 14 | 23 | 4 | 1 | 1 | 9 |
910 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bit/modeling_bit.py | transformers.models.bit.modeling_bit.DynamicPad2d | from torch import Tensor, nn
import math
class DynamicPad2d(nn.Module):
"""
A module that wraps dynamic padding of any input, given the parameters of the convolutional layer and the input
hidden states.
"""
def __init__(self, kernel_size, stride, dilation, value=0):
super().__init__()
... |
class DynamicPad2d(nn.Module):
'''
A module that wraps dynamic padding of any input, given the parameters of the convolutional layer and the input
hidden states.
'''
def __init__(self, kernel_size, stride, dilation, value=0):
pass
def compute_padding(x, kernel_size, stride, dilati... | 4 | 1 | 15 | 2 | 11 | 1 | 2 | 0.25 | 1 | 2 | 0 | 0 | 2 | 5 | 2 | 12 | 49 | 9 | 32 | 12 | 28 | 8 | 23 | 12 | 19 | 4 | 1 | 1 | 7 |
911 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/bit/modeling_bit.py | transformers.models.bit.modeling_bit.WeightStandardizedConv2d | from torch import Tensor, nn
class WeightStandardizedConv2d(nn.Conv2d):
"""Conv2d with Weight Standardization. Used for ViT Hybrid model.
Paper: [Micro-Batch Training with Batch-Channel Normalization and Weight
Standardization](https://huggingface.co/papers/1903.10520v2)
"""
def __init__(self, in... |
class WeightStandardizedConv2d(nn.Conv2d):
'''Conv2d with Weight Standardization. Used for ViT Hybrid model.
Paper: [Micro-Batch Training with Batch-Channel Normalization and Weight
Standardization](https://huggingface.co/papers/1903.10520v2)
'''
def __init__(self, in_channel, out_channels, kernel... | 3 | 1 | 19 | 0 | 19 | 0 | 2 | 0.1 | 1 | 2 | 1 | 0 | 2 | 3 | 2 | 2 | 46 | 3 | 39 | 19 | 25 | 4 | 14 | 7 | 11 | 2 | 1 | 1 | 4 |
912 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot/configuration_blenderbot.py | transformers.models.blenderbot.configuration_blenderbot.BlenderbotConfig | from ...configuration_utils import PretrainedConfig
class BlenderbotConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`BlenderbotModel`]. It is used to instantiate an
Blenderbot model according to the specified arguments, defining the model architecture. Instant... |
class BlenderbotConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`BlenderbotModel`]. It is used to instantiate an
Blenderbot model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yi... | 2 | 1 | 59 | 1 | 58 | 1 | 1 | 1.02 | 1 | 1 | 0 | 0 | 1 | 19 | 1 | 1 | 135 | 11 | 62 | 52 | 32 | 63 | 25 | 24 | 23 | 1 | 1 | 0 | 1 |
913 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot/configuration_blenderbot.py | transformers.models.blenderbot.configuration_blenderbot.BlenderbotOnnxConfig | from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeq2SeqConfigWithPast
from ...onnx.utils import compute_effective_axis_dimension
from collections.abc import Mapping
from ... import PreTrainedTokenizer
from collections import OrderedDict
from typing import Any
from ...file_utils import is_torch_available
class ... |
class BlenderbotOnnxConfig(OnnxSeq2SeqConfigWithPast):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def outputs(self) -> Mapping[str, Mapping[int, str]]:
pass
def _generate_dummy_inputs_for_default_and_seq2seq_lm(self, tokenizer: PreTrainedTokenize... | 11 | 0 | 26 | 1 | 24 | 1 | 4 | 0.05 | 1 | 9 | 0 | 0 | 8 | 1 | 8 | 8 | 225 | 18 | 197 | 74 | 156 | 10 | 95 | 43 | 84 | 7 | 1 | 3 | 30 |
914 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot/modeling_blenderbot.py | transformers.models.blenderbot.modeling_blenderbot.BlenderbotAttention | from torch import nn
from ...utils.deprecation import deprecate_kwarg
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...processing_utils import Unpack
from .configuration_blenderbot import BlenderbotConfig
from typing import Callable, Optional, Union
from ...modeling_flash_attention_utils i... |
class BlenderbotAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, embed_dim: int, num_heads: int, dropout: float=0.0, is_decoder: bool=False, bias: bool=True, is_causal: bool=False, config: Optional[BlenderbotConfig]=None, layer_idx: Optional[int]=Non... | 4 | 2 | 50 | 7 | 35 | 8 | 5 | 0.24 | 1 | 7 | 1 | 0 | 3 | 12 | 3 | 13 | 156 | 23 | 107 | 44 | 86 | 26 | 68 | 27 | 64 | 12 | 1 | 2 | 15 |
915 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot/modeling_blenderbot.py | transformers.models.blenderbot.modeling_blenderbot.BlenderbotDecoder | from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
import torch
from torch import nn
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdyn... |
class BlenderbotDecoder(BlenderbotPreTrainedModel):
'''
Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`BlenderbotDecoderLayer`]
Args:
config: BlenderbotConfig
embed_tokens (nn.Embedding): output embedding
'''
def __init__(self, config: Blenderbo... | 3 | 2 | 61 | 8 | 36 | 16 | 11 | 0.49 | 1 | 11 | 5 | 0 | 4 | 9 | 4 | 6 | 254 | 38 | 145 | 43 | 126 | 71 | 77 | 29 | 72 | 37 | 2 | 3 | 42 |
916 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot/modeling_blenderbot.py | transformers.models.blenderbot.modeling_blenderbot.BlenderbotDecoderLayer | from ...modeling_layers import GradientCheckpointingLayer
from torch import nn
from typing import Callable, Optional, Union
from .configuration_blenderbot import BlenderbotConfig
from ...activations import ACT2FN
from ...utils.deprecation import deprecate_kwarg
import torch
from ...cache_utils import Cache, DynamicCach... |
class BlenderbotDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: BlenderbotConfig, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.T... | 4 | 1 | 58 | 6 | 40 | 13 | 4 | 0.31 | 1 | 4 | 1 | 0 | 2 | 11 | 2 | 12 | 118 | 12 | 81 | 32 | 67 | 25 | 44 | 21 | 41 | 6 | 1 | 1 | 7 |
917 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot/modeling_blenderbot.py | transformers.models.blenderbot.modeling_blenderbot.BlenderbotDecoderWrapper | class BlenderbotDecoderWrapper(BlenderbotPreTrainedModel):
"""
This wrapper class is a helper class to correctly load pretrained checkpoints when the causal language model is
used in combination with the [`EncoderDecoderModel`] framework.
"""
def __init__(self, config):
super().__init__(con... | class BlenderbotDecoderWrapper(BlenderbotPreTrainedModel):
'''
This wrapper class is a helper class to correctly load pretrained checkpoints when the causal language model is
used in combination with the [`EncoderDecoderModel`] framework.
'''
def __init__(self, config):
pass
def forwar... | 3 | 1 | 3 | 0 | 3 | 0 | 1 | 0.67 | 1 | 2 | 1 | 0 | 2 | 1 | 2 | 4 | 12 | 2 | 6 | 4 | 3 | 4 | 6 | 4 | 3 | 1 | 2 | 0 | 2 |
918 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot/modeling_blenderbot.py | transformers.models.blenderbot.modeling_blenderbot.BlenderbotEncoder | import math
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
from torch import nn
from .configuration_blenderbot import BlenderbotConfig
from typing import Callable, Optional, Union
class Blen... |
class BlenderbotEncoder(BlenderbotPreTrainedModel):
'''
Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a
[`BlenderbotEncoderLayer`].
Args:
config: BlenderbotConfig
embed_tokens (nn.Embedding): output embedding
'''
def __init__(sel... | 3 | 2 | 80 | 12 | 50 | 19 | 14 | 0.45 | 1 | 10 | 5 | 0 | 2 | 9 | 2 | 4 | 171 | 27 | 100 | 32 | 88 | 45 | 62 | 23 | 59 | 24 | 2 | 3 | 27 |
919 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot/modeling_blenderbot.py | transformers.models.blenderbot.modeling_blenderbot.BlenderbotEncoderLayer | from .configuration_blenderbot import BlenderbotConfig
from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
from ...activations import ACT2FN
import torch
class BlenderbotEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: BlenderbotConfig):
super().__init__()
... |
class BlenderbotEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: BlenderbotConfig):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, layer_head_mask: torch.Tensor, output_attentions: bool=False) -> torch.Tensor:
'''
Args:
... | 3 | 1 | 33 | 3 | 25 | 6 | 2 | 0.22 | 1 | 4 | 1 | 0 | 2 | 9 | 2 | 12 | 68 | 7 | 50 | 22 | 41 | 11 | 32 | 16 | 29 | 3 | 1 | 1 | 4 |
920 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot/modeling_blenderbot.py | transformers.models.blenderbot.modeling_blenderbot.BlenderbotForCausalLM | from torch.nn import CrossEntropyLoss
from typing import Callable, Optional, Union
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWith... |
class BlenderbotForCausalLM(BlenderbotPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
def set_decoder(self, decoder):
pass
def get_decoder(self):
pass
... | 8 | 1 | 19 | 3 | 9 | 8 | 2 | 0.84 | 2 | 6 | 2 | 0 | 8 | 2 | 9 | 11 | 186 | 33 | 83 | 37 | 56 | 70 | 42 | 20 | 32 | 7 | 2 | 1 | 16 |
921 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot/modeling_blenderbot.py | transformers.models.blenderbot.modeling_blenderbot.BlenderbotForConditionalGeneration | import warnings
import torch
from torch.nn import CrossEntropyLoss
from torch import nn
import os
from ..blenderbot_small import BlenderbotSmallForConditionalGeneration, BlenderbotSmallModel
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging
from ...modeling_outputs imp... | @auto_docstring(custom_intro='\n The Blenderbot Model with a language modeling head. Can be used for summarization.\n ')
class BlenderbotForConditionalGeneration(BlenderbotPreTrainedModel, GenerationMixin):
def __init__(self, config: BlenderbotConfig):
pass
@classmethod
def from_pretrained(cl... | 11 | 1 | 13 | 1 | 11 | 1 | 2 | 0.07 | 2 | 13 | 5 | 0 | 8 | 3 | 10 | 12 | 148 | 18 | 121 | 51 | 85 | 9 | 57 | 27 | 46 | 8 | 2 | 2 | 20 |
922 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot/modeling_blenderbot.py | transformers.models.blenderbot.modeling_blenderbot.BlenderbotLearnedPositionalEmbedding | import torch
from typing import Callable, Optional, Union
from torch import nn
class BlenderbotLearnedPositionalEmbedding(nn.Embedding):
"""
This module learns positional embeddings up to a fixed maximum size.
"""
def __init__(self, num_embeddings: int, embedding_dim: int):
super().__init__(nu... |
class BlenderbotLearnedPositionalEmbedding(nn.Embedding):
'''
This module learns positional embeddings up to a fixed maximum size.
'''
def __init__(self, num_embeddings: int, embedding_dim: int):
pass
def forward(self, input_ids_shape: torch.Size, past_key_values_length: int=0, position_i... | 3 | 2 | 5 | 0 | 4 | 1 | 1 | 0.44 | 1 | 2 | 0 | 0 | 2 | 0 | 2 | 2 | 15 | 2 | 9 | 5 | 6 | 4 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
923 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot/modeling_blenderbot.py | transformers.models.blenderbot.modeling_blenderbot.BlenderbotModel | from ..blenderbot_small import BlenderbotSmallForConditionalGeneration, BlenderbotSmallModel
from typing import Callable, Optional, Union
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...model... | @auto_docstring
class BlenderbotModel(BlenderbotPreTrainedModel):
def __init__(self, config: BlenderbotConfig):
pass
@classmethod
def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.PathLike]], *model_args, **kwargs):
pass
def get_input_embeddings(self):
... | 10 | 1 | 18 | 2 | 13 | 2 | 3 | 0.17 | 1 | 13 | 7 | 0 | 6 | 3 | 7 | 9 | 135 | 19 | 99 | 34 | 71 | 17 | 37 | 15 | 29 | 10 | 2 | 1 | 18 |
924 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot/modeling_blenderbot.py | transformers.models.blenderbot.modeling_blenderbot.BlenderbotPreTrainedModel | from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging
from ...modeling_attn_mask_utils import AttentionMaskConverter, _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa
from .configuration_blenderbot import BlenderbotConfig
from ...cache_utils import Cache, Dy... | @auto_docstring
class BlenderbotPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass
@property
def dummy_inputs(self):
pass
def _update_full_mask(self, attention_mask: Union[torch.Tensor, None], inputs_embeds: torch.Tensor):
pass
def _update_causal_mask(... | 10 | 1 | 10 | 0 | 10 | 0 | 3 | 0 | 1 | 0 | 0 | 6 | 2 | 0 | 2 | 2 | 26 | 2 | 24 | 11 | 20 | 0 | 18 | 10 | 15 | 5 | 1 | 2 | 6 |
925 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot/modeling_blenderbot.py | transformers.models.blenderbot.modeling_blenderbot.BlenderbotScaledWordEmbedding | from typing import Callable, Optional, Union
from torch import nn
import torch
class BlenderbotScaledWordEmbedding(nn.Embedding):
"""
This module overrides nn.Embeddings' forward by multiplying with embeddings scale.
"""
def __init__(self, num_embeddings: int, embedding_dim: int, padding_idx: int, emb... |
class BlenderbotScaledWordEmbedding(nn.Embedding):
'''
This module overrides nn.Embeddings' forward by multiplying with embeddings scale.
'''
def __init__(self, num_embeddings: int, embedding_dim: int, padding_idx: int, embed_scale: Optional[float]=1.0):
pass
def forward(self, input_ids: ... | 3 | 1 | 3 | 0 | 3 | 0 | 1 | 0.5 | 1 | 4 | 0 | 0 | 2 | 1 | 2 | 2 | 11 | 2 | 6 | 4 | 3 | 3 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
926 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot/tokenization_blenderbot.py | transformers.models.blenderbot.tokenization_blenderbot.BlenderbotTokenizer | import os
import regex as re
from typing import Optional
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
import json
class BlenderbotTokenizer(PreTrainedTokenizer):
"""
Constructs a Blenderbot tokenizer, derived from the GPT-2 tokenizer, using byte-level Byte-Pair-Encoding.
This tokenize... |
class BlenderbotTokenizer(PreTrainedTokenizer):
'''
Constructs a Blenderbot tokenizer, derived from the GPT-2 tokenizer, using 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 encoded differently whether... | 15 | 8 | 17 | 1 | 12 | 4 | 3 | 0.71 | 1 | 11 | 0 | 0 | 13 | 9 | 13 | 102 | 329 | 50 | 165 | 67 | 132 | 117 | 118 | 44 | 104 | 9 | 3 | 3 | 38 |
927 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot/tokenization_blenderbot_fast.py | transformers.models.blenderbot.tokenization_blenderbot_fast.BlenderbotTokenizerFast | import json
from ...tokenization_utils_base import AddedToken, BatchEncoding
from typing import Optional
from tokenizers import processors
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_blenderbot import BlenderbotTokenizer
class BlenderbotTokenizerFast(PreTrainedTokenizerFast):
... |
class BlenderbotTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" Blenderbot tokenizer (backed by HuggingFace's *tokenizers* library), derived from the GPT-2
tokenizer, using byte-level Byte-Pair-Encoding.
This tokenizer has been trained to treat spaces like parts of the tokens (a bit like... | 11 | 5 | 18 | 2 | 12 | 5 | 2 | 1.04 | 1 | 5 | 1 | 0 | 8 | 1 | 8 | 96 | 244 | 42 | 99 | 44 | 70 | 103 | 54 | 24 | 45 | 8 | 3 | 2 | 19 |
928 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot_small/configuration_blenderbot_small.py | transformers.models.blenderbot_small.configuration_blenderbot_small.BlenderbotSmallConfig | from ...configuration_utils import PretrainedConfig
class BlenderbotSmallConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`BlenderbotSmallModel`]. It is used to instantiate
an BlenderbotSmall model according to the specified arguments, defining the model archit... |
class BlenderbotSmallConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`BlenderbotSmallModel`]. It is used to instantiate
an BlenderbotSmall model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the d... | 2 | 1 | 57 | 1 | 56 | 1 | 1 | 1.05 | 1 | 1 | 0 | 0 | 1 | 19 | 1 | 1 | 133 | 11 | 60 | 51 | 31 | 63 | 25 | 24 | 23 | 1 | 1 | 0 | 1 |
929 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot_small/configuration_blenderbot_small.py | transformers.models.blenderbot_small.configuration_blenderbot_small.BlenderbotSmallOnnxConfig | from ...onnx.utils import compute_effective_axis_dimension
from ...file_utils import is_torch_available
from typing import Any
from ... import PreTrainedTokenizer
from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeq2SeqConfigWithPast
from collections import OrderedDict
from collections.abc import Mapping
class ... |
class BlenderbotSmallOnnxConfig(OnnxSeq2SeqConfigWithPast):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def outputs(self) -> Mapping[str, Mapping[int, str]]:
pass
def _generate_dummy_inputs_for_default_and_seq2seq_lm(self, tokenizer: PreTrainedTok... | 10 | 0 | 30 | 2 | 27 | 1 | 4 | 0.05 | 1 | 9 | 0 | 0 | 7 | 1 | 7 | 7 | 221 | 20 | 191 | 73 | 151 | 10 | 89 | 42 | 79 | 8 | 1 | 3 | 28 |
930 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot_small/modeling_blenderbot_small.py | transformers.models.blenderbot_small.modeling_blenderbot_small.BlenderbotSmallAttention | from ...modeling_flash_attention_utils import FlashAttentionKwargs
from .configuration_blenderbot_small import BlenderbotSmallConfig
from ...processing_utils import Unpack
from typing import Callable, Optional, Union
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...modeling_utils import ALL_A... |
class BlenderbotSmallAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, embed_dim: int, num_heads: int, dropout: float=0.0, is_decoder: bool=False, bias: bool=True, is_causal: bool=False, config: Optional[BlenderbotSmallConfig]=None, layer_idx: Optiona... | 4 | 2 | 50 | 7 | 35 | 8 | 5 | 0.24 | 1 | 7 | 1 | 0 | 3 | 12 | 3 | 13 | 156 | 23 | 107 | 44 | 86 | 26 | 68 | 27 | 64 | 12 | 1 | 2 | 15 |
931 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot_small/modeling_blenderbot_small.py | transformers.models.blenderbot_small.modeling_blenderbot_small.BlenderbotSmallDecoder | from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging
from typing import Callable, Optional, Union
from .configuration_blenderbot_small import BlenderbotSmallConfig
import math
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, Caus... |
class BlenderbotSmallDecoder(BlenderbotSmallPreTrainedModel):
'''
Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`BlenderbotSmallDecoderLayer`]
Args:
config: BlenderbotSmallConfig
embed_tokens (nn.Embedding): output embedding
'''
def __init__(sel... | 3 | 2 | 60 | 8 | 36 | 16 | 11 | 0.49 | 1 | 10 | 4 | 0 | 4 | 10 | 4 | 6 | 251 | 38 | 143 | 43 | 124 | 70 | 77 | 29 | 72 | 37 | 2 | 3 | 42 |
932 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot_small/modeling_blenderbot_small.py | transformers.models.blenderbot_small.modeling_blenderbot_small.BlenderbotSmallDecoderLayer | from .configuration_blenderbot_small import BlenderbotSmallConfig
from ...activations import ACT2FN
import torch
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Callable, Optional, Union
from ...modeling_layers import GradientCheckp... |
class BlenderbotSmallDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: BlenderbotSmallConfig, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Option... | 4 | 1 | 58 | 6 | 40 | 13 | 4 | 0.31 | 1 | 4 | 1 | 0 | 2 | 11 | 2 | 12 | 118 | 12 | 81 | 32 | 67 | 25 | 44 | 21 | 41 | 6 | 1 | 1 | 7 |
933 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot_small/modeling_blenderbot_small.py | transformers.models.blenderbot_small.modeling_blenderbot_small.BlenderbotSmallDecoderWrapper | class BlenderbotSmallDecoderWrapper(BlenderbotSmallPreTrainedModel):
"""
This wrapper class is a helper class to correctly load pretrained checkpoints when the causal language model is
used in combination with the [`EncoderDecoderModel`] framework.
"""
def __init__(self, config):
super().__... | class BlenderbotSmallDecoderWrapper(BlenderbotSmallPreTrainedModel):
'''
This wrapper class is a helper class to correctly load pretrained checkpoints when the causal language model is
used in combination with the [`EncoderDecoderModel`] framework.
'''
def __init__(self, config):
pass
... | 3 | 1 | 3 | 0 | 3 | 0 | 1 | 0.67 | 1 | 2 | 1 | 0 | 2 | 1 | 2 | 4 | 12 | 2 | 6 | 4 | 3 | 4 | 6 | 4 | 3 | 1 | 2 | 0 | 2 |
934 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot_small/modeling_blenderbot_small.py | transformers.models.blenderbot_small.modeling_blenderbot_small.BlenderbotSmallEncoder | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
from .configuration_blenderbot_small import BlenderbotSmallConfig
import math
from typing import Callable, Optional, Union
from torch import nn
import torch
... |
class BlenderbotSmallEncoder(BlenderbotSmallPreTrainedModel):
'''
Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a
[`BlenderbotSmallEncoderLayer`].
Args:
config: BlenderbotSmallConfig
embed_tokens (nn.Embedding): output embedding
'''
... | 3 | 2 | 78 | 12 | 49 | 19 | 14 | 0.45 | 1 | 9 | 4 | 0 | 2 | 10 | 2 | 4 | 167 | 26 | 98 | 32 | 86 | 44 | 62 | 23 | 59 | 24 | 2 | 3 | 27 |
935 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot_small/modeling_blenderbot_small.py | transformers.models.blenderbot_small.modeling_blenderbot_small.BlenderbotSmallEncoderLayer | from ...activations import ACT2FN
from typing import Callable, Optional, Union
from .configuration_blenderbot_small import BlenderbotSmallConfig
from ...modeling_layers import GradientCheckpointingLayer
import torch
from torch import nn
class BlenderbotSmallEncoderLayer(GradientCheckpointingLayer):
def __init__(s... |
class BlenderbotSmallEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: BlenderbotSmallConfig, layer_idx: Optional[int]=None):
pass
def forward(self, hidden_states: torch.FloatTensor, attention_mask: torch.FloatTensor, layer_head_mask: torch.FloatTensor, output_attentions: Optional[... | 3 | 1 | 33 | 3 | 25 | 6 | 2 | 0.22 | 1 | 3 | 1 | 0 | 2 | 9 | 2 | 12 | 68 | 7 | 50 | 22 | 41 | 11 | 32 | 16 | 29 | 3 | 1 | 1 | 4 |
936 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot_small/modeling_blenderbot_small.py | transformers.models.blenderbot_small.modeling_blenderbot_small.BlenderbotSmallForCausalLM | from typing import Callable, Optional, Union
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
from torch ... |
class BlenderbotSmallForCausalLM(BlenderbotSmallPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
def set_decoder(self, decoder):
pass
def get_decoder(self):
... | 8 | 1 | 19 | 3 | 9 | 8 | 2 | 0.84 | 2 | 6 | 2 | 0 | 8 | 2 | 9 | 11 | 186 | 33 | 83 | 37 | 56 | 70 | 42 | 20 | 32 | 7 | 2 | 1 | 16 |
937 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot_small/modeling_blenderbot_small.py | transformers.models.blenderbot_small.modeling_blenderbot_small.BlenderbotSmallForConditionalGeneration | from ...generation import GenerationMixin
from torch.nn import CrossEntropyLoss
import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from .configuration_blenderbot_small import BlenderbotSmallConfig
from torch import nn
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPast... | @auto_docstring(custom_intro='\n The BlenderbotSmall Model with a language modeling head. Can be used for summarization.\n ')
class BlenderbotSmallForConditionalGeneration(BlenderbotSmallPreTrainedModel, GenerationMixin):
def __init__(self, config: BlenderbotSmallConfig):
pass
def get_encoder(se... | 9 | 1 | 13 | 1 | 11 | 1 | 2 | 0.08 | 2 | 9 | 4 | 0 | 8 | 3 | 9 | 11 | 133 | 16 | 108 | 49 | 74 | 9 | 52 | 26 | 42 | 8 | 2 | 2 | 18 |
938 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot_small/modeling_blenderbot_small.py | transformers.models.blenderbot_small.modeling_blenderbot_small.BlenderbotSmallLearnedPositionalEmbedding | import torch
from torch import nn
from typing import Callable, Optional, Union
class BlenderbotSmallLearnedPositionalEmbedding(nn.Embedding):
"""
This module learns positional embeddings up to a fixed maximum size.
"""
def __init__(self, num_embeddings: int, embedding_dim: int):
super().__init... |
class BlenderbotSmallLearnedPositionalEmbedding(nn.Embedding):
'''
This module learns positional embeddings up to a fixed maximum size.
'''
def __init__(self, num_embeddings: int, embedding_dim: int):
pass
def forward(self, input_ids_shape: torch.Size, past_key_values_length: int=0, posit... | 3 | 2 | 5 | 0 | 4 | 1 | 1 | 0.44 | 1 | 2 | 0 | 0 | 2 | 0 | 2 | 2 | 15 | 2 | 9 | 5 | 6 | 4 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
939 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot_small/modeling_blenderbot_small.py | transformers.models.blenderbot_small.modeling_blenderbot_small.BlenderbotSmallModel | import torch
from ...utils import auto_docstring, is_torch_flex_attn_available, is_torchdynamo_compiling, logging
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from torch import nn
from .configuration_blenderbot_small import BlenderbotSmallConfig
from ...modeling_outputs import BaseModelOutput, Ba... | @auto_docstring
class BlenderbotSmallModel(BlenderbotSmallPreTrainedModel):
def __init__(self, config: BlenderbotSmallConfig):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
def get_encoder(self):
pass
@auto_docstring
def... | 8 | 1 | 19 | 2 | 14 | 3 | 3 | 0.2 | 1 | 8 | 5 | 0 | 6 | 3 | 6 | 8 | 122 | 18 | 87 | 31 | 61 | 17 | 31 | 13 | 24 | 10 | 2 | 1 | 15 |
940 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot_small/modeling_blenderbot_small.py | transformers.models.blenderbot_small.modeling_blenderbot_small.BlenderbotSmallPreTrainedModel | import torch
from torch import nn
from ...modeling_attn_mask_utils import AttentionMaskConverter, _prepare_4d_attention_mask, _prepare_4d_attention_mask_for_sdpa
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...utils impor... | @auto_docstring
class BlenderbotSmallPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass
@property
def dummy_inputs(self):
pass
def _update_full_mask(self, attention_mask: Union[torch.Tensor, None], inputs_embeds: torch.Tensor):
pass
def _update_causal_... | 10 | 1 | 10 | 0 | 10 | 0 | 3 | 0 | 1 | 0 | 0 | 6 | 2 | 0 | 2 | 2 | 26 | 2 | 24 | 11 | 20 | 0 | 18 | 10 | 15 | 5 | 1 | 2 | 6 |
941 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot_small/tokenization_blenderbot_small.py | transformers.models.blenderbot_small.tokenization_blenderbot_small.BlenderbotSmallTokenizer | import os
import json
import regex as re
from ...tokenization_utils import PreTrainedTokenizer
from typing import Optional
class BlenderbotSmallTokenizer(PreTrainedTokenizer):
"""
Constructs a Blenderbot-90M tokenizer based on BPE (Byte-Pair-Encoding)
This tokenizer inherits from [`PreTrainedTokenizer`] w... |
class BlenderbotSmallTokenizer(PreTrainedTokenizer):
'''
Constructs a Blenderbot-90M tokenizer based on BPE (Byte-Pair-Encoding)
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
the superclass for more information regarding methods.
... | 11 | 5 | 14 | 1 | 13 | 1 | 3 | 0.22 | 1 | 10 | 0 | 0 | 9 | 4 | 9 | 98 | 167 | 24 | 118 | 48 | 98 | 26 | 99 | 34 | 89 | 12 | 3 | 4 | 26 |
942 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blenderbot_small/tokenization_blenderbot_small_fast.py | transformers.models.blenderbot_small.tokenization_blenderbot_small_fast.BlenderbotSmallTokenizerFast | from typing import Optional
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_blenderbot_small import BlenderbotSmallTokenizer
from tokenizers import ByteLevelBPETokenizer
class BlenderbotSmallTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" BlenderbotSmall tokeniz... |
class BlenderbotSmallTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" BlenderbotSmall tokenizer (backed by HuggingFace's *tokenizers* library).
Args:
vocab_file (`str`):
Path to the vocabulary file.
'''
def __init__(self, vocab_file=None, merges_file=None, unk_tok... | 4 | 2 | 17 | 1 | 12 | 4 | 2 | 0.42 | 1 | 3 | 0 | 0 | 3 | 1 | 3 | 91 | 66 | 9 | 40 | 22 | 24 | 17 | 17 | 10 | 13 | 2 | 3 | 1 | 5 |
943 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/configuration_blip.py | transformers.models.blip.configuration_blip.BlipConfig | from ...configuration_utils import PretrainedConfig
class BlipConfig(PretrainedConfig):
"""
[`BlipConfig`] is the configuration class to store the configuration of a [`BlipModel`]. It is used to instantiate
a BLIP model according to the specified arguments, defining the text model and vision model configs.... |
class BlipConfig(PretrainedConfig):
'''
[`BlipConfig`] is the configuration class to store the configuration of a [`BlipModel`]. It is used to instantiate
a BLIP model according to the specified arguments, defining the text model and vision model configs. Instantiating
a configuration with the defaults... | 2 | 1 | 21 | 4 | 14 | 3 | 2 | 1.41 | 1 | 3 | 2 | 0 | 1 | 8 | 2 | 2 | 97 | 20 | 32 | 23 | 19 | 45 | 22 | 13 | 19 | 3 | 1 | 1 | 4 |
944 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/configuration_blip.py | transformers.models.blip.configuration_blip.BlipTextConfig | from ...configuration_utils import PretrainedConfig
class BlipTextConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`BlipTextModel`]. It is used to instantiate a BLIP
text model according to the specified arguments, defining the model architecture. Instantiating... |
class BlipTextConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`BlipTextModel`]. It is used to instantiate a BLIP
text model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a ... | 2 | 1 | 48 | 1 | 47 | 0 | 1 | 1.22 | 1 | 1 | 0 | 0 | 1 | 16 | 1 | 1 | 122 | 11 | 50 | 43 | 25 | 61 | 21 | 20 | 19 | 1 | 1 | 0 | 1 |
945 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/configuration_blip.py | transformers.models.blip.configuration_blip.BlipVisionConfig | from ...configuration_utils import PretrainedConfig
class BlipVisionConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`BlipVisionModel`]. It is used to instantiate a
BLIP vision model according to the specified arguments, defining the model architecture. Instant... |
class BlipVisionConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`BlipVisionModel`]. It is used to instantiate a
BLIP vision model according to the specified arguments, defining the model architecture. Instantiating a
configuration defaults will yield a sim... | 2 | 1 | 28 | 1 | 27 | 0 | 1 | 1.3 | 1 | 1 | 0 | 0 | 1 | 11 | 1 | 1 | 80 | 11 | 30 | 29 | 14 | 39 | 16 | 15 | 14 | 1 | 1 | 0 | 1 |
946 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/image_processing_blip.py | transformers.models.blip.image_processing_blip.BlipImageProcessor | from typing import Optional, Union
from ...utils import TensorType, filter_out_non_signature_kwargs, is_vision_available, logging
from ...image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD, ChannelDimension, ImageInput, PILImageResampling, infer_channel_dimension_format, is_scaled_image, make_flat_list_of_images, to_... |
class BlipImageProcessor(BaseImageProcessor):
'''
Constructs a BLIP 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` parameter in ... | 5 | 3 | 69 | 5 | 39 | 24 | 8 | 0.88 | 1 | 8 | 2 | 0 | 3 | 9 | 3 | 23 | 248 | 21 | 121 | 52 | 81 | 106 | 52 | 16 | 48 | 17 | 3 | 1 | 23 |
947 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/image_processing_blip_fast.py | transformers.models.blip.image_processing_blip_fast.BlipImageProcessorFast | from ...image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD, PILImageResampling
from ...utils import auto_docstring
from ...image_processing_utils_fast import BaseImageProcessorFast
@auto_docstring
class BlipImageProcessorFast(BaseImageProcessorFast):
resample = PILImageResampling.BICUBIC
image_mean = OPENAI_... | @auto_docstring
class BlipImageProcessorFast(BaseImageProcessorFast):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0.22 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 34 | 11 | 0 | 9 | 9 | 8 | 2 | 9 | 9 | 8 | 0 | 4 | 0 | 0 |
948 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip.py | transformers.models.blip.modeling_blip.BlipAttention | import torch
from ...processing_utils import Unpack
from typing import Any, Optional, Union
from torch import nn
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int
class BlipAttention(nn.Module):
"""Multi-headed attention from 'Attention Is All You Need' pape... |
class BlipAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config):
pass
def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=N... | 4 | 2 | 21 | 5 | 14 | 2 | 2 | 0.16 | 1 | 5 | 0 | 0 | 3 | 8 | 3 | 13 | 67 | 17 | 43 | 26 | 34 | 7 | 31 | 21 | 27 | 3 | 1 | 1 | 6 |
949 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip.py | transformers.models.blip.modeling_blip.BlipEncoder | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from torch import nn
from .configuration_blip import BlipConfig, BlipTextConfig, BlipVisionConfig
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int
import torch
from ...processing_utils i... |
class BlipEncoder(nn.Module):
'''
Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a
[`BlipEncoderLayer`].
Args:
config (`BlipConfig`):
The corresponding vision configuration for the `BlipEncoder`.
'''
def __init__(self, conf... | 4 | 1 | 37 | 4 | 24 | 9 | 7 | 0.52 | 1 | 9 | 3 | 0 | 2 | 3 | 2 | 12 | 84 | 11 | 48 | 18 | 38 | 25 | 27 | 11 | 24 | 12 | 1 | 2 | 13 |
950 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip.py | transformers.models.blip.modeling_blip.BlipEncoderLayer | from ...modeling_layers import GradientCheckpointingLayer
from ...processing_utils import Unpack
import torch
from torch import nn
from .configuration_blip import BlipConfig, BlipTextConfig, BlipVisionConfig
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int
clas... |
class BlipEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: BlipConfig):
pass
@auto_docstring
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, **kwargs: Unpack[TransformersKwargs]) -> torch.FloatTensor:
pass | 4 | 0 | 22 | 3 | 15 | 5 | 2 | 0.33 | 1 | 6 | 3 | 0 | 2 | 5 | 2 | 12 | 46 | 6 | 30 | 16 | 22 | 10 | 21 | 11 | 18 | 2 | 1 | 1 | 3 |
951 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip.py | transformers.models.blip.modeling_blip.BlipForConditionalGeneration | import torch
from .configuration_blip import BlipConfig, BlipTextConfig, BlipVisionConfig
from typing import Any, Optional, Union
from ...processing_utils import Unpack
from .modeling_blip_text import BlipTextLMHeadModel, BlipTextModel
from ...generation import GenerationMixin
from ...utils import ModelOutput, Transfor... | null | 10 | 2 | 32 | 6 | 18 | 8 | 3 | 0.41 | 2 | 8 | 4 | 0 | 5 | 4 | 5 | 6 | 172 | 35 | 97 | 40 | 71 | 40 | 39 | 21 | 33 | 6 | 2 | 1 | 13 |
952 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip.py | transformers.models.blip.modeling_blip.BlipForConditionalGenerationModelOutput | from typing import Any, Optional, Union
import warnings
from dataclasses import dataclass
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int
import torch
@dataclass
@auto_docstring(custom_intro="\n Adapted from the base class for vision model's outputs that al... | @dataclass
@auto_docstring(custom_intro="\n Adapted from the base class for vision model's outputs that also contains image embeddings of the pooling of the\n last hidden states. This class also adds the loss term from the text decoder.\n ")
class BlipForConditionalGenerationModelOutput(ModelOutput):
'''
... | 5 | 1 | 7 | 0 | 7 | 0 | 1 | 1.47 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 42 | 5 | 15 | 9 | 12 | 22 | 10 | 8 | 8 | 1 | 1 | 0 | 1 |
953 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip.py | transformers.models.blip.modeling_blip.BlipForImageTextRetrieval | from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int
from typing import Any, Optional, Union
from torch import nn
from .modeling_blip_text import BlipTextLMHeadModel, BlipTextModel
from .configuration_blip import BlipConfig, BlipTextConfig, BlipVisionConfig
from tor... | @auto_docstring(custom_intro='\n BLIP Model with a vision and text projector, and a classification head on top. The model is used in the context of\n image-text retrieval. Given an image and a text, the model returns the probability of the text being relevant to\n the image.\n ')
class BlipForImageTextRetri... | 8 | 1 | 29 | 5 | 19 | 5 | 3 | 0.25 | 1 | 8 | 5 | 0 | 4 | 7 | 4 | 5 | 125 | 24 | 81 | 32 | 64 | 20 | 36 | 21 | 31 | 8 | 2 | 1 | 13 |
954 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip.py | transformers.models.blip.modeling_blip.BlipForQuestionAnswering | from typing import Any, Optional, Union
import torch
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int
from .configuration_blip import BlipConfig, BlipTextConfig, BlipVisionConfig
from .modeling_blip_text import BlipTextLMHeadModel, BlipTextModel
from ...generati... | @auto_docstring(custom_intro='\n BLIP Model for visual question answering. The model consists of a vision encoder, a text encoder as well as a text\n decoder. The vision encoder will encode the input image, the text encoder will encode the input question together\n with the encoding of the image, and the text ... | 10 | 2 | 42 | 8 | 23 | 12 | 3 | 0.48 | 1 | 10 | 5 | 0 | 5 | 5 | 5 | 6 | 222 | 43 | 121 | 49 | 93 | 58 | 48 | 28 | 42 | 10 | 2 | 1 | 15 |
955 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip.py | transformers.models.blip.modeling_blip.BlipMLP | from torch import nn
import torch
from ...activations import ACT2FN
class BlipMLP(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.activation_fn = ACT2FN[config.hidden_act]
self.fc1 = nn.Linear(config.hidden_size, config.intermediate_size)
... |
class BlipMLP(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 13 | 1 | 12 | 7 | 9 | 0 | 12 | 7 | 9 | 1 | 1 | 0 | 2 |
956 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip.py | transformers.models.blip.modeling_blip.BlipModel | import torch
from .configuration_blip import BlipConfig, BlipTextConfig, BlipVisionConfig
from ...processing_utils import Unpack
from .modeling_blip_text import BlipTextLMHeadModel, BlipTextModel
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int
from torch import... | @auto_docstring(custom_intro='\n This model is going to be deprecated in future versions. Please use `BlipForConditionalGeneration`, `BlipForQuestionAnswering` or `BlipForImageTextRetrieval` depending on your usecase.\n ')
class BlipModel(BlipPreTrainedModel):
def __init__(self, config: BlipConfig):
... | 14 | 4 | 37 | 7 | 21 | 10 | 3 | 0.45 | 1 | 11 | 6 | 0 | 7 | 8 | 7 | 8 | 275 | 54 | 154 | 73 | 112 | 69 | 68 | 40 | 60 | 7 | 2 | 1 | 18 |
957 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip.py | transformers.models.blip.modeling_blip.BlipOutput | import torch
from typing import Any, Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from dataclasses import dataclass
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int
@dataclass
@auto_docstring
class BlipOutput(Model... | @dataclass
@auto_docstring
class BlipOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `return_loss` is `True`):
Contrastive loss for image-text similarity.
logits_per_image (`torch.FloatTensor` of shape `(image_batch_size, text_batch_size)`):
The ... | 4 | 1 | 5 | 0 | 5 | 0 | 2 | 1.46 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 34 | 2 | 13 | 9 | 11 | 19 | 10 | 9 | 8 | 2 | 1 | 0 | 2 |
958 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip.py | transformers.models.blip.modeling_blip.BlipPreTrainedModel | from torch import nn
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int
from ...modeling_utils import PreTrainedModel
from .configuration_blip import BlipConfig, BlipTextConfig, BlipVisionConfig
@auto_docstring
class BlipPreTrainedModel(PreTrainedModel):
conf... | @auto_docstring
class BlipPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 28 | 3 | 24 | 1 | 7 | 0.17 | 1 | 1 | 1 | 5 | 1 | 0 | 1 | 1 | 40 | 5 | 30 | 8 | 28 | 5 | 20 | 8 | 18 | 7 | 1 | 2 | 7 |
959 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip.py | transformers.models.blip.modeling_blip.BlipTextEmbeddings | import torch
from typing import Any, Optional, Union
from torch import nn
from .configuration_blip import BlipConfig, BlipTextConfig, BlipVisionConfig
class BlipTextEmbeddings(nn.Module):
def __init__(self, config: BlipTextConfig):
super().__init__()
embed_dim = config.hidden_size
self.tok... |
class BlipTextEmbeddings(nn.Module):
def __init__(self, config: BlipTextConfig):
pass
def forward(self, input_ids: Optional[torch.LongTensor]=None, position_ids: Optional[torch.LongTensor]=None, inputs_embeds: Optional[torch.FloatTensor]=None) -> torch.Tensor:
pass | 3 | 0 | 18 | 4 | 14 | 1 | 3 | 0.03 | 1 | 4 | 1 | 0 | 2 | 2 | 2 | 12 | 38 | 8 | 29 | 15 | 21 | 1 | 19 | 10 | 16 | 5 | 1 | 1 | 6 |
960 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip.py | transformers.models.blip.modeling_blip.BlipVisionEmbeddings | from torch import nn
from .configuration_blip import BlipConfig, BlipTextConfig, BlipVisionConfig
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int
import torch
class BlipVisionEmbeddings(nn.Module):
def __init__(self, config: BlipVisionConfig):
sup... |
class BlipVisionEmbeddings(nn.Module):
def __init__(self, config: BlipVisionConfig):
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 use ... | 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 |
961 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip.py | transformers.models.blip.modeling_blip.BlipVisionModel | from ...utils.generic import check_model_inputs
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging, torch_int
from .configuration_blip import BlipConfig, BlipTextConfig, BlipVisionConfig
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
import torch... |
class BlipVisionModel(BlipPreTrainedModel):
def __init__(self, config: BlipVisionConfig):
pass
@check_model_inputs
@auto_docstring
def forward(self, pixel_values: Optional[torch.FloatTensor]=None, interpolate_pos_encoding: bool=False, **kwargs: Unpack[TransformersKwargs]) -> Union[tuple, BaseM... | 6 | 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 |
962 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip_text.py | transformers.models.blip.modeling_blip_text.BlipTextAttention | from torch import Tensor, device, nn
from typing import Optional, Union
import torch
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
class Bl... |
class BlipTextAttention(nn.Module):
def __init__(self, config, is_cross_attention=False, layer_idx=None):
pass
def prune_heads(self, heads):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mas... | 5 | 0 | 15 | 1 | 13 | 1 | 1 | 0.07 | 1 | 6 | 2 | 0 | 3 | 3 | 3 | 13 | 47 | 4 | 41 | 20 | 28 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
963 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip_text.py | transformers.models.blip.modeling_blip_text.BlipTextEmbeddings | from typing import Optional, Union
from torch import Tensor, device, nn
import torch
class BlipTextEmbeddings(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 BlipTextEmbeddings(nn.Module):
'''Construct the embeddings from word and position embeddings.'''
def __init__(self, config):
pass
def forward(self, input_ids: Optional[torch.LongTensor]=None, position_ids: Optional[torch.LongTensor]=None, inputs_embeds: Optional[torch.FloatTensor]=None, pas... | 3 | 1 | 23 | 4 | 17 | 2 | 3 | 0.11 | 1 | 3 | 0 | 0 | 2 | 6 | 2 | 12 | 49 | 10 | 35 | 19 | 26 | 4 | 26 | 13 | 23 | 5 | 1 | 1 | 6 |
964 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip_text.py | transformers.models.blip.modeling_blip_text.BlipTextEncoder | import torch
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from torch import Tensor, device, nn
from typing import Optional, Union
class BlipT... |
class BlipTextEncoder(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[to... | 3 | 0 | 45 | 4 | 41 | 0 | 9 | 0 | 1 | 7 | 2 | 0 | 2 | 3 | 2 | 12 | 91 | 8 | 83 | 27 | 68 | 0 | 35 | 15 | 32 | 16 | 1 | 2 | 17 |
965 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip_text.py | transformers.models.blip.modeling_blip_text.BlipTextIntermediate | import torch
from torch import Tensor, device, nn
from ...activations import ACT2FN
class BlipTextIntermediate(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 BlipTextIntermediate(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 |
966 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip_text.py | transformers.models.blip.modeling_blip_text.BlipTextLMHeadModel | from typing import Optional, Union
from ...generation import GenerationMixin
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions
import torch
from torch.nn import CrossEntropyLoss
from ...cache_utils import Cache, Dyn... |
class BlipTextLMHeadModel(BlipTextPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, new_embeddings):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, ... | 8 | 1 | 18 | 2 | 13 | 4 | 2 | 0.28 | 2 | 8 | 3 | 0 | 8 | 3 | 8 | 9 | 148 | 19 | 101 | 42 | 74 | 28 | 52 | 24 | 43 | 8 | 2 | 2 | 19 |
967 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip_text.py | transformers.models.blip.modeling_blip_text.BlipTextLMPredictionHead | from torch import Tensor, device, nn
import torch
class BlipTextLMPredictionHead(nn.Module):
def __init__(self, config):
super().__init__()
self.transform = BlipTextPredictionHeadTransform(config)
self.decoder = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
self.bias... |
class BlipTextLMPredictionHead(nn.Module):
def __init__(self, config):
pass
def _tie_weights(self):
pass
def forward(self, hidden_states):
pass | 4 | 0 | 6 | 1 | 4 | 1 | 1 | 0.23 | 1 | 2 | 1 | 0 | 3 | 3 | 3 | 13 | 21 | 5 | 13 | 7 | 9 | 3 | 13 | 7 | 9 | 1 | 1 | 0 | 3 |
968 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip_text.py | transformers.models.blip.modeling_blip_text.BlipTextLayer | from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from ...utils.deprecation import deprecate_kwarg
import torch
from ...modeling_layers import GradientCheckpointingLayer
from typing import Optional, Union
from ...cache_utils import Cache, DynamicCache, EncoderD... |
class BlipTextLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_num):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.Flo... | 5 | 0 | 19 | 1 | 18 | 1 | 2 | 0.04 | 1 | 6 | 3 | 0 | 3 | 8 | 3 | 13 | 61 | 6 | 54 | 30 | 41 | 2 | 30 | 21 | 26 | 3 | 1 | 1 | 6 |
969 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip_text.py | transformers.models.blip.modeling_blip_text.BlipTextModel | from torch import Tensor, device, nn
import torch
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions
from typing import Optional, Union
class BlipT... |
class BlipTextModel(BlipTextPreTrainedModel):
'''
The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of
cross-attention is added between the self-attention layers, following the architecture described in [Attention is
all you need](https://huggingf... | 7 | 4 | 37 | 3 | 24 | 10 | 5 | 0.44 | 1 | 10 | 4 | 0 | 6 | 4 | 6 | 7 | 237 | 26 | 147 | 47 | 122 | 65 | 77 | 29 | 70 | 19 | 2 | 3 | 30 |
970 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip_text.py | transformers.models.blip.modeling_blip_text.BlipTextOnlyMLMHead | import torch
from torch import Tensor, device, nn
class BlipTextOnlyMLMHead(nn.Module):
def __init__(self, config):
super().__init__()
self.predictions = BlipTextLMPredictionHead(config)
def forward(self, sequence_output: torch.Tensor) -> torch.Tensor:
prediction_scores = self.predict... |
class BlipTextOnlyMLMHead(nn.Module):
def __init__(self, config):
pass
def forward(self, sequence_output: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 2 | 1 | 2 | 12 | 8 | 1 | 7 | 5 | 4 | 0 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
971 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip_text.py | transformers.models.blip.modeling_blip_text.BlipTextOutput | import torch
from torch import Tensor, device, nn
class BlipTextOutput(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.d... |
class BlipTextOutput(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 |
972 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip_text.py | transformers.models.blip.modeling_blip_text.BlipTextPooler | import torch
from torch import Tensor, device, nn
class BlipTextPooler(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:
... |
class BlipTextPooler(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 |
973 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip_text.py | transformers.models.blip.modeling_blip_text.BlipTextPreTrainedModel | from torch import Tensor, device, nn
from .configuration_blip import BlipTextConfig
from ...modeling_utils import PreTrainedModel
class BlipTextPreTrainedModel(PreTrainedModel):
"""
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
... |
class BlipTextPreTrainedModel(PreTrainedModel):
'''
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
models.
'''
def _init_weights(self, module):
'''Initialize the weights'''
pass | 2 | 2 | 11 | 0 | 8 | 3 | 4 | 0.58 | 1 | 0 | 0 | 2 | 1 | 0 | 1 | 1 | 21 | 2 | 12 | 5 | 10 | 7 | 11 | 5 | 9 | 4 | 1 | 1 | 4 |
974 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip_text.py | transformers.models.blip.modeling_blip_text.BlipTextPredictionHeadTransform | from ...activations import ACT2FN
from torch import Tensor, device, nn
import torch
class BlipTextPredictionHeadTransform(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 BlipTextPredictionHeadTransform(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 |
975 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip_text.py | transformers.models.blip.modeling_blip_text.BlipTextSelfAttention | from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
import torch
from torch import Tensor, device, nn
from ...utils.deprecation import deprecate_kwarg
import math
from typing import Optional, Union
class BlipTextSelfAttention(nn.Module):
def __init__(self, config, is_cross_attention, layer_idx=Non... |
class BlipTextSelfAttention(nn.Module):
def __init__(self, config, is_cross_attention, layer_idx=None):
pass
def save_attn_gradients(self, attn_gradients):
pass
def get_attn_gradients(self):
pass
def save_attention_map(self, attention_map):
pass
def get_attentio... | 8 | 0 | 17 | 3 | 13 | 1 | 3 | 0.11 | 1 | 5 | 0 | 0 | 7 | 13 | 7 | 17 | 124 | 24 | 91 | 50 | 74 | 10 | 75 | 41 | 67 | 9 | 1 | 2 | 18 |
976 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/modeling_blip_text.py | transformers.models.blip.modeling_blip_text.BlipTextSelfOutput | from torch import Tensor, device, nn
import torch
class BlipTextSelfOutput(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.dro... |
class BlipTextSelfOutput(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 |
977 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/processing_blip.py | transformers.models.blip.processing_blip.BlipProcessor | from typing import Optional, Union
from ...processing_utils import ProcessingKwargs, ProcessorMixin, Unpack
from ...tokenization_utils_base import BatchEncoding, PreTokenizedInput, TextInput
from ...image_utils import ImageInput
class BlipProcessor(ProcessorMixin):
"""
Constructs a BLIP processor which wraps a... |
class BlipProcessor(ProcessorMixin):
'''
Constructs a BLIP processor which wraps a BERT tokenizer and BLIP image processor into a single processor.
[`BlipProcessor`] offers all the functionalities of [`BlipImageProcessor`] and [`BertTokenizerFast`]. See the
docstring of [`~BlipProcessor.__call__`] and ... | 5 | 2 | 14 | 1 | 7 | 6 | 2 | 0.93 | 1 | 7 | 2 | 0 | 5 | 1 | 5 | 22 | 94 | 13 | 42 | 24 | 28 | 39 | 30 | 16 | 24 | 5 | 2 | 2 | 9 |
978 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip/processing_blip.py | transformers.models.blip.processing_blip.BlipProcessorKwargs | from ...processing_utils import ProcessingKwargs, ProcessorMixin, Unpack
class BlipProcessorKwargs(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_mapping... |
class BlipProcessorKwargs(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 |
979 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/configuration_blip_2.py | transformers.models.blip_2.configuration_blip_2.Blip2Config | from ...configuration_utils import PretrainedConfig
from ..auto import CONFIG_MAPPING, AutoConfig
from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES
from typing import Optional
class Blip2Config(PretrainedConfig):
"""
[`Blip2Config`] is the configuration class to store the configuration... |
class Blip2Config(PretrainedConfig):
'''
[`Blip2Config`] is the configuration class to store the configuration of a [`Blip2ForConditionalGeneration`]. It is
used to instantiate a BLIP-2 model according to the specified arguments, defining the vision model, Q-Former model
and language model configs. Ins... | 4 | 2 | 33 | 4 | 22 | 7 | 4 | 1.19 | 1 | 3 | 2 | 0 | 1 | 9 | 2 | 2 | 127 | 22 | 48 | 31 | 29 | 57 | 27 | 15 | 24 | 5 | 1 | 1 | 7 |
980 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/configuration_blip_2.py | transformers.models.blip_2.configuration_blip_2.Blip2QFormerConfig | from ...configuration_utils import PretrainedConfig
class Blip2QFormerConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Blip2QFormerModel`]. It is used to instantiate a
BLIP-2 Querying Transformer (Q-Former) model according to the specified arguments, defining ... |
class Blip2QFormerConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Blip2QFormerModel`]. It is used to instantiate a
BLIP-2 Querying Transformer (Q-Former) model according to the specified arguments, defining the model architecture.
Instantiating a configur... | 2 | 1 | 37 | 1 | 36 | 0 | 1 | 1.44 | 1 | 1 | 0 | 0 | 1 | 15 | 1 | 1 | 104 | 9 | 39 | 38 | 18 | 56 | 20 | 19 | 18 | 1 | 1 | 0 | 1 |
981 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/configuration_blip_2.py | transformers.models.blip_2.configuration_blip_2.Blip2VisionConfig | from ...configuration_utils import PretrainedConfig
class Blip2VisionConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Blip2VisionModel`]. It is used to instantiate a
BLIP-2 vision encoder according to the specified arguments, defining the model architecture. I... |
class Blip2VisionConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Blip2VisionModel`]. It is used to instantiate a
BLIP-2 vision encoder according to the specified arguments, defining the model architecture. Instantiating a
configuration defaults will yield... | 2 | 1 | 28 | 1 | 27 | 0 | 1 | 1.33 | 1 | 1 | 0 | 0 | 1 | 11 | 1 | 1 | 80 | 10 | 30 | 29 | 14 | 40 | 16 | 15 | 14 | 1 | 1 | 0 | 1 |
982 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2Attention | from typing import Any, Callable, Optional, Union
import torch
from torch import nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
class Blip2Attention(nn.Module):
"""Multi-headed attention from 'Attention Is All You Need' paper"""
def __init__(self, config):
super().__init__()... |
class Blip2Attention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config):
pass
def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
pass
def forward(self, hidden_states: torch.Tensor, head_mask: Optional[torch.Tensor]=... | 4 | 2 | 25 | 6 | 17 | 2 | 3 | 0.16 | 1 | 5 | 0 | 0 | 3 | 8 | 3 | 13 | 79 | 20 | 51 | 29 | 42 | 8 | 40 | 24 | 36 | 4 | 1 | 1 | 8 |
983 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2Encoder | from torch import nn
from ...processing_utils import Unpack
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPooling, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithPast, Seq2SeqLMOutput
from .configuration_blip_2 import Blip2Config, Blip2QF... |
class Blip2Encoder(nn.Module):
'''
Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a
[`Blip2EncoderLayer`].
Args:
config (`Blip2Config`):
The corresponding vision configuration for the `Blip2Encoder`.
'''
def __init__(self, ... | 4 | 1 | 37 | 4 | 24 | 9 | 7 | 0.52 | 1 | 9 | 3 | 0 | 2 | 3 | 2 | 12 | 84 | 11 | 48 | 18 | 38 | 25 | 27 | 11 | 24 | 12 | 1 | 2 | 13 |
984 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2EncoderLayer | from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
from torch import nn
from ...processing_utils import Unpack
from .configuration_blip_2 import Blip2Config, Blip2QFormerConfig, Blip2VisionConfig
import torch
from ...modeling_layer... |
class Blip2EncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Blip2Config):
pass
@auto_docstring
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, **kwargs: Unpack[TransformersKwargs]) -> torch.FloatTensor:
pass | 4 | 0 | 22 | 3 | 15 | 5 | 2 | 0.33 | 1 | 6 | 3 | 0 | 2 | 5 | 2 | 12 | 46 | 6 | 30 | 16 | 22 | 10 | 21 | 11 | 18 | 2 | 1 | 1 | 3 |
985 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2ForConditionalGeneration | from torch import nn
from ...processing_utils import Unpack
from .configuration_blip_2 import Blip2Config, Blip2QFormerConfig, Blip2VisionConfig
import torch
from ...generation import GenerationMixin
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs,... | null | 18 | 5 | 29 | 4 | 18 | 7 | 3 | 0.4 | 2 | 8 | 6 | 0 | 11 | 6 | 11 | 12 | 340 | 56 | 204 | 73 | 170 | 82 | 111 | 52 | 99 | 10 | 2 | 2 | 32 |
986 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2ForConditionalGenerationModelOutput | from dataclasses import dataclass
from typing import Any, Callable, Optional, Union
import torch
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
@dataclass
@auto_docstring(custom_intro='\n Class defining the outputs of [`Bli... | @dataclass
@auto_docstring(custom_intro='\n Class defining the outputs of [`Blip2ForConditionalGeneration`].\n ')
class Blip2ForConditionalGenerationModelOutput(ModelOutput):
'''
loss (`torch.FloatTensor`, *optional*, returned when `labels` is provided, `torch.FloatTensor` of shape `(1,)`):
Langua... | 4 | 1 | 7 | 0 | 7 | 0 | 2 | 1.08 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 30 | 3 | 13 | 7 | 11 | 14 | 8 | 7 | 6 | 2 | 1 | 0 | 2 |
987 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2ForImageTextRetrieval | from torch import nn
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, Callable, Optional, Union
@auto_docs... | @auto_docstring(custom_intro='\n BLIP-2 Model with a vision and text projector, and a classification head on top. The model is used in the context\n of image-text retrieval. Given an image and a text, the model returns the probability of the text being relevant to\n the image.\n ')
class Blip2ForImageTextRe... | 7 | 1 | 41 | 8 | 23 | 10 | 3 | 0.41 | 1 | 7 | 5 | 0 | 4 | 7 | 4 | 5 | 173 | 36 | 97 | 38 | 81 | 40 | 49 | 28 | 44 | 9 | 2 | 1 | 12 |
988 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2ImageTextMatchingModelOutput | from dataclasses import dataclass
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPooling, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithPast, Seq2SeqLMOutput
import torch
from ...utils import ModelOutput, TransformersKwargs, auto_docstrin... | @dataclass
@auto_docstring
class Blip2ImageTextMatchingModelOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `return_loss` is `True`):
Contrastive loss for image-text similarity.
logits_per_image (`torch.FloatTensor` of shape `(image_batch_size, text_batc... | 4 | 1 | 5 | 0 | 5 | 0 | 2 | 1.46 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 34 | 2 | 13 | 9 | 11 | 19 | 10 | 9 | 8 | 2 | 1 | 0 | 2 |
989 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2MLP | from ...activations import ACT2FN
import torch
from torch import nn
class Blip2MLP(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.activation_fn = ACT2FN[config.hidden_act]
self.fc1 = nn.Linear(config.hidden_size, config.intermediate_size)
... |
class Blip2MLP(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 13 | 1 | 12 | 7 | 9 | 0 | 12 | 7 | 9 | 1 | 1 | 0 | 2 |
990 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2Model | from torch import nn
import warnings
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPooling, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithPast, Seq2SeqLMOutput
from ...processing_utils import Unpack
from .configuration_blip_2 import Blip... | @auto_docstring(custom_intro='\n BLIP-2 Model for generating text and image features. The model consists of a vision encoder, Querying Transformer\n (Q-Former) and a language model.\n ')
class Blip2Model(Blip2PreTrainedModel):
def __init__(self, config: Blip2Config):
pass
def get_input_embedd... | 23 | 5 | 27 | 3 | 17 | 7 | 3 | 0.39 | 1 | 9 | 6 | 0 | 12 | 6 | 12 | 13 | 344 | 51 | 212 | 87 | 158 | 82 | 92 | 47 | 79 | 9 | 2 | 2 | 33 |
991 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2PreTrainedModel | from .configuration_blip_2 import Blip2Config, Blip2QFormerConfig, Blip2VisionConfig
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
from torch import nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
@a... | @auto_docstring
class Blip2PreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 19 | 2 | 16 | 1 | 7 | 0.17 | 1 | 2 | 2 | 7 | 1 | 0 | 1 | 1 | 39 | 5 | 29 | 9 | 27 | 5 | 21 | 9 | 19 | 7 | 1 | 2 | 7 |
992 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2QFormerAttention | from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from torch import nn
from ...processing_utils import Unpack
import torch
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_in... |
class Blip2QFormerAttention(nn.Module):
def __init__(self, config, is_cross_attention=False):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidd... | 4 | 0 | 15 | 1 | 13 | 1 | 1 | 0.07 | 1 | 6 | 2 | 0 | 3 | 3 | 3 | 13 | 47 | 4 | 41 | 20 | 28 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
993 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2QFormerEncoder | from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
from torch import nn
from ...processing_utils import Unpack
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPooling, ... |
class Blip2QFormerEncoder(nn.Module):
def __init__(self, config):
pass
@can_return_tuple
def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, query_length=0, **kwargs: Unpack[TransformersKwargs]):
pass | 4 | 0 | 46 | 4 | 42 | 0 | 9 | 0 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 12 | 93 | 8 | 85 | 28 | 69 | 0 | 35 | 15 | 32 | 16 | 1 | 3 | 17 |
994 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2QFormerIntermediate | from ...activations import ACT2FN
import torch
from torch import nn
class Blip2QFormerIntermediate(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.interme... |
class Blip2QFormerIntermediate(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 |
995 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2QFormerLayer | from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from ...processing_utils import Unpack
import torch
from ...modeling_layers import GradientCheckpointingLayer
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_no... |
class Blip2QFormerLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_idx):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, encoder_hidden_states=None, encoder_attention_mask=None, query_length=0, **kwargs: Unpack[TransformersKwargs]):
pass
def ... | 5 | 0 | 25 | 3 | 21 | 1 | 3 | 0.02 | 1 | 5 | 3 | 0 | 4 | 10 | 4 | 14 | 102 | 14 | 86 | 38 | 71 | 2 | 46 | 28 | 41 | 6 | 1 | 3 | 11 |
996 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2QFormerModel | from torch import nn
from ...processing_utils import Unpack
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPooling, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithPast, Seq2SeqLMOutput
from .configuration_blip_2 import Blip2Config, Blip2QF... | @auto_docstring(custom_intro='\n BLIP-2 Querying Transformer (Q-Former).\n ')
class Blip2QFormerModel(Blip2PreTrainedModel):
def __init__(self, config: Blip2QFormerConfig):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
def _prune_... | 10 | 3 | 30 | 3 | 18 | 9 | 4 | 0.53 | 1 | 9 | 3 | 0 | 6 | 4 | 6 | 7 | 190 | 24 | 109 | 44 | 83 | 58 | 55 | 25 | 48 | 13 | 2 | 2 | 21 |
997 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2QFormerMultiHeadAttention | from torch import nn
from ...processing_utils import Unpack
import torch
import math
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, filter_out_non_signature_kwargs, logging, torch_int
class Blip2QFormerMultiHeadAttention(nn.Module):
def __init__(self, config, is_cross_atte... |
class Blip2QFormerMultiHeadAttention(nn.Module):
def __init__(self, config, is_cross_attention=False):
pass
def save_attn_gradients(self, attn_gradients):
pass
def get_attn_gradients(self):
pass
def save_attention_map(self, attention_map):
pass
def get_attention... | 8 | 0 | 18 | 3 | 13 | 1 | 3 | 0.11 | 1 | 3 | 0 | 0 | 7 | 14 | 7 | 17 | 130 | 26 | 95 | 51 | 78 | 10 | 79 | 42 | 71 | 10 | 1 | 2 | 19 |
998 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2QFormerOutput | import torch
from torch import nn
class Blip2QFormerOutput(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.... |
class Blip2QFormerOutput(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 |
999 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/blip_2/modeling_blip_2.py | transformers.models.blip_2.modeling_blip_2.Blip2QFormerSelfOutput | import torch
from torch import nn
class Blip2QFormerSelfOutput(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.Dr... |
class Blip2QFormerSelfOutput(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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.