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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4,500 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverImagePreprocessor | from torch import nn
import torch
import numpy as np
import math
from typing import Any, Callable, Optional, Union
class PerceiverImagePreprocessor(AbstractPreprocessor):
"""
Image preprocessing for Perceiver Encoder.
Note: the *out_channels* argument refers to the output channels of a convolutional layer... |
class PerceiverImagePreprocessor(AbstractPreprocessor):
'''
Image preprocessing for Perceiver Encoder.
Note: the *out_channels* argument refers to the output channels of a convolutional layer, if *prep_type* is set to
"conv1x1" or "conv". If one adds absolute position embeddings, one must make sure the... | 6 | 2 | 49 | 6 | 36 | 8 | 9 | 0.43 | 1 | 8 | 1 | 0 | 4 | 15 | 4 | 15 | 236 | 30 | 145 | 57 | 116 | 63 | 84 | 33 | 79 | 11 | 2 | 3 | 35 |
4,501 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverLayer | import torch
from torch import nn
from typing import Any, Callable, Optional, Union
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, meshgrid, prune_linear_layer
class PerceiverLayer(nn.Module):
def __init__(self, config, is_cross_attention=False, qk_channels=None, v_chann... |
class PerceiverLayer(nn.Module):
def __init__(self, config, is_cross_attention=False, qk_channels=None, v_channels=None, num_heads=1, q_dim=None, kv_dim=None, widening_factor=4, use_query_residual=True):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=N... | 4 | 0 | 20 | 2 | 19 | 1 | 1 | 0.04 | 1 | 5 | 2 | 0 | 3 | 5 | 3 | 13 | 64 | 7 | 57 | 33 | 34 | 2 | 20 | 14 | 16 | 1 | 1 | 0 | 3 |
4,502 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverMLP | import torch
from torch import nn
from ...activations import ACT2FN
class PerceiverMLP(nn.Module):
"""A Transformer-style dense module to follow attention."""
def __init__(self, config, input_size, widening_factor):
super().__init__()
self.dense1 = nn.Linear(input_size, widening_factor * input... |
class PerceiverMLP(nn.Module):
'''A Transformer-style dense module to follow attention.'''
def __init__(self, config, input_size, widening_factor):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 1 | 7 | 0 | 7 | 0 | 2 | 0.07 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 12 | 17 | 2 | 14 | 6 | 11 | 1 | 13 | 6 | 10 | 2 | 1 | 1 | 3 |
4,503 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverModel | import torch
from typing import Any, Callable, Optional, Union
from ...utils import ModelOutput, auto_docstring, logging, torch_int
@auto_docstring(custom_intro="\n The Perceiver: a scalable, fully attentional architecture.\n\n <Tip>\n\n Note that it's possible to fine-tune Perceiver on higher resolution ... | @auto_docstring(custom_intro="\n The Perceiver: a scalable, fully attentional architecture.\n\n <Tip>\n\n Note that it's possible to fine-tune Perceiver on higher resolution images than the ones it has been trained on, by\n setting `interpolate_pos_encoding` to `True` in the forward of the model. Th... | 8 | 3 | 46 | 5 | 22 | 19 | 4 | 0.82 | 1 | 8 | 3 | 0 | 5 | 6 | 5 | 6 | 238 | 30 | 114 | 41 | 90 | 94 | 55 | 24 | 49 | 14 | 2 | 3 | 20 |
4,504 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverMultimodalDecoder | from .configuration_perceiver import PerceiverConfig
from torch import nn
import torch
import numpy as np
from typing import Any, Callable, Optional, Union
class PerceiverMultimodalDecoder(PerceiverAbstractDecoder):
"""
Multimodal decoding by composing uni-modal decoders. The *modalities* argument of the const... |
class PerceiverMultimodalDecoder(PerceiverAbstractDecoder):
'''
Multimodal decoding by composing uni-modal decoders. The *modalities* argument of the constructor is a dictionary
mapping modality name to the decoder of that modality. That decoder will be used to construct queries for that
modality. Moda... | 7 | 1 | 17 | 1 | 14 | 1 | 1 | 0.41 | 1 | 7 | 2 | 0 | 4 | 7 | 4 | 37 | 108 | 12 | 68 | 37 | 46 | 28 | 33 | 21 | 27 | 3 | 4 | 2 | 7 |
4,505 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverMultimodalPostprocessor | import torch
from torch import nn
from collections.abc import Mapping
from typing import Any, Callable, Optional, Union
class PerceiverMultimodalPostprocessor(nn.Module):
"""
Multimodal postprocessing for Perceiver. Can be used to combine modality-specific postprocessors into a single
postprocessor.
A... |
class PerceiverMultimodalPostprocessor(nn.Module):
'''
Multimodal postprocessing for Perceiver. Can be used to combine modality-specific postprocessors into a single
postprocessor.
Args:
modalities (`Mapping[str, PostprocessorType]`):
Dictionary mapping modality name to postproces... | 3 | 1 | 9 | 1 | 8 | 1 | 2 | 0.65 | 1 | 5 | 0 | 0 | 2 | 2 | 2 | 12 | 32 | 4 | 17 | 8 | 12 | 11 | 12 | 6 | 9 | 3 | 1 | 2 | 4 |
4,506 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverMultimodalPreprocessor | from collections.abc import Mapping
from torch import nn
import torch
from typing import Any, Callable, Optional, Union
class PerceiverMultimodalPreprocessor(AbstractPreprocessor):
"""
Multimodal preprocessing for Perceiver Encoder.
Inputs for each modality are preprocessed, then padded with trainable pos... |
class PerceiverMultimodalPreprocessor(AbstractPreprocessor):
'''
Multimodal preprocessing for Perceiver Encoder.
Inputs for each modality are preprocessed, then padded with trainable position embeddings to have the same number
of channels.
Args:
modalities (`Mapping[str, PreprocessorType]`)... | 5 | 1 | 22 | 2 | 18 | 2 | 2 | 0.32 | 1 | 6 | 0 | 0 | 3 | 5 | 3 | 14 | 87 | 12 | 57 | 38 | 41 | 18 | 33 | 25 | 29 | 3 | 2 | 2 | 6 |
4,507 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverOneHotPreprocessor | import torch
from .configuration_perceiver import PerceiverConfig
from typing import Any, Callable, Optional, Union
class PerceiverOneHotPreprocessor(AbstractPreprocessor):
"""
One-hot preprocessor for Perceiver Encoder. Can be used to add a dummy index dimension to the input.
Args:
config ([`Perc... |
class PerceiverOneHotPreprocessor(AbstractPreprocessor):
'''
One-hot preprocessor for Perceiver Encoder. Can be used to add a dummy index dimension to the input.
Args:
config ([`PerceiverConfig`]):
Model configuration.
'''
def __init__(self, config: PerceiverConfig) -> None:
... | 5 | 1 | 4 | 0 | 3 | 1 | 1 | 0.9 | 1 | 5 | 1 | 0 | 3 | 1 | 3 | 14 | 24 | 5 | 10 | 6 | 5 | 9 | 9 | 5 | 5 | 1 | 2 | 0 | 3 |
4,508 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverOpticalFlowDecoder | import torch
from typing import Any, Callable, Optional, Union
class PerceiverOpticalFlowDecoder(PerceiverAbstractDecoder):
"""Cross-attention based optical flow decoder."""
def __init__(self, config, output_image_shape, output_num_channels=2, rescale_factor=100.0, **decoder_kwargs):
super().__init__(... |
class PerceiverOpticalFlowDecoder(PerceiverAbstractDecoder):
'''Cross-attention based optical flow decoder.'''
def __init__(self, config, output_image_shape, output_num_channels=2, rescale_factor=100.0, **decoder_kwargs):
pass
@property
def num_query_channels(self) -> int:
pass
de... | 6 | 1 | 7 | 0 | 6 | 0 | 1 | 0.08 | 1 | 8 | 2 | 0 | 4 | 4 | 4 | 37 | 33 | 5 | 26 | 18 | 14 | 2 | 19 | 11 | 14 | 2 | 4 | 1 | 5 |
4,509 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverPreTrainedModel | from ...utils import ModelOutput, auto_docstring, logging, torch_int
from .configuration_perceiver import PerceiverConfig
from torch import nn
from ...modeling_utils import PreTrainedModel
@auto_docstring
class PerceiverPreTrainedModel(PreTrainedModel):
config: PerceiverConfig
base_model_prefix = 'perceiver'
... | @auto_docstring
class PerceiverPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 22 | 0 | 19 | 3 | 10 | 0.3 | 1 | 1 | 1 | 8 | 1 | 0 | 1 | 1 | 32 | 2 | 23 | 6 | 21 | 7 | 18 | 6 | 16 | 10 | 1 | 2 | 10 |
4,510 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverProjectionDecoder | import torch
from torch import nn
from typing import Any, Callable, Optional, Union
class PerceiverProjectionDecoder(PerceiverAbstractDecoder):
"""
Baseline projection decoder (no cross-attention).
Args:
config ([`PerceiverConfig`]):
Model configuration.
"""
def __init__(self,... |
class PerceiverProjectionDecoder(PerceiverAbstractDecoder):
'''
Baseline projection decoder (no cross-attention).
Args:
config ([`PerceiverConfig`]):
Model configuration.
'''
def __init__(self, config):
pass
def decoder_query(self, inputs, modality_sizes=None, inpu... | 4 | 1 | 4 | 0 | 4 | 1 | 1 | 0.67 | 1 | 2 | 0 | 0 | 3 | 1 | 3 | 36 | 24 | 4 | 12 | 8 | 6 | 8 | 10 | 6 | 6 | 1 | 4 | 0 | 3 |
4,511 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverProjectionPostprocessor | import torch
from torch import nn
from typing import Any, Callable, Optional, Union
class PerceiverProjectionPostprocessor(nn.Module):
"""
Projection postprocessing for Perceiver. Can be used to project the channels of the decoder output to a lower
dimension.
Args:
in_channels (`int`):
... |
class PerceiverProjectionPostprocessor(nn.Module):
'''
Projection postprocessing for Perceiver. Can be used to project the channels of the decoder output to a lower
dimension.
Args:
in_channels (`int`):
Number of channels in the input.
out_channels (`int`):
Numbe... | 3 | 1 | 3 | 0 | 3 | 0 | 1 | 1.29 | 1 | 3 | 0 | 0 | 2 | 1 | 2 | 12 | 19 | 3 | 7 | 5 | 4 | 9 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
4,512 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverSelfAttention | import torch
from torch import nn
import math
from typing import Any, Callable, Optional, Union
class PerceiverSelfAttention(nn.Module):
"""Multi-headed {cross, self}-attention. Can be used both in the encoder as well as in the decoder."""
def __init__(self, config, is_cross_attention=False, qk_channels=None,... |
class PerceiverSelfAttention(nn.Module):
'''Multi-headed {cross, self}-attention. Can be used both in the encoder as well as in the decoder.'''
def __init__(self, config, is_cross_attention=False, qk_channels=None, v_channels=None, num_heads=1, q_dim=None, kv_dim=None):
pass
def transpose_for_sco... | 4 | 1 | 36 | 6 | 25 | 5 | 4 | 0.23 | 1 | 4 | 0 | 0 | 3 | 11 | 3 | 13 | 113 | 21 | 75 | 45 | 54 | 17 | 57 | 28 | 53 | 6 | 1 | 1 | 12 |
4,513 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverSelfOutput | import torch
from torch import nn
class PerceiverSelfOutput(nn.Module):
def __init__(self, config, input_channels, output_channels):
super().__init__()
self.dense = nn.Linear(input_channels, output_channels)
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
hidden_states... |
class PerceiverSelfOutput(nn.Module):
def __init__(self, config, input_channels, output_channels):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 1 | 2 | 12 | 8 | 1 | 7 | 4 | 4 | 0 | 7 | 4 | 4 | 1 | 1 | 0 | 2 |
4,514 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverTextPreprocessor | import torch
from torch import nn
from .configuration_perceiver import PerceiverConfig
from typing import Any, Callable, Optional, Union
class PerceiverTextPreprocessor(AbstractPreprocessor):
"""
Text preprocessing for Perceiver Encoder. Can be used to embed `inputs` and add positional encodings.
The dime... |
class PerceiverTextPreprocessor(AbstractPreprocessor):
'''
Text preprocessing for Perceiver Encoder. Can be used to embed `inputs` and add positional encodings.
The dimensionality of the embeddings is determined by the `d_model` attribute of the configuration.
Args:
config ([`PerceiverConfig`])... | 5 | 1 | 7 | 1 | 6 | 0 | 1 | 0.33 | 1 | 5 | 1 | 0 | 3 | 3 | 3 | 14 | 35 | 7 | 21 | 18 | 10 | 7 | 14 | 11 | 10 | 1 | 2 | 0 | 3 |
4,515 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/modeling_perceiver.py | transformers.models.perceiver.modeling_perceiver.PerceiverTrainablePositionEncoding | import torch
from torch import nn
import numpy as np
from ...utils import ModelOutput, auto_docstring, logging, torch_int
class PerceiverTrainablePositionEncoding(PerceiverAbstractPositionEncoding):
"""Trainable position encoding."""
def __init__(self, index_dims, num_channels=128):
super().__init__()... |
class PerceiverTrainablePositionEncoding(PerceiverAbstractPositionEncoding):
'''Trainable position encoding.'''
def __init__(self, index_dims, num_channels=128):
pass
@property
def num_dimensions(self) -> int:
pass
def output_size(self, *args, **kwargs) -> int:
pass
d... | 7 | 1 | 9 | 1 | 8 | 0 | 2 | 0.05 | 1 | 4 | 0 | 0 | 5 | 3 | 5 | 38 | 52 | 10 | 40 | 17 | 31 | 2 | 30 | 14 | 24 | 3 | 4 | 1 | 9 |
4,516 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/perceiver/tokenization_perceiver.py | transformers.models.perceiver.tokenization_perceiver.PerceiverTokenizer | from typing import Optional
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
class PerceiverTokenizer(PreTrainedTokenizer):
"""
Construct a Perceiver tokenizer. The Perceiver simply uses raw bytes utf-8 encoding.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of ... |
class PerceiverTokenizer(PreTrainedTokenizer):
'''
Construct a Perceiver tokenizer. The Perceiver simply uses raw bytes utf-8 encoding.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this superclass for more information regarding thos... | 12 | 7 | 13 | 1 | 9 | 3 | 2 | 0.63 | 1 | 6 | 0 | 0 | 10 | 3 | 10 | 99 | 172 | 26 | 90 | 40 | 64 | 57 | 54 | 25 | 43 | 7 | 3 | 2 | 23 |
4,517 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/persimmon/configuration_persimmon.py | transformers.models.persimmon.configuration_persimmon.PersimmonConfig | from ...modeling_rope_utils import rope_config_validation
from ...configuration_utils import PretrainedConfig
class PersimmonConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`PersimmonModel`]. It is used to instantiate an
Persimmon model according to the specif... |
class PersimmonConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`PersimmonModel`]. It is used to instantiate an
Persimmon model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield... | 2 | 1 | 53 | 1 | 50 | 2 | 2 | 1.64 | 1 | 1 | 0 | 0 | 1 | 16 | 1 | 1 | 149 | 9 | 53 | 43 | 28 | 87 | 24 | 20 | 22 | 2 | 1 | 1 | 2 |
4,518 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/persimmon/modeling_persimmon.py | transformers.models.persimmon.modeling_persimmon.PersimmonAttention | from ...utils.deprecation import deprecate_kwarg
from typing import Callable, Optional, Union
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_persimmon import PersimmonConfig
from ...modeling_flash_attention_utils import FlashAttentionKwargs
import torch
from torch import nn
f... |
class PersimmonAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: PersimmonConfig, layer_idx: Optional[int]=None):
pass
def _split_heads(self, fused_qkv: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
'''... | 5 | 2 | 45 | 7 | 32 | 6 | 4 | 0.21 | 1 | 8 | 3 | 0 | 3 | 15 | 3 | 13 | 139 | 25 | 96 | 40 | 82 | 20 | 61 | 30 | 57 | 6 | 1 | 1 | 11 |
4,519 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/persimmon/modeling_persimmon.py | transformers.models.persimmon.modeling_persimmon.PersimmonDecoderLayer | import torch
from ...processing_utils import Unpack
from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
from torch import nn
from ...utils.deprecation import deprecate_kwarg
from .configuration_persimmon import PersimmonConfig
from ...modeling_flash... |
class PersimmonDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: PersimmonConfig, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, posi... | 4 | 1 | 39 | 5 | 22 | 13 | 2 | 0.59 | 1 | 7 | 3 | 0 | 2 | 6 | 2 | 12 | 79 | 10 | 44 | 22 | 31 | 26 | 25 | 12 | 22 | 3 | 1 | 1 | 4 |
4,520 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/persimmon/modeling_persimmon.py | transformers.models.persimmon.modeling_persimmon.PersimmonForCausalLM | from typing import Callable, Optional, Union
from ...utils import auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging
from ...cache_utils import Cache, DynamicCache
import torch
from torch import nn
from ...generation import GenerationMixin
from ...modeling_outputs import BaseModelOutputWithPast, Ca... |
class PersimmonForCausalLM(PersimmonPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, pa... | 5 | 1 | 14 | 2 | 9 | 4 | 2 | 0.45 | 2 | 7 | 2 | 0 | 8 | 3 | 8 | 9 | 134 | 22 | 77 | 35 | 50 | 35 | 35 | 19 | 26 | 8 | 2 | 1 | 15 |
4,521 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/persimmon/modeling_persimmon.py | transformers.models.persimmon.modeling_persimmon.PersimmonForSequenceClassification | from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class PersimmonForSequenceClassification(GenericForSequenceClassification, PersimmonPreTrainedModel):
... |
class PersimmonForSequenceClassification(GenericForSequenceClassification, PersimmonPreTrainedModel):
pass | 1 | 0 | 21 | 2 | 17 | 2 | 3 | 0.11 | 1 | 7 | 3 | 0 | 4 | 3 | 4 | 5 | 90 | 11 | 71 | 31 | 53 | 8 | 36 | 18 | 31 | 9 | 2 | 1 | 12 |
4,522 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/persimmon/modeling_persimmon.py | transformers.models.persimmon.modeling_persimmon.PersimmonForTokenClassification | from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class PersimmonForTokenClassification(GenericForTokenClassification, PersimmonPreTrainedModel):
... |
class PersimmonForTokenClassification(GenericForTokenClassification, PersimmonPreTrainedModel):
pass | 1 | 0 | 17 | 1 | 14 | 2 | 3 | 0.11 | 1 | 5 | 2 | 0 | 4 | 4 | 4 | 5 | 79 | 8 | 64 | 28 | 41 | 7 | 29 | 15 | 24 | 5 | 2 | 1 | 10 |
4,523 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/persimmon/modeling_persimmon.py | transformers.models.persimmon.modeling_persimmon.PersimmonMLP | from torch import nn
from ...activations import ACT2FN
class PersimmonMLP(nn.Module):
def __init__(self, config):
super().__init__()
self.dense_h_to_4h = nn.Linear(config.hidden_size, config.intermediate_size)
self.dense_4h_to_h = nn.Linear(config.intermediate_size, config.hidden_size)
... |
class PersimmonMLP(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
4,524 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/persimmon/modeling_persimmon.py | transformers.models.persimmon.modeling_persimmon.PersimmonModel | from torch import nn
from ...utils import auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging
import torch
from typing import Callable, Optional, Union
from ...modeling_attn_mask_utils import AttentionMaskConverter
from ...modeling_flash_attention_utils import FlashAttentionKwargs
from .configuratio... | @auto_docstring
class PersimmonModel(PersimmonPreTrainedModel):
'''
Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`PersimmonDecoderLayer`]
Args:
config: PersimmonConfig
'''
def __init__(self, config: PersimmonConfig):
pass
@can_return_tupl... | 9 | 2 | 44 | 5 | 33 | 6 | 7 | 0.22 | 1 | 15 | 8 | 0 | 5 | 7 | 6 | 7 | 279 | 37 | 200 | 66 | 163 | 44 | 102 | 36 | 95 | 26 | 2 | 2 | 42 |
4,525 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/persimmon/modeling_persimmon.py | transformers.models.persimmon.modeling_persimmon.PersimmonPreTrainedModel | from .configuration_persimmon import PersimmonConfig
from ...utils import auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from torch import nn
@auto_docstring
class PersimmonPreTrainedModel(PreTrainedModel):
config: Pers... | @auto_docstring
class PersimmonPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 10 | 0 | 10 | 0 | 5 | 0 | 1 | 0 | 0 | 4 | 1 | 0 | 1 | 1 | 20 | 1 | 19 | 11 | 17 | 0 | 18 | 11 | 16 | 5 | 1 | 2 | 5 |
4,526 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/persimmon/modeling_persimmon.py | transformers.models.persimmon.modeling_persimmon.PersimmonRotaryEmbedding | from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
from torch import nn
import torch
from .configuration_persimmon import PersimmonConfig
class PersimmonRotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, config: PersimmonConfig, device=None):
super().__init_... |
class PersimmonRotaryEmbedding(nn.Module):
def __init__(self, config: PersimmonConfig, device=None):
pass
@torch.no_grad()
@dynamic_rope_update
def forward(self, x, position_ids):
pass | 5 | 0 | 18 | 2 | 13 | 5 | 3 | 0.35 | 1 | 4 | 1 | 0 | 3 | 7 | 3 | 13 | 59 | 8 | 40 | 21 | 35 | 14 | 38 | 20 | 34 | 3 | 1 | 1 | 8 |
4,527 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi/configuration_phi.py | transformers.models.phi.configuration_phi.PhiConfig | from ...configuration_utils import PretrainedConfig
from ...modeling_rope_utils import rope_config_validation
class PhiConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`PhiModel`]. It is used to instantiate an Phi
model according to the specified arguments, def... |
class PhiConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`PhiModel`]. It is used to instantiate an Phi
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configu... | 2 | 1 | 59 | 3 | 54 | 2 | 3 | 1.63 | 1 | 1 | 0 | 0 | 1 | 18 | 1 | 1 | 183 | 12 | 65 | 47 | 39 | 106 | 29 | 23 | 27 | 3 | 1 | 1 | 3 |
4,528 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi/modeling_phi.py | transformers.models.phi.modeling_phi.PhiAttention | from .configuration_phi import PhiConfig
import torch.nn as nn
from typing import Callable, Optional, Union
import torch
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache
class PhiAttention(nn.Module):
... |
class PhiAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: PhiConfig, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, position_... | 4 | 1 | 44 | 4 | 38 | 2 | 4 | 0.06 | 1 | 5 | 2 | 0 | 2 | 15 | 2 | 12 | 92 | 10 | 77 | 37 | 66 | 5 | 46 | 29 | 43 | 6 | 1 | 2 | 8 |
4,529 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi/modeling_phi.py | transformers.models.phi.modeling_phi.PhiDecoderLayer | from typing import Callable, Optional, Union
from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
import torch
from ...cache_utils import Cache, DynamicCache
from .configuration_phi import PhiConfig
import torch.nn as nn
from ...utils.deprecation imp... |
class PhiDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: PhiConfig, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, position_ids: Op... | 4 | 0 | 22 | 3 | 19 | 1 | 2 | 0.05 | 1 | 7 | 3 | 0 | 2 | 4 | 2 | 12 | 46 | 6 | 39 | 22 | 25 | 2 | 18 | 11 | 15 | 2 | 1 | 1 | 3 |
4,530 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi/modeling_phi.py | transformers.models.phi.modeling_phi.PhiForCausalLM | from typing import Callable, Optional, Union
import torch
from ...processing_utils import Unpack
from ...generation import GenerationMixin
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging
from ...cache_utils import Cache, DynamicCache
from ...modeling_outputs import BaseModelOutputWith... | @auto_docstring
class PhiForCausalLM(PhiPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None,... | 6 | 1 | 14 | 2 | 9 | 4 | 2 | 0.38 | 2 | 9 | 4 | 0 | 8 | 3 | 8 | 9 | 123 | 21 | 74 | 36 | 47 | 28 | 36 | 20 | 27 | 8 | 2 | 1 | 15 |
4,531 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi/modeling_phi.py | transformers.models.phi.modeling_phi.PhiForSequenceClassification | from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class PhiForSequenceClassification(GenericForSequenceClassification, PhiPreTrainedModel):
pass |
class PhiForSequenceClassification(GenericForSequenceClassification, PhiPreTrainedModel):
pass | 1 | 0 | 21 | 2 | 17 | 2 | 3 | 0.11 | 1 | 7 | 3 | 0 | 4 | 3 | 4 | 5 | 90 | 11 | 71 | 31 | 53 | 8 | 36 | 18 | 31 | 9 | 2 | 1 | 12 |
4,532 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi/modeling_phi.py | transformers.models.phi.modeling_phi.PhiForTokenClassification | from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class PhiForTokenClassification(GenericForTokenClassification, PhiPreTrainedModel):
pass |
class PhiForTokenClassification(GenericForTokenClassification, PhiPreTrainedModel):
pass | 1 | 0 | 17 | 1 | 14 | 2 | 3 | 0.11 | 1 | 5 | 2 | 0 | 4 | 4 | 4 | 5 | 79 | 8 | 64 | 28 | 41 | 7 | 29 | 15 | 24 | 5 | 2 | 1 | 10 |
4,533 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi/modeling_phi.py | transformers.models.phi.modeling_phi.PhiMLP | import torch
import torch.nn as nn
from ...activations import ACT2FN
class PhiMLP(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 PhiMLP(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 |
4,534 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi/modeling_phi.py | transformers.models.phi.modeling_phi.PhiModel | import torch
from ...cache_utils import Cache, DynamicCache
from .configuration_phi import PhiConfig
from ...processing_utils import Unpack
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging
import torch.nn as nn
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWith... | @auto_docstring
class PhiModel(PhiPreTrainedModel):
def __init__(self, config: PhiConfig):
pass
@check_model_inputs
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_... | 6 | 0 | 41 | 5 | 31 | 6 | 6 | 0.23 | 1 | 15 | 9 | 0 | 5 | 8 | 6 | 7 | 259 | 34 | 186 | 66 | 148 | 42 | 91 | 35 | 84 | 21 | 2 | 2 | 37 |
4,535 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi/modeling_phi.py | transformers.models.phi.modeling_phi.PhiPreTrainedModel | from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, logging
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_phi import PhiConfig
@auto_docstring
class PhiPreTrainedModel(PreTrainedModel):
config: PhiConfig
base_model_prefix = 'model'
support... | @auto_docstring
class PhiPreTrainedModel(PreTrainedModel):
pass | 2 | 0 | 10 | 0 | 10 | 0 | 5 | 0 | 1 | 0 | 0 | 4 | 1 | 0 | 1 | 1 | 24 | 1 | 23 | 15 | 21 | 0 | 22 | 15 | 20 | 5 | 1 | 2 | 5 |
4,536 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi/modeling_phi.py | transformers.models.phi.modeling_phi.PhiRotaryEmbedding | import torch
import torch.nn as nn
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
from .configuration_phi import PhiConfig
class PhiRotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, config: PhiConfig, device=None):
super().__init__()
if hasattr(... |
class PhiRotaryEmbedding(nn.Module):
def __init__(self, config: PhiConfig, device=None):
pass
@torch.no_grad()
@dynamic_rope_update
def forward(self, x, position_ids):
pass | 5 | 0 | 18 | 2 | 13 | 5 | 3 | 0.35 | 1 | 4 | 1 | 0 | 3 | 7 | 3 | 13 | 59 | 8 | 40 | 21 | 35 | 14 | 38 | 20 | 34 | 3 | 1 | 1 | 8 |
4,537 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi/modular_phi.py | transformers.models.phi.modular_phi.PhiAttention | from ...utils.deprecation import deprecate_kwarg
import torch
from typing import Callable, Optional
from ..llama.modeling_llama import LlamaAttention, LlamaForCausalLM, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaModel, LlamaRotaryEmbedding, apply_rotary_pos_emb, eager_attention_forward
from ...mo... |
class PhiAttention(LlamaAttention):
def __init__(self, config: PhiConfig, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, position_embeddings: tuple[torch.Tensor, torch.Tensor], attention_mask: Opti... | 4 | 0 | 41 | 4 | 35 | 2 | 4 | 0.06 | 1 | 5 | 2 | 0 | 2 | 10 | 2 | 14 | 84 | 9 | 71 | 31 | 60 | 4 | 40 | 22 | 37 | 6 | 2 | 2 | 8 |
4,538 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi/modular_phi.py | transformers.models.phi.modular_phi.PhiDecoderLayer | from typing import Callable, Optional
import torch.nn as nn
from .configuration_phi import PhiConfig
from ...utils.deprecation import deprecate_kwarg
from ...modeling_layers import GradientCheckpointingLayer
from ...cache_utils import Cache, DynamicCache
import torch
class PhiDecoderLayer(GradientCheckpointingLayer):
... |
class PhiDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: PhiConfig, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, position_ids: Op... | 4 | 0 | 22 | 3 | 19 | 1 | 2 | 0.05 | 1 | 7 | 3 | 0 | 2 | 4 | 2 | 12 | 46 | 6 | 39 | 22 | 25 | 2 | 18 | 11 | 15 | 2 | 1 | 1 | 3 |
4,539 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi/modular_phi.py | transformers.models.phi.modular_phi.PhiForCausalLM | from ..llama.modeling_llama import LlamaAttention, LlamaForCausalLM, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaModel, LlamaRotaryEmbedding, apply_rotary_pos_emb, eager_attention_forward
import torch.nn as nn
class PhiForCausalLM(LlamaForCausalLM):
def __init__(self, config):
super(... |
class PhiForCausalLM(LlamaForCausalLM):
def __init__(self, config):
pass | 2 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 10 | 4 | 0 | 4 | 3 | 2 | 0 | 4 | 3 | 2 | 1 | 3 | 0 | 1 |
4,540 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi/modular_phi.py | transformers.models.phi.modular_phi.PhiForSequenceClassification | from ..llama.modeling_llama import LlamaAttention, LlamaForCausalLM, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaModel, LlamaRotaryEmbedding, apply_rotary_pos_emb, eager_attention_forward
class PhiForSequenceClassification(LlamaForSequenceClassification):
pass |
class PhiForSequenceClassification(LlamaForSequenceClassification):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
4,541 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi/modular_phi.py | transformers.models.phi.modular_phi.PhiForTokenClassification | from ..llama.modeling_llama import LlamaAttention, LlamaForCausalLM, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaModel, LlamaRotaryEmbedding, apply_rotary_pos_emb, eager_attention_forward
class PhiForTokenClassification(LlamaForTokenClassification):
pass |
class PhiForTokenClassification(LlamaForTokenClassification):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
4,542 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi/modular_phi.py | transformers.models.phi.modular_phi.PhiMLP | from ..clip.modeling_clip import CLIPMLP
class PhiMLP(CLIPMLP):
pass |
class PhiMLP(CLIPMLP):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
4,543 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi/modular_phi.py | transformers.models.phi.modular_phi.PhiModel | from ...processing_utils import Unpack
from ...cache_utils import Cache, DynamicCache
import torch
from ...utils import TransformersKwargs, logging
from .configuration_phi import PhiConfig
from typing import Callable, Optional
from ..llama.modeling_llama import LlamaAttention, LlamaForCausalLM, LlamaForSequenceClassifi... |
class PhiModel(LlamaModel):
def __init__(self, config: PhiConfig):
pass
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[Cache]=None, inputs_embeds: Optional[torch.FloatT... | 3 | 0 | 57 | 9 | 47 | 3 | 11 | 0.05 | 1 | 11 | 6 | 0 | 2 | 3 | 2 | 9 | 116 | 18 | 95 | 28 | 79 | 5 | 46 | 15 | 43 | 21 | 3 | 2 | 22 |
4,544 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi3/configuration_phi3.py | transformers.models.phi3.configuration_phi3.Phi3Config | from ...configuration_utils import PretrainedConfig
class Phi3Config(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Phi3Model`]. It is used to instantiate a Phi-3
model according to the specified arguments, defining the model architecture. Instantiating a configura... |
class Phi3Config(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Phi3Model`]. It is used to instantiate a Phi-3
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar conf... | 4 | 3 | 36 | 2 | 32 | 2 | 4 | 0.81 | 1 | 6 | 0 | 0 | 3 | 18 | 3 | 3 | 203 | 17 | 105 | 54 | 76 | 85 | 52 | 29 | 48 | 8 | 1 | 1 | 13 |
4,545 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi3/modeling_phi3.py | transformers.models.phi3.modeling_phi3.Phi3Attention | from ...processing_utils import Unpack
from ...modeling_flash_attention_utils import FlashAttentionKwargs
import torch
from .configuration_phi3 import Phi3Config
from ...cache_utils import Cache, DynamicCache
from ...utils.deprecation import deprecate_kwarg
from typing import Callable, Optional, Union
from ...modeling_... |
class Phi3Attention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: Phi3Config, 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.... | 4 | 1 | 35 | 4 | 30 | 1 | 3 | 0.03 | 1 | 6 | 3 | 0 | 2 | 10 | 2 | 12 | 73 | 10 | 61 | 33 | 50 | 2 | 39 | 25 | 36 | 5 | 1 | 2 | 6 |
4,546 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi3/modeling_phi3.py | transformers.models.phi3.modeling_phi3.Phi3DecoderLayer | from torch import nn
from typing import Callable, Optional, Union
from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
import torch
from ...utils.deprecation import deprecate_kwarg
from ...processing_utils import Unpack
from .configuration_phi3 impor... |
class Phi3DecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Phi3Config, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, position_ids: ... | 4 | 0 | 36 | 3 | 22 | 13 | 2 | 0.58 | 1 | 10 | 6 | 0 | 2 | 8 | 2 | 12 | 74 | 6 | 45 | 25 | 31 | 26 | 24 | 14 | 21 | 2 | 1 | 1 | 3 |
4,547 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi3/modeling_phi3.py | transformers.models.phi3.modeling_phi3.Phi3ForCausalLM | import torch
from torch import nn
from ...generation import GenerationMixin
from ...cache_utils import Cache, DynamicCache
from ...processing_utils import Unpack
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from... | @auto_docstring
class Phi3ForCausalLM(Phi3PreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=Non... | 7 | 1 | 16 | 2 | 11 | 4 | 2 | 0.3 | 2 | 9 | 4 | 0 | 9 | 3 | 9 | 10 | 162 | 24 | 106 | 50 | 67 | 32 | 43 | 23 | 33 | 8 | 2 | 2 | 18 |
4,548 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi3/modeling_phi3.py | transformers.models.phi3.modeling_phi3.Phi3ForSequenceClassification | from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class Phi3ForSequenceClassification(GenericForSequenceClassification, Phi3PreTrainedModel):
pass |
class Phi3ForSequenceClassification(GenericForSequenceClassification, Phi3PreTrainedModel):
pass | 1 | 0 | 21 | 2 | 17 | 2 | 3 | 0.11 | 1 | 7 | 3 | 0 | 4 | 3 | 4 | 5 | 90 | 11 | 71 | 31 | 53 | 8 | 36 | 18 | 31 | 9 | 2 | 1 | 12 |
4,549 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi3/modeling_phi3.py | transformers.models.phi3.modeling_phi3.Phi3ForTokenClassification | from ...modeling_layers import GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class Phi3ForTokenClassification(GenericForTokenClassification, Phi3PreTrainedModel):
pass |
class Phi3ForTokenClassification(GenericForTokenClassification, Phi3PreTrainedModel):
pass | 1 | 0 | 17 | 1 | 14 | 2 | 3 | 0.11 | 1 | 5 | 2 | 0 | 4 | 4 | 4 | 5 | 79 | 8 | 64 | 28 | 41 | 7 | 29 | 15 | 24 | 5 | 2 | 1 | 10 |
4,550 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi3/modeling_phi3.py | transformers.models.phi3.modeling_phi3.Phi3MLP | from torch import nn
from ...activations import ACT2FN
import torch
class Phi3MLP(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.gate_up_proj = nn.Linear(config.hidden_size, 2 * config.intermediate_size, bias=False)
self.down_proj = nn.Linear(c... |
class Phi3MLP(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor:
pass | 3 | 0 | 7 | 2 | 6 | 0 | 1 | 0 | 1 | 1 | 0 | 1 | 2 | 4 | 2 | 12 | 16 | 4 | 12 | 9 | 9 | 0 | 12 | 9 | 9 | 1 | 1 | 0 | 2 |
4,551 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi3/modeling_phi3.py | transformers.models.phi3.modeling_phi3.Phi3Model | from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
from transformers.utils.generic import check_model_inputs
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from ...masking_utils import create_causal_mask, create_sliding_window_causal_mask
import torch
from typing ... | @auto_docstring
class Phi3Model(Phi3PreTrainedModel):
def __init__(self, config: Phi3Config):
pass
@check_model_inputs
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_k... | 6 | 0 | 45 | 4 | 34 | 7 | 7 | 0.22 | 1 | 17 | 11 | 0 | 5 | 8 | 6 | 7 | 286 | 33 | 208 | 71 | 169 | 46 | 99 | 38 | 92 | 21 | 2 | 3 | 41 |
4,552 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi3/modeling_phi3.py | transformers.models.phi3.modeling_phi3.Phi3PreTrainedModel | from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
from .configuration_phi3 import Phi3Config
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
@auto_docstring
class Phi3PreTrainedModel(PreTrainedModel):
config: Phi3Config
base_model_prefix = 'model'
supports_gra... | @auto_docstring
class Phi3PreTrainedModel(PreTrainedModel):
pass | 2 | 0 | 10 | 0 | 10 | 0 | 5 | 0 | 1 | 0 | 0 | 4 | 1 | 0 | 1 | 1 | 25 | 1 | 24 | 16 | 22 | 0 | 23 | 16 | 21 | 5 | 1 | 2 | 5 |
4,553 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi3/modeling_phi3.py | transformers.models.phi3.modeling_phi3.Phi3RMSNorm | from torch import nn
from ...integrations import use_kernel_forward_from_hub
import torch
@use_kernel_forward_from_hub('RMSNorm')
class Phi3RMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
"""
Phi3RMSNorm is equivalent to T5LayerNorm
"""
super().__init__()
se... | @use_kernel_forward_from_hub('RMSNorm')
class Phi3RMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
'''
Phi3RMSNorm is equivalent to T5LayerNorm
'''
pass
def forward(self, hidden_states):
pass
def extra_repr(self):
pass | 5 | 1 | 5 | 0 | 4 | 1 | 1 | 0.23 | 1 | 2 | 0 | 0 | 3 | 2 | 3 | 13 | 18 | 2 | 13 | 8 | 9 | 3 | 13 | 8 | 9 | 1 | 1 | 0 | 3 |
4,554 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi3/modeling_phi3.py | transformers.models.phi3.modeling_phi3.Phi3RotaryEmbedding | from torch import nn
from .configuration_phi3 import Phi3Config
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
import torch
class Phi3RotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, config: Phi3Config, device=None):
super().__init__()
if hasat... |
class Phi3RotaryEmbedding(nn.Module):
def __init__(self, config: Phi3Config, device=None):
pass
@torch.no_grad()
@dynamic_rope_update
def forward(self, x, position_ids):
pass | 5 | 0 | 19 | 2 | 14 | 4 | 3 | 0.3 | 1 | 4 | 1 | 0 | 4 | 8 | 4 | 14 | 80 | 9 | 57 | 25 | 51 | 17 | 50 | 24 | 45 | 4 | 1 | 2 | 13 |
4,555 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi3/modular_phi3.py | transformers.models.phi3.modular_phi3.Phi3Attention | from torch import nn
import torch
from ...cache_utils import Cache
from ...processing_utils import Unpack
from ..mistral.modeling_mistral import MistralDecoderLayer, MistralForCausalLM, MistralForSequenceClassification, MistralForTokenClassification, MistralPreTrainedModel, eager_attention_forward, rotate_half
from ...... |
class Phi3Attention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: Phi3Config, 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.... | 4 | 1 | 35 | 4 | 30 | 1 | 3 | 0.03 | 1 | 6 | 3 | 0 | 2 | 10 | 2 | 12 | 73 | 10 | 61 | 33 | 50 | 2 | 39 | 25 | 36 | 5 | 1 | 2 | 6 |
4,556 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi3/modular_phi3.py | transformers.models.phi3.modular_phi3.Phi3DecoderLayer | from ...processing_utils import Unpack
from ...cache_utils import Cache
from torch import nn
from ...modeling_flash_attention_utils import FlashAttentionKwargs
from .configuration_phi3 import Phi3Config
from typing import Callable, Optional
from ..mistral.modeling_mistral import MistralDecoderLayer, MistralForCausalLM,... |
class Phi3DecoderLayer(MistralDecoderLayer):
def __init__(self, config: Phi3Config, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, position_ids: Optiona... | 4 | 0 | 35 | 3 | 21 | 13 | 2 | 0.62 | 1 | 9 | 5 | 0 | 2 | 5 | 2 | 14 | 71 | 6 | 42 | 22 | 28 | 26 | 21 | 11 | 18 | 2 | 2 | 1 | 3 |
4,557 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi3/modular_phi3.py | transformers.models.phi3.modular_phi3.Phi3ForCausalLM | from ..mistral.modeling_mistral import MistralDecoderLayer, MistralForCausalLM, MistralForSequenceClassification, MistralForTokenClassification, MistralPreTrainedModel, eager_attention_forward, rotate_half
from ...generation import GenerationMixin
class Phi3ForCausalLM(MistralForCausalLM):
def prepare_inputs_for_... |
class Phi3ForCausalLM(MistralForCausalLM):
def prepare_inputs_for_generation(self, input_ids, past_key_values=None, attention_mask=None, inputs_embeds=None, cache_position=None, position_ids=None, use_cache=True, logits_to_keep=None, **kwargs):
pass | 2 | 0 | 38 | 2 | 32 | 4 | 3 | 0.12 | 2 | 0 | 0 | 0 | 1 | 0 | 1 | 10 | 39 | 2 | 33 | 15 | 20 | 4 | 8 | 4 | 6 | 3 | 3 | 2 | 3 |
4,558 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi3/modular_phi3.py | transformers.models.phi3.modular_phi3.Phi3ForSequenceClassification | from ..mistral.modeling_mistral import MistralDecoderLayer, MistralForCausalLM, MistralForSequenceClassification, MistralForTokenClassification, MistralPreTrainedModel, eager_attention_forward, rotate_half
class Phi3ForSequenceClassification(MistralForSequenceClassification):
pass |
class Phi3ForSequenceClassification(MistralForSequenceClassification):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
4,559 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi3/modular_phi3.py | transformers.models.phi3.modular_phi3.Phi3ForTokenClassification | from ..mistral.modeling_mistral import MistralDecoderLayer, MistralForCausalLM, MistralForSequenceClassification, MistralForTokenClassification, MistralPreTrainedModel, eager_attention_forward, rotate_half
class Phi3ForTokenClassification(MistralForTokenClassification):
pass |
class Phi3ForTokenClassification(MistralForTokenClassification):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
4,560 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi3/modular_phi3.py | transformers.models.phi3.modular_phi3.Phi3MLP | import torch
from torch import nn
from ...activations import ACT2FN
class Phi3MLP(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.gate_up_proj = nn.Linear(config.hidden_size, 2 * config.intermediate_size, bias=False)
self.down_proj = nn.Linear(c... |
class Phi3MLP(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.FloatTensor) -> torch.FloatTensor:
pass | 3 | 0 | 7 | 2 | 6 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 16 | 4 | 12 | 9 | 9 | 0 | 12 | 9 | 9 | 1 | 1 | 0 | 2 |
4,561 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phi3/modular_phi3.py | transformers.models.phi3.modular_phi3.Phi3PreTrainedModel | from ..mistral.modeling_mistral import MistralDecoderLayer, MistralForCausalLM, MistralForSequenceClassification, MistralForTokenClassification, MistralPreTrainedModel, eager_attention_forward, rotate_half
class Phi3PreTrainedModel(MistralPreTrainedModel):
_version = '0.0.5' |
class Phi3PreTrainedModel(MistralPreTrainedModel):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 2 | 0 | 0 |
4,562 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phimoe/configuration_phimoe.py | transformers.models.phimoe.configuration_phimoe.PhimoeConfig | from ...configuration_utils import PretrainedConfig
from ...modeling_rope_utils import rope_config_validation
class PhimoeConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`PhimoeModel`]. It is used to instantiate a Phi-moe
model according to the specified argum... |
class PhimoeConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`PhimoeModel`]. It is used to instantiate a Phi-moe
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a simila... | 2 | 1 | 85 | 5 | 79 | 1 | 7 | 1.02 | 1 | 5 | 0 | 0 | 1 | 24 | 1 | 1 | 175 | 9 | 82 | 60 | 50 | 84 | 42 | 30 | 40 | 7 | 1 | 2 | 7 |
4,563 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phimoe/modeling_phimoe.py | transformers.models.phimoe.modeling_phimoe.MultiplierProcessor | import torch
class MultiplierProcessor(torch.autograd.Function):
@staticmethod
def forward(ctx, scores: torch.Tensor, multiplier: torch.Tensor, selected_experts: torch.Tensor, masked_gates: torch.Tensor, mask_for_one: torch.Tensor):
"""
Forward pass for the custom autograd function.
A... |
class MultiplierProcessor(torch.autograd.Function):
@staticmethod
def forward(ctx, scores: torch.Tensor, multiplier: torch.Tensor, selected_experts: torch.Tensor, masked_gates: torch.Tensor, mask_for_one: torch.Tensor):
'''
Forward pass for the custom autograd function.
Args:
... | 5 | 2 | 28 | 4 | 15 | 10 | 1 | 0.63 | 1 | 1 | 0 | 0 | 0 | 0 | 2 | 32 | 60 | 8 | 32 | 17 | 17 | 20 | 10 | 5 | 7 | 1 | 5 | 0 | 2 |
4,564 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phimoe/modeling_phimoe.py | transformers.models.phimoe.modeling_phimoe.PhimoeAttention | import math
from ...utils.deprecation import deprecate_kwarg
from torch import nn
import torch
from typing import Optional, Union
from .configuration_phimoe import PhimoeConfig
from ...cache_utils import Cache, DynamicCache, StaticCache
class PhimoeAttention(nn.Module):
"""
Multi-headed attention from 'Attenti... |
class PhimoeAttention(nn.Module):
'''
Multi-headed attention from 'Attention Is All You Need' paper. Modified to use sliding window attention: Longformer
and "Generating Long Sequences with Sparse Transformers".
'''
def __init__(self, config: PhimoeConfig, layer_idx: Optional[int]=None):
p... | 5 | 1 | 32 | 5 | 26 | 1 | 3 | 0.1 | 1 | 7 | 2 | 2 | 3 | 15 | 3 | 13 | 103 | 19 | 78 | 38 | 64 | 8 | 54 | 28 | 50 | 5 | 1 | 1 | 9 |
4,565 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phimoe/modeling_phimoe.py | transformers.models.phimoe.modeling_phimoe.PhimoeBlockSparseTop2MLP | from ...activations import ACT2FN
from torch import nn
from .configuration_phimoe import PhimoeConfig
class PhimoeBlockSparseTop2MLP(nn.Module):
def __init__(self, config: PhimoeConfig):
super().__init__()
self.ffn_dim = config.intermediate_size
self.hidden_dim = config.hidden_size
... |
class PhimoeBlockSparseTop2MLP(nn.Module):
def __init__(self, config: PhimoeConfig):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 7 | 1 | 6 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 2 | 6 | 2 | 12 | 16 | 3 | 13 | 10 | 10 | 0 | 13 | 10 | 10 | 1 | 1 | 0 | 2 |
4,566 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phimoe/modeling_phimoe.py | transformers.models.phimoe.modeling_phimoe.PhimoeDecoderLayer | from .configuration_phimoe import PhimoeConfig
from ...utils.deprecation import deprecate_kwarg
from torch import nn
from typing import Optional, Union
from ...cache_utils import Cache, DynamicCache, StaticCache
from ...modeling_layers import GenericForSequenceClassification, GradientCheckpointingLayer
import torch
cl... |
class PhimoeDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: PhimoeConfig, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, position_i... | 4 | 1 | 41 | 6 | 24 | 12 | 3 | 0.48 | 1 | 6 | 2 | 0 | 2 | 5 | 2 | 12 | 83 | 12 | 48 | 24 | 33 | 23 | 25 | 12 | 22 | 4 | 1 | 1 | 5 |
4,567 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phimoe/modeling_phimoe.py | transformers.models.phimoe.modeling_phimoe.PhimoeFlashAttention2 | import torch
from typing import Optional, Union
from ...cache_utils import Cache, DynamicCache, StaticCache
from ...utils.deprecation import deprecate_kwarg
class PhimoeFlashAttention2(PhimoeAttention):
"""
Phimoe flash attention module. This module inherits from `PhimoeAttention` as the weights of the module ... |
class PhimoeFlashAttention2(PhimoeAttention):
'''
Phimoe flash attention module. This module inherits from `PhimoeAttention` as the weights of the module stays
untouched. The only required change would be on the forward pass where it needs to correctly call the public API of
flash attention and deal wi... | 3 | 1 | 84 | 14 | 64 | 7 | 8 | 0.18 | 1 | 3 | 1 | 0 | 1 | 1 | 1 | 14 | 91 | 15 | 65 | 25 | 53 | 12 | 39 | 14 | 37 | 8 | 2 | 2 | 8 |
4,568 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phimoe/modeling_phimoe.py | transformers.models.phimoe.modeling_phimoe.PhimoeForCausalLM | from ...cache_utils import Cache, DynamicCache, StaticCache
from ...generation import GenerationMixin
from typing import Optional, Union
from ...utils import auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging
from ...modeling_outputs import MoeCausalLMOutputWithPast, MoeModelOutputWithPast
import t... |
class PhimoeForCausalLM(PhimoePreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key... | 6 | 1 | 19 | 1 | 14 | 4 | 3 | 0.3 | 2 | 7 | 2 | 0 | 9 | 6 | 9 | 10 | 194 | 19 | 135 | 54 | 95 | 41 | 55 | 26 | 45 | 14 | 2 | 2 | 24 |
4,569 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phimoe/modeling_phimoe.py | transformers.models.phimoe.modeling_phimoe.PhimoeForSequenceClassification | from ...modeling_layers import GenericForSequenceClassification, GradientCheckpointingLayer
class PhimoeForSequenceClassification(GenericForSequenceClassification, PhimoePreTrainedModel):
... |
class PhimoeForSequenceClassification(GenericForSequenceClassification, PhimoePreTrainedModel):
pass | 1 | 0 | 21 | 2 | 17 | 2 | 3 | 0.11 | 1 | 7 | 3 | 0 | 4 | 3 | 4 | 5 | 90 | 11 | 71 | 31 | 53 | 8 | 36 | 18 | 31 | 9 | 2 | 1 | 12 |
4,570 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phimoe/modeling_phimoe.py | transformers.models.phimoe.modeling_phimoe.PhimoeModel | from torch import nn
from .configuration_phimoe import PhimoeConfig
from ...modeling_attn_mask_utils import AttentionMaskConverter, _prepare_4d_causal_attention_mask
from ...modeling_outputs import MoeCausalLMOutputWithPast, MoeModelOutputWithPast
from ...cache_utils import Cache, DynamicCache, StaticCache
from ...util... | @auto_docstring
class PhimoeModel(PhimoePreTrainedModel):
'''
Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`PhimoeDecoderLayer`]
Args:
config: PhimoeConfig
'''
def __init__(self, config: PhimoeConfig):
pass
@can_return_tuple
@auto_doc... | 9 | 2 | 51 | 5 | 40 | 7 | 8 | 0.2 | 1 | 16 | 9 | 0 | 5 | 9 | 6 | 7 | 323 | 35 | 241 | 75 | 202 | 49 | 117 | 42 | 110 | 29 | 2 | 3 | 49 |
4,571 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phimoe/modeling_phimoe.py | transformers.models.phimoe.modeling_phimoe.PhimoePreTrainedModel | from ...utils import auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging
from ...modeling_utils import PreTrainedModel
from .configuration_phimoe import PhimoeConfig
from torch import nn
@auto_docstring
class PhimoePreTrainedModel(PreTrainedModel):
config: PhimoeConfig
base_model_prefix = '... | @auto_docstring
class PhimoePreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 10 | 0 | 10 | 0 | 5 | 0.05 | 1 | 0 | 0 | 3 | 1 | 0 | 1 | 1 | 22 | 1 | 21 | 13 | 19 | 1 | 20 | 13 | 18 | 5 | 1 | 2 | 5 |
4,572 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phimoe/modeling_phimoe.py | transformers.models.phimoe.modeling_phimoe.PhimoeRotaryEmbedding | from torch import nn
from .configuration_phimoe import PhimoeConfig
import torch
from typing import Optional, Union
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS
class PhimoeRotaryEmbedding(nn.Module):
def __init__(self, config: Optional[PhimoeConfig]=None):
super().__init__()
self.config... |
class PhimoeRotaryEmbedding(nn.Module):
def __init__(self, config: Optional[PhimoeConfig]=None):
pass
def forward(self, x, seq_len=None):
pass | 3 | 0 | 15 | 1 | 14 | 0 | 3 | 0 | 1 | 2 | 1 | 0 | 2 | 5 | 2 | 12 | 31 | 3 | 28 | 16 | 22 | 0 | 20 | 13 | 17 | 4 | 1 | 1 | 6 |
4,573 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phimoe/modeling_phimoe.py | transformers.models.phimoe.modeling_phimoe.PhimoeSdpaAttention | from typing import Optional, Union
import torch
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache, StaticCache
class PhimoeSdpaAttention(PhimoeAttention):
"""
Phimoe attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
... |
class PhimoeSdpaAttention(PhimoeAttention):
'''
Phimoe attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
`PhimoeAttention` as the weights of the module stays untouched. The only changes are on the forward pass to adapt to
SDPA API.
'''
@deprecate... | 3 | 1 | 78 | 13 | 59 | 8 | 7 | 0.23 | 1 | 4 | 1 | 0 | 1 | 0 | 1 | 14 | 86 | 14 | 60 | 21 | 48 | 14 | 32 | 11 | 30 | 7 | 2 | 1 | 7 |
4,574 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phimoe/modeling_phimoe.py | transformers.models.phimoe.modeling_phimoe.PhimoeSparseMoeBlock | from torch import nn
import torch
class PhimoeSparseMoeBlock(nn.Module):
"""
This implementation is
strictly equivalent to standard MoE with full capacity (no
dropped tokens). It's faster since it formulates MoE operations
in terms of block-sparse operations to accommodate imbalanced
assignment... |
class PhimoeSparseMoeBlock(nn.Module):
'''
This implementation is
strictly equivalent to standard MoE with full capacity (no
dropped tokens). It's faster since it formulates MoE operations
in terms of block-sparse operations to accommodate imbalanced
assignments of tokens to experts, whereas st... | 3 | 2 | 29 | 5 | 19 | 6 | 3 | 0.55 | 1 | 4 | 1 | 0 | 2 | 8 | 2 | 12 | 70 | 11 | 38 | 21 | 35 | 21 | 30 | 21 | 27 | 4 | 1 | 2 | 5 |
4,575 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/phobert/tokenization_phobert.py | transformers.models.phobert.tokenization_phobert.PhobertTokenizer | from typing import Optional
from ...tokenization_utils import PreTrainedTokenizer
from shutil import copyfile
import os
import re
class PhobertTokenizer(PreTrainedTokenizer):
"""
Construct a PhoBERT tokenizer. Based on Byte-Pair-Encoding.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains... |
class PhobertTokenizer(PreTrainedTokenizer):
'''
Construct a PhoBERT tokenizer. Based on Byte-Pair-Encoding.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.
Args:
... | 15 | 9 | 18 | 2 | 12 | 3 | 3 | 0.54 | 1 | 14 | 0 | 0 | 13 | 6 | 13 | 102 | 298 | 52 | 160 | 68 | 127 | 86 | 123 | 45 | 109 | 9 | 3 | 3 | 37 |
4,576 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/configuration_pix2struct.py | transformers.models.pix2struct.configuration_pix2struct.Pix2StructConfig | from ...configuration_utils import PretrainedConfig
class Pix2StructConfig(PretrainedConfig):
"""
[`Pix2StructConfig`] is the configuration class to store the configuration of a
[`Pix2StructForConditionalGeneration`]. It is used to instantiate a Pix2Struct model according to the specified
arguments, de... |
class Pix2StructConfig(PretrainedConfig):
'''
[`Pix2StructConfig`] is the configuration class to store the configuration of a
[`Pix2StructForConditionalGeneration`]. It is used to instantiate a Pix2Struct model according to the specified
arguments, defining the text model and vision model configs. Inst... | 2 | 1 | 25 | 5 | 17 | 3 | 2 | 1.14 | 1 | 3 | 2 | 0 | 1 | 8 | 2 | 2 | 101 | 22 | 37 | 25 | 21 | 42 | 24 | 12 | 21 | 3 | 1 | 1 | 4 |
4,577 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/configuration_pix2struct.py | transformers.models.pix2struct.configuration_pix2struct.Pix2StructTextConfig | from ...configuration_utils import PretrainedConfig
class Pix2StructTextConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Pix2StructTextModel`]. It is used to instantiate
a Pix2Struct text model according to the specified arguments, defining the model architect... |
class Pix2StructTextConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Pix2StructTextModel`]. It is used to instantiate
a Pix2Struct text model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defa... | 2 | 1 | 49 | 3 | 45 | 1 | 1 | 0.93 | 1 | 1 | 0 | 0 | 1 | 15 | 1 | 1 | 122 | 12 | 57 | 41 | 34 | 53 | 21 | 20 | 19 | 1 | 1 | 0 | 1 |
4,578 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/configuration_pix2struct.py | transformers.models.pix2struct.configuration_pix2struct.Pix2StructVisionConfig | from ...configuration_utils import PretrainedConfig
class Pix2StructVisionConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Pix2StructVisionModel`]. It is used to
instantiate a Pix2Struct vision model according to the specified arguments, defining the model arc... |
class Pix2StructVisionConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Pix2StructVisionModel`]. It is used to
instantiate a Pix2Struct vision model according to the specified arguments, defining the model architecture.
Instantiating a configuration default... | 2 | 1 | 36 | 1 | 35 | 0 | 1 | 1.35 | 1 | 1 | 0 | 0 | 1 | 15 | 1 | 1 | 97 | 10 | 37 | 36 | 17 | 50 | 19 | 18 | 17 | 1 | 1 | 0 | 1 |
4,579 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/image_processing_pix2struct.py | transformers.models.pix2struct.image_processing_pix2struct.Pix2StructImageProcessor | from ...utils import TensorType, is_torch_available, is_vision_available, logging
import math
from ...image_processing_utils import BaseImageProcessor, BatchFeature
from ...utils.import_utils import requires_backends
from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to_pil_image
fr... |
class Pix2StructImageProcessor(BaseImageProcessor):
'''
Constructs a Pix2Struct image processor.
Args:
do_convert_rgb (`bool`, *optional*, defaults to `True`):
Whether to convert the image to RGB.
do_normalize (`bool`, *optional*, defaults to `True`):
Whether to norm... | 5 | 4 | 62 | 9 | 33 | 20 | 5 | 0.74 | 1 | 9 | 2 | 0 | 4 | 5 | 4 | 24 | 273 | 42 | 133 | 67 | 95 | 98 | 74 | 34 | 69 | 13 | 3 | 2 | 18 |
4,580 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/modeling_pix2struct.py | transformers.models.pix2struct.modeling_pix2struct.Pix2StructForConditionalGeneration | from ...utils import DUMMY_INPUTS, DUMMY_MASK, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
import torch
from typing import Optional, Union
from ...generation import GenerationMixin
from .configurat... | @auto_docstring(custom_intro='\n A conditional generation model with a language modeling head. Can be used for sequence generation tasks.\n ')
class Pix2StructForConditionalGeneration(Pix2StructPreTrainedModel, GenerationMixin):
def __init__(self, config: Pix2StructConfig):
pass
def get_input_em... | 10 | 1 | 21 | 3 | 12 | 6 | 2 | 0.5 | 2 | 9 | 6 | 0 | 8 | 3 | 8 | 11 | 179 | 32 | 98 | 36 | 69 | 49 | 37 | 17 | 28 | 10 | 2 | 1 | 17 |
4,581 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/modeling_pix2struct.py | transformers.models.pix2struct.modeling_pix2struct.Pix2StructLayerNorm | import torch
from torch import nn
class Pix2StructLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
"""
Construct a layernorm module in the T5 style. No bias and no subtraction of mean.
"""
super().__init__()
self.weight = nn.Parameter(torch.ones(hidden_size... |
class Pix2StructLayerNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
'''
Construct a layernorm module in the T5 style. No bias and no subtraction of mean.
'''
pass
def forward(self, hidden_states):
pass | 3 | 1 | 11 | 2 | 5 | 4 | 2 | 0.73 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 23 | 4 | 11 | 6 | 8 | 8 | 11 | 6 | 8 | 2 | 1 | 1 | 3 |
4,582 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/modeling_pix2struct.py | transformers.models.pix2struct.modeling_pix2struct.Pix2StructPreTrainedModel | from ...modeling_utils import PreTrainedModel
import torch
from .configuration_pix2struct import Pix2StructConfig, Pix2StructTextConfig, Pix2StructVisionConfig
from ...utils import DUMMY_INPUTS, DUMMY_MASK, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging
from torch imp... | @auto_docstring
class Pix2StructPreTrainedModel(PreTrainedModel):
@property
def dummy_inputs(self):
pass
def _init_weights(self, module):
'''Initialize the weights'''
pass
def _shift_right(self, input_ids):
pass | 6 | 1 | 38 | 3 | 32 | 3 | 10 | 0.14 | 1 | 6 | 5 | 3 | 3 | 0 | 3 | 3 | 127 | 12 | 102 | 19 | 97 | 14 | 62 | 18 | 58 | 24 | 1 | 2 | 29 |
4,583 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/modeling_pix2struct.py | transformers.models.pix2struct.modeling_pix2struct.Pix2StructTextAttention | import math
import torch
from torch import nn
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from .configuration_pix2struct import Pix2StructConfig, Pix2StructTextConfig, Pix2StructVisionConfig
class Pix2StructText... |
class Pix2StructTextAttention(nn.Module):
def __init__(self, config: Pix2StructTextConfig, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
pass
@staticmethod
def _relative_position_bucket(relative_position, bidirectional=True, num_buckets=32, max_distance=128):
'''
... | 7 | 3 | 50 | 6 | 35 | 10 | 6 | 0.3 | 1 | 5 | 1 | 0 | 3 | 16 | 4 | 14 | 209 | 27 | 143 | 61 | 123 | 43 | 101 | 46 | 96 | 16 | 1 | 3 | 24 |
4,584 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/modeling_pix2struct.py | transformers.models.pix2struct.modeling_pix2struct.Pix2StructTextBlock | from ...modeling_layers import GradientCheckpointingLayer
from ...utils.deprecation import deprecate_kwarg
from typing import Optional, Union
import torch
class Pix2StructTextBlock(GradientCheckpointingLayer):
def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
su... |
class Pix2StructTextBlock(GradientCheckpointingLayer):
def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states, attention_mask=None, position_bi... | 4 | 0 | 44 | 6 | 36 | 3 | 4 | 0.08 | 1 | 5 | 3 | 0 | 2 | 3 | 2 | 12 | 90 | 13 | 72 | 27 | 54 | 6 | 30 | 12 | 27 | 6 | 1 | 2 | 7 |
4,585 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/modeling_pix2struct.py | transformers.models.pix2struct.modeling_pix2struct.Pix2StructTextDenseGatedActDense | import torch
from torch import nn
from ...activations import ACT2FN
from .configuration_pix2struct import Pix2StructConfig, Pix2StructTextConfig, Pix2StructVisionConfig
class Pix2StructTextDenseGatedActDense(nn.Module):
def __init__(self, config: Pix2StructTextConfig):
super().__init__()
self.wi_0... |
class Pix2StructTextDenseGatedActDense(nn.Module):
def __init__(self, config: Pix2StructTextConfig):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 13 | 1 | 10 | 2 | 2 | 0.14 | 1 | 3 | 1 | 0 | 2 | 5 | 2 | 12 | 27 | 3 | 21 | 10 | 18 | 3 | 17 | 10 | 14 | 2 | 1 | 1 | 3 |
4,586 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/modeling_pix2struct.py | transformers.models.pix2struct.modeling_pix2struct.Pix2StructTextLayerCrossAttention | from ...utils.deprecation import deprecate_kwarg
from typing import Optional, Union
from torch import nn
class Pix2StructTextLayerCrossAttention(nn.Module):
def __init__(self, config, layer_idx: Optional[int]=None):
super().__init__()
self.attention = Pix2StructTextAttention(config, has_relative_a... |
class Pix2StructTextLayerCrossAttention(nn.Module):
def __init__(self, config, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states, key_value_states, attention_mask=None, position_bias=None, layer_head_... | 4 | 0 | 17 | 0 | 17 | 1 | 1 | 0.03 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 12 | 36 | 1 | 35 | 22 | 20 | 1 | 12 | 10 | 9 | 1 | 1 | 0 | 2 |
4,587 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/modeling_pix2struct.py | transformers.models.pix2struct.modeling_pix2struct.Pix2StructTextLayerFF | from torch import nn
from .configuration_pix2struct import Pix2StructConfig, Pix2StructTextConfig, Pix2StructVisionConfig
class Pix2StructTextLayerFF(nn.Module):
def __init__(self, config: Pix2StructTextConfig):
super().__init__()
self.DenseReluDense = Pix2StructTextDenseGatedActDense(config)
... |
class Pix2StructTextLayerFF(nn.Module):
def __init__(self, config: Pix2StructTextConfig):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 6 | 1 | 5 | 0 | 1 | 0.09 | 1 | 4 | 3 | 0 | 2 | 3 | 2 | 12 | 14 | 2 | 11 | 7 | 8 | 1 | 11 | 7 | 8 | 1 | 1 | 0 | 2 |
4,588 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/modeling_pix2struct.py | transformers.models.pix2struct.modeling_pix2struct.Pix2StructTextLayerSelfAttention | from ...utils.deprecation import deprecate_kwarg
from typing import Optional, Union
from torch import nn
class Pix2StructTextLayerSelfAttention(nn.Module):
def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
super().__init__()
self.attention = Pix2StructTe... |
class Pix2StructTextLayerSelfAttention(nn.Module):
def __init__(self, config, has_relative_attention_bias=False, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states, attention_mask=None, position_bias=N... | 4 | 0 | 16 | 0 | 16 | 1 | 1 | 0.03 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 12 | 34 | 1 | 33 | 19 | 20 | 1 | 12 | 9 | 9 | 1 | 1 | 0 | 2 |
4,589 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/modeling_pix2struct.py | transformers.models.pix2struct.modeling_pix2struct.Pix2StructTextModel | from typing import Optional, Union
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...utils import DUMMY_INPUTS, DUMMY_MASK, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPoo... | @auto_docstring(custom_intro='\n The standalone text decoder of Pix2Struct\n ')
class Pix2StructTextModel(Pix2StructPreTrainedModel):
def __init__(self, config):
pass
def set_input_embeddings(self, new_embeddings):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.... | 9 | 2 | 45 | 5 | 34 | 7 | 7 | 0.21 | 1 | 16 | 8 | 0 | 8 | 6 | 9 | 12 | 427 | 51 | 313 | 95 | 267 | 65 | 166 | 60 | 156 | 40 | 2 | 3 | 64 |
4,590 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/modeling_pix2struct.py | transformers.models.pix2struct.modeling_pix2struct.Pix2StructVisionAttention | from torch import nn
from ...utils import DUMMY_INPUTS, DUMMY_MASK, auto_docstring, is_torch_flex_attn_available, is_torch_fx_proxy, is_torchdynamo_compiling, logging
import torch
class Pix2StructVisionAttention(nn.Module):
def __init__(self, config):
super().__init__()
self.hidden_size = config.h... |
class Pix2StructVisionAttention(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, position_bias=None, layer_head_mask=None, output_attentions=False):
'''
Self-attention block
'''
pass
def to_projection_shape(sta... | 4 | 2 | 32 | 6 | 20 | 6 | 3 | 0.31 | 1 | 1 | 0 | 0 | 2 | 10 | 2 | 12 | 95 | 19 | 58 | 30 | 47 | 18 | 45 | 23 | 41 | 8 | 1 | 2 | 10 |
4,591 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/modeling_pix2struct.py | transformers.models.pix2struct.modeling_pix2struct.Pix2StructVisionEmbeddings | from torch import nn
import torch
from .configuration_pix2struct import Pix2StructConfig, Pix2StructTextConfig, Pix2StructVisionConfig
class Pix2StructVisionEmbeddings(nn.Module):
"""
Construct the embeddings from patch. In `Pix2Struct` the input is different from classic Vision-transformer models.
Here th... |
class Pix2StructVisionEmbeddings(nn.Module):
'''
Construct the embeddings from patch. In `Pix2Struct` the input is different from classic Vision-transformer models.
Here the input is a sequence of `seq_len` flattened patches that also combines padding patches (tokens). Each patch
is represented by a ve... | 3 | 1 | 13 | 4 | 8 | 2 | 1 | 0.47 | 1 | 3 | 1 | 0 | 2 | 4 | 2 | 12 | 34 | 9 | 17 | 12 | 14 | 8 | 17 | 12 | 14 | 1 | 1 | 0 | 2 |
4,592 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/modeling_pix2struct.py | transformers.models.pix2struct.modeling_pix2struct.Pix2StructVisionEncoder | from torch import nn
from .configuration_pix2struct import Pix2StructConfig, Pix2StructTextConfig, Pix2StructVisionConfig
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
import torch
from typing import Optional, Union
c... |
class Pix2StructVisionEncoder(nn.Module):
def __init__(self, config: Pix2StructVisionConfig) -> None:
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False, output_hidden_states: bool=Fals... | 3 | 0 | 25 | 4 | 21 | 0 | 6 | 0 | 1 | 9 | 3 | 0 | 2 | 3 | 2 | 12 | 51 | 8 | 43 | 19 | 32 | 0 | 24 | 11 | 21 | 10 | 1 | 2 | 11 |
4,593 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/modeling_pix2struct.py | transformers.models.pix2struct.modeling_pix2struct.Pix2StructVisionLayer | import torch
from .configuration_pix2struct import Pix2StructConfig, Pix2StructTextConfig, Pix2StructVisionConfig
from typing import Optional, Union
from ...modeling_layers import GradientCheckpointingLayer
class Pix2StructVisionLayer(GradientCheckpointingLayer):
def __init__(self, config: Pix2StructConfig) -> No... |
class Pix2StructVisionLayer(GradientCheckpointingLayer):
def __init__(self, config: Pix2StructConfig) -> None:
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, output_attentions: bool=False) -> Union[tuple[torch.T... | 3 | 0 | 20 | 3 | 15 | 3 | 1 | 0.16 | 1 | 7 | 4 | 0 | 2 | 6 | 2 | 12 | 41 | 7 | 31 | 20 | 22 | 5 | 20 | 14 | 17 | 1 | 1 | 0 | 2 |
4,594 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/modeling_pix2struct.py | transformers.models.pix2struct.modeling_pix2struct.Pix2StructVisionMlp | from ...activations import ACT2FN
from .configuration_pix2struct import Pix2StructConfig, Pix2StructTextConfig, Pix2StructVisionConfig
import torch
from torch import nn
class Pix2StructVisionMlp(nn.Module):
def __init__(self, config: Pix2StructVisionConfig):
super().__init__()
self.wi_0 = nn.Linea... |
class Pix2StructVisionMlp(nn.Module):
def __init__(self, config: Pix2StructVisionConfig):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 13 | 1 | 10 | 2 | 2 | 0.14 | 1 | 3 | 1 | 0 | 2 | 5 | 2 | 12 | 27 | 3 | 21 | 10 | 18 | 3 | 17 | 10 | 14 | 2 | 1 | 1 | 3 |
4,595 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/modeling_pix2struct.py | transformers.models.pix2struct.modeling_pix2struct.Pix2StructVisionModel | from .configuration_pix2struct import Pix2StructConfig, Pix2StructTextConfig, Pix2StructVisionConfig
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling, CausalLMOutputWithCrossAttentions, Seq2SeqLMOutput, Seq2SeqModelOutput
from ...utils import DUMMY_INPUTS, DUMMY_MASK, auto_docstr... | @auto_docstring
class Pix2StructVisionModel(Pix2StructPreTrainedModel):
def __init__(self, config: Pix2StructVisionConfig):
pass
def get_input_embeddings(self):
pass
def _prune_heads(self, heads_to_prune: dict[int, list[int]]) -> None:
'''
Prunes heads of the model. heads_... | 7 | 2 | 24 | 4 | 13 | 8 | 3 | 0.53 | 1 | 11 | 6 | 0 | 4 | 4 | 4 | 7 | 107 | 20 | 57 | 27 | 42 | 30 | 34 | 18 | 29 | 7 | 2 | 1 | 11 |
4,596 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/processing_pix2struct.py | transformers.models.pix2struct.processing_pix2struct.Pix2StructImagesKwargs | from ...tokenization_utils_base import BatchEncoding, PreTokenizedInput, TextInput
from typing import Optional, Union
from ...processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin, Unpack
class Pix2StructImagesKwargs(ImagesKwargs, total=False):
max_patches: Optional[int]
header_text: Optional[... |
class Pix2StructImagesKwargs(ImagesKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 1 | 2 | 0 | 3 | 1 | 2 | 0 | 2 | 0 | 0 |
4,597 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/processing_pix2struct.py | transformers.models.pix2struct.processing_pix2struct.Pix2StructProcessor | from ...feature_extraction_utils import BatchFeature
from typing import Optional, Union
from ...tokenization_utils_base import BatchEncoding, PreTokenizedInput, TextInput
from ...processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin, Unpack
class Pix2StructProcessor(ProcessorMixin):
"""
Constr... |
class Pix2StructProcessor(ProcessorMixin):
'''
Constructs a PIX2STRUCT processor which wraps a BERT tokenizer and PIX2STRUCT image processor into a single
processor.
[`Pix2StructProcessor`] offers all the functionalities of [`Pix2StructImageProcessor`] and [`T5TokenizerFast`]. See
the docstring of ... | 5 | 2 | 17 | 2 | 12 | 3 | 3 | 0.41 | 1 | 7 | 3 | 0 | 5 | 1 | 5 | 22 | 109 | 16 | 66 | 25 | 52 | 27 | 43 | 17 | 37 | 11 | 2 | 2 | 15 |
4,598 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pix2struct/processing_pix2struct.py | transformers.models.pix2struct.processing_pix2struct.Pix2StructProcessorKwargs | from ...processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin, Unpack
class Pix2StructProcessorKwargs(ProcessingKwargs, total=False):
images_kwargs: Pix2StructImagesKwargs
_defaults = {'text_kwargs': {'add_special_tokens': True, 'padding': False, 'stride': 0, 'return_overflowing_tokens': False... |
class Pix2StructProcessorKwargs(ProcessingKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 18 | 0 | 18 | 2 | 17 | 0 | 3 | 2 | 2 | 0 | 3 | 0 | 0 |
4,599 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pixtral/configuration_pixtral.py | transformers.models.pixtral.configuration_pixtral.PixtralVisionConfig | from ...configuration_utils import PretrainedConfig
class PixtralVisionConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`PixtralVisionModel`]. It is used to instantiate an
Pixtral vision encoder according to the specified arguments, defining the model architect... |
class PixtralVisionConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`PixtralVisionModel`]. It is used to instantiate an
Pixtral vision encoder according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defa... | 2 | 1 | 29 | 1 | 28 | 0 | 1 | 1.33 | 1 | 1 | 0 | 0 | 1 | 12 | 1 | 1 | 81 | 11 | 30 | 29 | 14 | 40 | 16 | 15 | 14 | 1 | 1 | 0 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.