id int64 0 328k | repository_name stringlengths 7 58 | file_path stringlengths 9 302 | class_name stringlengths 5 256 | human_written_code stringlengths 16 2.16M | class_skeleton stringlengths 18 1.49M ⌀ | total_program_units int64 1 1.76k | total_doc_str int64 0 771 | AvgCountLine float64 0 7.89k | AvgCountLineBlank float64 0 297 | AvgCountLineCode float64 0 7.89k | AvgCountLineComment float64 0 7.89k | AvgCyclomatic float64 0 130 | CommentToCodeRatio float64 0 168 | CountClassBase float64 0 40 | CountClassCoupled float64 0 583 | CountClassCoupledModified float64 0 575 | CountClassDerived float64 0 5.35k | CountDeclInstanceMethod float64 0 529 | CountDeclInstanceVariable float64 0 296 | CountDeclMethod float64 0 599 | CountDeclMethodAll float64 0 1.12k | CountLine float64 1 40.4k | CountLineBlank float64 0 8.16k | CountLineCode float64 1 25.7k | CountLineCodeDecl float64 1 8.15k | CountLineCodeExe float64 0 24.2k | CountLineComment float64 0 16.5k | CountStmt float64 1 9.71k | CountStmtDecl float64 1 8.15k | CountStmtExe float64 0 9.69k | MaxCyclomatic float64 0 759 | MaxInheritanceTree float64 0 16 | MaxNesting float64 0 34 | SumCyclomatic float64 0 2.9k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1,300 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere/modeling_cohere.py | transformers.models.cohere.modeling_cohere.CoherePreTrainedModel | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_cohere import CohereConfig
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
@auto_docstring
class CoherePreTrainedModel(PreTrainedModel):
config: CohereConfig
base_model_prefix = 'model'
supp... | @auto_docstring
class CoherePreTrainedModel(PreTrainedModel):
pass | 2 | 0 | 10 | 0 | 10 | 0 | 5 | 0 | 1 | 0 | 0 | 3 | 1 | 0 | 1 | 1 | 24 | 1 | 23 | 15 | 21 | 0 | 22 | 15 | 20 | 5 | 1 | 2 | 5 |
1,301 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere/modeling_cohere.py | transformers.models.cohere.modeling_cohere.CohereRotaryEmbedding | import torch
from .configuration_cohere import CohereConfig
from torch import nn
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
class CohereRotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, config: CohereConfig, device=None):
super().__init__()
... |
class CohereRotaryEmbedding(nn.Module):
def __init__(self, config: CohereConfig, device=None):
pass
@torch.no_grad()
@dynamic_rope_update
def forward(self, x, position_ids):
pass | 5 | 0 | 18 | 2 | 13 | 5 | 3 | 0.38 | 1 | 4 | 1 | 1 | 3 | 7 | 3 | 13 | 59 | 8 | 40 | 21 | 35 | 15 | 38 | 20 | 34 | 3 | 1 | 1 | 8 |
1,302 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere/modular_cohere.py | transformers.models.cohere.modular_cohere.CohereAttention | from typing import Callable, Optional, Union
from ...processing_utils import Unpack
from .configuration_cohere import CohereConfig
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache
from ..llama.modeling_llama import LlamaAttention, LlamaForCausalLM, LlamaMLP, LlamaModel, LlamaRotaryEmbed... |
class CohereAttention(LlamaAttention):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: CohereConfig, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_state... | 4 | 1 | 34 | 4 | 29 | 2 | 4 | 0.07 | 1 | 7 | 4 | 0 | 2 | 5 | 2 | 14 | 71 | 10 | 58 | 25 | 47 | 4 | 33 | 15 | 30 | 6 | 2 | 2 | 8 |
1,303 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere/modular_cohere.py | transformers.models.cohere.modular_cohere.CohereDecoderLayer | import torch
from .configuration_cohere import CohereConfig
from ...processing_utils import Unpack
from typing import Callable, Optional, Union
from ...cache_utils import Cache
from ...modeling_layers import GradientCheckpointingLayer
from ...utils.deprecation import deprecate_kwarg
from ...modeling_flash_attention_uti... |
class CohereDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: CohereConfig, 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 | 33 | 3 | 19 | 12 | 2 | 0.61 | 1 | 10 | 6 | 0 | 2 | 4 | 2 | 12 | 67 | 7 | 38 | 22 | 24 | 23 | 17 | 11 | 14 | 2 | 1 | 1 | 3 |
1,304 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere/modular_cohere.py | transformers.models.cohere.modular_cohere.CohereForCausalLM | from typing import Callable, Optional, Union
from ...processing_utils import Unpack
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from ...utils import TransformersKwargs, logging
from ...cache_utils import Cache
import torch
from ..llama.modeling_llama import LlamaAttention, LlamaForCa... |
class CohereForCausalLM(LlamaForCausalLM):
def __init__(self, config):
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[Union[Cache, list[torch.FloatTensor]]]=None, ... | 3 | 1 | 48 | 6 | 28 | 14 | 5 | 0.49 | 1 | 9 | 4 | 0 | 2 | 3 | 2 | 11 | 97 | 13 | 57 | 27 | 39 | 28 | 22 | 12 | 19 | 8 | 3 | 1 | 9 |
1,305 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere/modular_cohere.py | transformers.models.cohere.modular_cohere.CohereLayerNorm | import torch
from torch import nn
class CohereLayerNorm(nn.Module):
def __init__(self, hidden_size=None, eps=1e-05, bias=False):
"""The hidden size can be a tuple or an int. The tuple is used for QKNorm to normalize across head_dim"""
super().__init__()
self.weight = nn.Parameter(torch.one... |
class CohereLayerNorm(nn.Module):
def __init__(self, hidden_size=None, eps=1e-05, bias=False):
'''The hidden size can be a tuple or an int. The tuple is used for QKNorm to normalize across head_dim'''
pass
def forward(self, hidden_states):
pass | 3 | 1 | 7 | 0 | 6 | 1 | 1 | 0.08 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 15 | 1 | 13 | 8 | 10 | 1 | 13 | 8 | 10 | 1 | 1 | 0 | 2 |
1,306 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere/modular_cohere.py | transformers.models.cohere.modular_cohere.CohereMLP | from ..llama.modeling_llama import LlamaAttention, LlamaForCausalLM, LlamaMLP, LlamaModel, LlamaRotaryEmbedding, eager_attention_forward
from torch import nn
class CohereMLP(LlamaMLP):
def __init__(self, config):
super().__init__(config)
self.gate_proj = nn.Linear(self.hidden_size, self.intermedia... |
class CohereMLP(LlamaMLP):
def __init__(self, config):
pass | 2 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 5 | 1 | 13 | 6 | 0 | 6 | 5 | 4 | 0 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
1,307 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere/modular_cohere.py | transformers.models.cohere.modular_cohere.CohereModel | from ..llama.modeling_llama import LlamaAttention, LlamaForCausalLM, LlamaMLP, LlamaModel, LlamaRotaryEmbedding, eager_attention_forward
from torch import nn
from .configuration_cohere import CohereConfig
class CohereModel(LlamaModel):
def __init__(self, config: CohereConfig):
super().__init__(config)
... |
class CohereModel(LlamaModel):
def __init__(self, config: CohereConfig):
pass | 2 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 6 | 4 | 0 | 1 | 3 | 1 | 8 | 8 | 0 | 8 | 5 | 6 | 0 | 6 | 5 | 4 | 1 | 3 | 0 | 1 |
1,308 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere/modular_cohere.py | transformers.models.cohere.modular_cohere.CohereRotaryEmbedding | import torch
from ..llama.modeling_llama import LlamaAttention, LlamaForCausalLM, LlamaMLP, LlamaModel, LlamaRotaryEmbedding, eager_attention_forward
from ...modeling_rope_utils import dynamic_rope_update
class CohereRotaryEmbedding(LlamaRotaryEmbedding):
@torch.no_grad()
@dynamic_rope_update
def forward(... |
class CohereRotaryEmbedding(LlamaRotaryEmbedding):
@torch.no_grad()
@dynamic_rope_update
def forward(self, x, position_ids):
pass | 4 | 0 | 21 | 3 | 15 | 4 | 3 | 0.24 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 14 | 23 | 3 | 17 | 10 | 14 | 4 | 16 | 9 | 14 | 3 | 2 | 1 | 3 |
1,309 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere/tokenization_cohere_fast.py | transformers.models.cohere.tokenization_cohere_fast.CohereTokenizerFast | from ...tokenization_utils_fast import PreTrainedTokenizerFast
from typing import Literal, Union
from tokenizers import processors
import pickle
from ...tokenization_utils_base import BatchEncoding
class CohereTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a Cohere tokenizer. Based on byte-level Byte-Pa... |
class CohereTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a Cohere tokenizer. Based on byte-level Byte-Pair-Encoding.
This uses notably ByteFallback and NFC normalization.
```python
>>> from transformers import AutoTokenizer
>>> tokenizer = AutoTokenizer.from_pretrained("CohereForAI/c4a... | 16 | 4 | 35 | 3 | 11 | 20 | 2 | 2.05 | 1 | 6 | 1 | 0 | 11 | 7 | 11 | 99 | 463 | 60 | 132 | 67 | 91 | 271 | 71 | 38 | 59 | 9 | 3 | 1 | 25 |
1,310 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere2/modeling_cohere2.py | transformers.models.cohere2.modeling_cohere2.Cohere2Attention | from ...processing_utils import Unpack
from ...cache_utils import Cache, DynamicCache
import torch
from typing import Callable, Optional, Union
import torch.nn as nn
from .configuration_cohere2 import Cohere2Config
from ...utils.deprecation import deprecate_kwarg
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, P... |
class Cohere2Attention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: Cohere2Config, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: ... | 4 | 1 | 42 | 4 | 38 | 1 | 5 | 0.03 | 1 | 6 | 3 | 0 | 2 | 12 | 2 | 12 | 88 | 10 | 76 | 33 | 65 | 2 | 39 | 25 | 36 | 7 | 1 | 2 | 9 |
1,311 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere2/modeling_cohere2.py | transformers.models.cohere2.modeling_cohere2.Cohere2DecoderLayer | from ...processing_utils import Unpack
from typing import Callable, Optional, Union
from ...modeling_layers import GradientCheckpointingLayer
import torch.nn as nn
from ...utils.deprecation import deprecate_kwarg
import torch
from ...modeling_flash_attention_utils import FlashAttentionKwargs
from .configuration_cohere2... |
class Cohere2DecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Cohere2Config, 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... | 4 | 1 | 46 | 5 | 26 | 16 | 3 | 0.6 | 1 | 10 | 6 | 0 | 2 | 7 | 2 | 12 | 94 | 10 | 53 | 29 | 39 | 32 | 30 | 18 | 27 | 4 | 1 | 2 | 5 |
1,312 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere2/modeling_cohere2.py | transformers.models.cohere2.modeling_cohere2.Cohere2ForCausalLM | from ...cache_utils import Cache, DynamicCache
import torch
from ...generation import GenerationMixin
from ...processing_utils import Unpack
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from typing import Callable, Optional, Union
import torch.nn as nn
from ...utils import Transformer... | @auto_docstring
class Cohere2ForCausalLM(Cohere2PreTrainedModel, 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.LongTenso... | 6 | 1 | 22 | 2 | 15 | 5 | 3 | 0.34 | 2 | 11 | 6 | 0 | 9 | 5 | 9 | 10 | 213 | 29 | 140 | 53 | 101 | 48 | 65 | 26 | 55 | 11 | 2 | 2 | 26 |
1,313 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere2/modeling_cohere2.py | transformers.models.cohere2.modeling_cohere2.Cohere2LayerNorm | import torch.nn as nn
import torch
class Cohere2LayerNorm(nn.Module):
def __init__(self, hidden_size=None, eps=1e-05, bias=False):
"""The hidden size can be a tuple or an int. The tuple is used for QKNorm to normalize across head_dim"""
super().__init__()
self.weight = nn.Parameter(torch.o... |
class Cohere2LayerNorm(nn.Module):
def __init__(self, hidden_size=None, eps=1e-05, bias=False):
'''The hidden size can be a tuple or an int. The tuple is used for QKNorm to normalize across head_dim'''
pass
def forward(self, hidden_states):
pass | 3 | 1 | 7 | 0 | 6 | 1 | 1 | 0.08 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 15 | 1 | 13 | 8 | 10 | 1 | 13 | 8 | 10 | 1 | 1 | 0 | 2 |
1,314 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere2/modeling_cohere2.py | transformers.models.cohere2.modeling_cohere2.Cohere2MLP | from ...activations import ACT2FN
import torch.nn as nn
class Cohere2MLP(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.hidden_size = config.hidden_size
self.intermediate_size = config.intermediate_size
self.gate_proj = nn.Linear(self.h... |
class Cohere2MLP(nn.Module):
def __init__(self, config):
pass
def forward(self, x):
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 7 | 2 | 12 | 14 | 1 | 13 | 11 | 10 | 0 | 13 | 11 | 10 | 1 | 1 | 0 | 2 |
1,315 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere2/modeling_cohere2.py | transformers.models.cohere2.modeling_cohere2.Cohere2Model | from .configuration_cohere2 import Cohere2Config
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
from ...processing_utils import Unpack
from ...utils.generic import check_model_inputs
from typing import Callable, Optional, Union
from ...masking_utils import create_causal_mask, create_sliding_w... | @auto_docstring
class Cohere2Model(Cohere2PreTrainedModel):
def __init__(self, config: Cohere2Config):
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]=Non... | 6 | 0 | 38 | 4 | 28 | 6 | 6 | 0.24 | 1 | 13 | 7 | 0 | 5 | 8 | 6 | 7 | 242 | 28 | 174 | 66 | 134 | 41 | 84 | 32 | 77 | 23 | 2 | 2 | 34 |
1,316 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere2/modeling_cohere2.py | transformers.models.cohere2.modeling_cohere2.Cohere2PreTrainedModel | from .configuration_cohere2 import Cohere2Config
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
@auto_docstring
class Cohere2PreTrainedModel(PreTrainedModel):
config: Cohere2Config
base_model_prefix = 'model'
... | @auto_docstring
class Cohere2PreTrainedModel(PreTrainedModel):
pass | 2 | 0 | 10 | 0 | 10 | 0 | 5 | 0 | 1 | 0 | 0 | 2 | 1 | 0 | 1 | 1 | 24 | 1 | 23 | 15 | 21 | 0 | 22 | 15 | 20 | 5 | 1 | 2 | 5 |
1,317 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere2/modeling_cohere2.py | transformers.models.cohere2.modeling_cohere2.Cohere2RotaryEmbedding | from .configuration_cohere2 import Cohere2Config
import torch
import torch.nn as nn
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
class Cohere2RotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, config: Cohere2Config, device=None):
super().__init__()
... |
class Cohere2RotaryEmbedding(nn.Module):
def __init__(self, config: Cohere2Config, device=None):
pass
@torch.no_grad()
@dynamic_rope_update
def forward(self, x, position_ids):
pass | 5 | 0 | 18 | 2 | 13 | 5 | 3 | 0.38 | 1 | 4 | 1 | 0 | 3 | 7 | 3 | 13 | 59 | 8 | 40 | 21 | 35 | 15 | 38 | 20 | 34 | 3 | 1 | 1 | 8 |
1,318 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere2/modular_cohere2.py | transformers.models.cohere2.modular_cohere2.Cohere2Attention | from ...modeling_flash_attention_utils import FlashAttentionKwargs
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS
import torch
from ..cohere.modeling_cohere import CohereAttention, CohereDecoderLayer, CohereForCausalLM, CohereLayerNorm, CoherePreTrainedModel, CohereRotaryEmbedding, apply_rotary_pos_emb, eager_at... |
class Cohere2Attention(CohereAttention):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: Cohere2Config, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_st... | 4 | 1 | 42 | 4 | 38 | 1 | 5 | 0.03 | 2 | 5 | 3 | 0 | 2 | 12 | 2 | 14 | 88 | 10 | 76 | 33 | 65 | 2 | 39 | 25 | 36 | 7 | 2 | 2 | 9 |
1,319 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere2/modular_cohere2.py | transformers.models.cohere2.modular_cohere2.Cohere2Config | from ...configuration_utils import PretrainedConfig, layer_type_validation
from ...modeling_rope_utils import rope_config_validation
class Cohere2Config(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`CohereModel`]. It is used to instantiate an Cohere
model accordin... |
class Cohere2Config(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`CohereModel`]. It is used to instantiate an Cohere
model according to the specified arguments, defining the model architecture.
Configuration objects inherit from [`PretrainedConfig`] and can be... | 2 | 1 | 64 | 4 | 57 | 3 | 2 | 1.57 | 1 | 1 | 0 | 0 | 1 | 20 | 1 | 33 | 190 | 13 | 69 | 51 | 41 | 108 | 29 | 25 | 27 | 2 | 2 | 1 | 2 |
1,320 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere2/modular_cohere2.py | transformers.models.cohere2.modular_cohere2.Cohere2DecoderLayer | import torch
from ...cache_utils import Cache, DynamicCache
from ..cohere.modeling_cohere import CohereAttention, CohereDecoderLayer, CohereForCausalLM, CohereLayerNorm, CoherePreTrainedModel, CohereRotaryEmbedding, apply_rotary_pos_emb, eager_attention_forward
from ...processing_utils import Unpack
from typing import ... |
class Cohere2DecoderLayer(CohereDecoderLayer):
def __init__(self, config: Cohere2Config, 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], atten... | 4 | 0 | 45 | 5 | 25 | 16 | 3 | 0.64 | 1 | 8 | 4 | 0 | 2 | 4 | 2 | 14 | 91 | 10 | 50 | 26 | 36 | 32 | 27 | 15 | 24 | 4 | 2 | 2 | 5 |
1,321 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere2/modular_cohere2.py | transformers.models.cohere2.modular_cohere2.Cohere2ForCausalLM | from ..cohere.modeling_cohere import CohereAttention, CohereDecoderLayer, CohereForCausalLM, CohereLayerNorm, CoherePreTrainedModel, CohereRotaryEmbedding, apply_rotary_pos_emb, eager_attention_forward
class Cohere2ForCausalLM(CohereForCausalLM):
pass |
class Cohere2ForCausalLM(CohereForCausalLM):
pass | 1 | 0 | 44 | 4 | 33 | 10 | 6 | 0.29 | 1 | 3 | 2 | 0 | 2 | 0 | 2 | 11 | 90 | 8 | 66 | 17 | 52 | 19 | 29 | 6 | 26 | 11 | 3 | 2 | 12 |
1,322 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere2/modular_cohere2.py | transformers.models.cohere2.modular_cohere2.Cohere2LayerNorm | from ..cohere.modeling_cohere import CohereAttention, CohereDecoderLayer, CohereForCausalLM, CohereLayerNorm, CoherePreTrainedModel, CohereRotaryEmbedding, apply_rotary_pos_emb, eager_attention_forward
class Cohere2LayerNorm(CohereLayerNorm):
pass |
class Cohere2LayerNorm(CohereLayerNorm):
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 |
1,323 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere2/modular_cohere2.py | transformers.models.cohere2.modular_cohere2.Cohere2Model | from ...utils import TransformersKwargs, logging
from typing import Callable, Optional
from ..gemma2.modeling_gemma2 import Gemma2Model
import torch.nn as nn
from ...cache_utils import Cache, DynamicCache
from ...modeling_outputs import BaseModelOutputWithPast
from ...masking_utils import create_causal_mask, create_sli... |
class Cohere2Model(Gemma2Model):
def __init__(self, config: Cohere2Config):
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[tor... | 3 | 0 | 63 | 8 | 51 | 4 | 12 | 0.12 | 1 | 11 | 6 | 0 | 2 | 3 | 2 | 9 | 133 | 18 | 103 | 30 | 86 | 12 | 48 | 15 | 45 | 23 | 3 | 2 | 24 |
1,324 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere2/modular_cohere2.py | transformers.models.cohere2.modular_cohere2.Cohere2PreTrainedModel | from ..cohere.modeling_cohere import CohereAttention, CohereDecoderLayer, CohereForCausalLM, CohereLayerNorm, CoherePreTrainedModel, CohereRotaryEmbedding, apply_rotary_pos_emb, eager_attention_forward
class Cohere2PreTrainedModel(CoherePreTrainedModel):
config: Cohere2Config |
class Cohere2PreTrainedModel(CoherePreTrainedModel):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 2 | 0 | 0 |
1,325 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/cohere2/modular_cohere2.py | transformers.models.cohere2.modular_cohere2.Cohere2RotaryEmbedding | from ..cohere.modeling_cohere import CohereAttention, CohereDecoderLayer, CohereForCausalLM, CohereLayerNorm, CoherePreTrainedModel, CohereRotaryEmbedding, apply_rotary_pos_emb, eager_attention_forward
class Cohere2RotaryEmbedding(CohereRotaryEmbedding):
pass |
class Cohere2RotaryEmbedding(CohereRotaryEmbedding):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 13 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
1,326 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/colpali/configuration_colpali.py | transformers.models.colpali.configuration_colpali.ColPaliConfig | from ..auto import CONFIG_MAPPING, AutoConfig
from copy import deepcopy
from ...configuration_utils import PretrainedConfig
class ColPaliConfig(PretrainedConfig):
"""
Configuration class to store the configuration of a [`ColPaliForRetrieval`]. It is used to instantiate an instance
of `ColPaliForRetrieval` ... |
class ColPaliConfig(PretrainedConfig):
'''
Configuration class to store the configuration of a [`ColPaliForRetrieval`]. It is used to instantiate an instance
of `ColPaliForRetrieval` according to the specified arguments, defining the model architecture following the methodology
from the "ColPali: Effic... | 2 | 1 | 39 | 3 | 36 | 0 | 9 | 0.64 | 1 | 7 | 0 | 0 | 1 | 3 | 1 | 1 | 77 | 13 | 39 | 13 | 31 | 25 | 21 | 7 | 19 | 9 | 1 | 2 | 9 |
1,327 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/colpali/modeling_colpali.py | transformers.models.colpali.modeling_colpali.ColPaliForRetrieval | from typing import Optional
from .configuration_colpali import ColPaliConfig
from transformers import AutoModelForImageTextToText
from ...utils import ModelOutput, auto_docstring, can_return_tuple
from torch import nn
import torch
@auto_docstring(custom_intro='\n The ColPali architecture leverages VLMs to construct... | @auto_docstring(custom_intro='\n The ColPali architecture leverages VLMs to construct efficient multi-vector embeddings directly\n from document images (“screenshots”) for document retrieval. The model is trained to maximize the similarity\n between these document embeddings and the corresponding query embeddi... | 12 | 0 | 10 | 1 | 9 | 1 | 2 | 0.09 | 1 | 7 | 2 | 0 | 10 | 6 | 10 | 11 | 116 | 21 | 91 | 39 | 64 | 8 | 51 | 24 | 40 | 11 | 2 | 1 | 21 |
1,328 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/colpali/modeling_colpali.py | transformers.models.colpali.modeling_colpali.ColPaliForRetrievalOutput | from ...cache_utils import Cache
from dataclasses import dataclass
from typing import Optional
from ...utils import ModelOutput, auto_docstring, can_return_tuple
import torch
@dataclass
@auto_docstring(custom_intro='\n Base class for ColPali embeddings output.\n ')
class ColPaliForRetrievalOutput(ModelOutput):
... | @dataclass
@auto_docstring(custom_intro='\n Base class for ColPali embeddings output.\n ')
class ColPaliForRetrievalOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Language modeling loss (for next-token prediction).
embedding... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.57 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 37 | 5 | 7 | 7 | 6 | 25 | 7 | 7 | 6 | 0 | 1 | 0 | 0 |
1,329 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/colpali/modeling_colpali.py | transformers.models.colpali.modeling_colpali.ColPaliPreTrainedModel | from ...utils import ModelOutput, auto_docstring, can_return_tuple
from .configuration_colpali import ColPaliConfig
from ...modeling_utils import PreTrainedModel
from torch import nn
@auto_docstring
class ColPaliPreTrainedModel(PreTrainedModel):
config: ColPaliConfig
base_model_prefix = 'model'
_no_split_m... | @auto_docstring
class ColPaliPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 15 | 1 | 14 | 0 | 6 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 20 | 2 | 18 | 6 | 16 | 0 | 13 | 6 | 11 | 6 | 1 | 2 | 6 |
1,330 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/colpali/modular_colpali.py | transformers.models.colpali.modular_colpali.ColPaliProcessor | from transformers.models.paligemma.processing_paligemma import IMAGE_TOKEN, PaliGemmaProcessor, build_string_from_input
from ...tokenization_utils_base import PreTokenizedInput, TextInput
from ...feature_extraction_utils import BatchFeature
from ...processing_utils import ProcessingKwargs, Unpack
from typing import Opt... |
class ColPaliProcessor(PaliGemmaProcessor):
'''
Constructs a ColPali processor which wraps a PaliGemmaProcessor and special methods to process images and queries, as
well as to compute the late-interaction retrieval score.
[`ColPaliProcessor`] offers all the functionalities of [`PaliGemmaProcessor`]. S... | 8 | 6 | 53 | 8 | 24 | 21 | 5 | 0.95 | 1 | 9 | 2 | 0 | 5 | 1 | 5 | 27 | 288 | 50 | 123 | 50 | 94 | 117 | 69 | 26 | 63 | 16 | 3 | 2 | 27 |
1,331 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/colpali/modular_colpali.py | transformers.models.colpali.modular_colpali.ColPaliProcessorKwargs | from ...processing_utils import ProcessingKwargs, Unpack
class ColPaliProcessorKwargs(ProcessingKwargs, total=False):
_defaults = {'text_kwargs': {'padding': 'longest'}, 'images_kwargs': {'data_format': 'channels_first', 'do_convert_rgb': True}, 'common_kwargs': {'return_tensors': 'pt'}} |
class ColPaliProcessorKwargs(ProcessingKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 0 | 11 | 2 | 10 | 0 | 2 | 2 | 1 | 0 | 3 | 0 | 0 |
1,332 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/colpali/processing_colpali.py | transformers.models.colpali.processing_colpali.ColPaliProcessor | from ...feature_extraction_utils import BatchFeature
from ...image_utils import ImageInput, make_flat_list_of_images
from ...tokenization_utils_base import AddedToken, PreTokenizedInput, TextInput
from ...processing_utils import MultiModalData, ProcessingKwargs, ProcessorMixin, Unpack
from typing import Optional, Union... |
class ColPaliProcessor(ProcessorMixin):
'''
Constructs a ColPali processor which wraps a PaliGemmaProcessor and special methods to process images and queries, as
well as to compute the late-interaction retrieval score.
[`ColPaliProcessor`] offers all the functionalities of [`PaliGemmaProcessor`]. See t... | 9 | 7 | 34 | 5 | 17 | 12 | 4 | 0.78 | 1 | 11 | 2 | 0 | 9 | 2 | 9 | 26 | 343 | 59 | 161 | 70 | 121 | 125 | 99 | 40 | 89 | 16 | 2 | 2 | 35 |
1,333 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/colpali/processing_colpali.py | transformers.models.colpali.processing_colpali.ColPaliProcessorKwargs | from ...processing_utils import MultiModalData, ProcessingKwargs, ProcessorMixin, Unpack
class ColPaliProcessorKwargs(ProcessingKwargs, total=False):
_defaults = {'text_kwargs': {'padding': 'longest'}, 'images_kwargs': {'data_format': 'channels_first', 'do_convert_rgb': True}, 'common_kwargs': {'return_tensors': '... |
class ColPaliProcessorKwargs(ProcessingKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 0 | 11 | 2 | 10 | 0 | 2 | 2 | 1 | 0 | 3 | 0 | 0 |
1,334 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/configuration_conditional_detr.py | transformers.models.conditional_detr.configuration_conditional_detr.ConditionalDetrConfig | from ...utils.backbone_utils import verify_backbone_config_arguments
from ..auto import CONFIG_MAPPING
from ...configuration_utils import PretrainedConfig
class ConditionalDetrConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`ConditionalDetrModel`]. It is used to i... |
class ConditionalDetrConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`ConditionalDetrModel`]. It is used to instantiate
a Conditional DETR model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the d... | 8 | 1 | 36 | 1 | 33 | 2 | 3 | 0.93 | 1 | 3 | 0 | 0 | 3 | 35 | 3 | 3 | 223 | 13 | 109 | 84 | 65 | 101 | 58 | 44 | 54 | 6 | 1 | 2 | 8 |
1,335 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/configuration_conditional_detr.py | transformers.models.conditional_detr.configuration_conditional_detr.ConditionalDetrOnnxConfig | from ...onnx import OnnxConfig
from collections import OrderedDict
from collections.abc import Mapping
from packaging import version
class ConditionalDetrOnnxConfig(OnnxConfig):
torch_onnx_minimum_version = version.parse('1.11')
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
return... |
class ConditionalDetrOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def atol_for_validation(self) -> float:
pass
@property
def default_onnx_opset(self) -> int:
pass | 7 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 4 | 0 | 0 | 3 | 0 | 3 | 3 | 19 | 3 | 16 | 8 | 9 | 0 | 8 | 5 | 4 | 1 | 1 | 0 | 3 |
1,336 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/feature_extraction_conditional_detr.py | transformers.models.conditional_detr.feature_extraction_conditional_detr.ConditionalDetrFeatureExtractor | from ...utils.import_utils import requires
import warnings
from .image_processing_conditional_detr import ConditionalDetrImageProcessor
@requires(backends=('vision',))
class ConditionalDetrFeatureExtractor(ConditionalDetrImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn('The clas... | @requires(backends=('vision',))
class ConditionalDetrFeatureExtractor(ConditionalDetrImageProcessor):
def __init__(self, *args, **kwargs) -> None:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 37 | 8 | 0 | 8 | 2 | 6 | 0 | 4 | 2 | 2 | 1 | 4 | 0 | 1 |
1,337 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/image_processing_conditional_detr.py | transformers.models.conditional_detr.image_processing_conditional_detr.ConditionalDetrImageProcessor | from ...image_processing_utils import BaseImageProcessor, get_size_dict
from ...feature_extraction_utils import BatchFeature
import pathlib
from typing import Any, Optional, Union
import numpy as np
from collections.abc import Iterable
from ...utils.import_utils import requires
from ...image_utils import IMAGENET_DEFAU... | @requires(backends=('vision',))
class ConditionalDetrImageProcessor(BaseImageProcessor):
'''
Constructs a Conditional Detr image processor.
Args:
format (`str`, *optional*, defaults to `"coco_detection"`):
Data format of the annotations. One of "coco_detection" or "coco_panoptic".
... | 19 | 16 | 60 | 5 | 37 | 19 | 6 | 0.62 | 1 | 18 | 4 | 1 | 15 | 13 | 16 | 36 | 1,050 | 95 | 594 | 235 | 466 | 371 | 291 | 124 | 274 | 32 | 3 | 3 | 96 |
1,338 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrAttention | import torch
from torch import Tensor, nn
from typing import Optional, Union
class ConditionalDetrAttention(nn.Module):
"""
Cross-Attention used in Conditional DETR 'Conditional DETR for Fast Training Convergence' paper.
The key q_proj, k_proj, v_proj are defined outside the attention. This attention allo... |
class ConditionalDetrAttention(nn.Module):
'''
Cross-Attention used in Conditional DETR 'Conditional DETR for Fast Training Convergence' paper.
The key q_proj, k_proj, v_proj are defined outside the attention. This attention allows the dim of q, k to be
different to v.
'''
def __init__(self, e... | 5 | 2 | 26 | 4 | 20 | 2 | 3 | 0.16 | 1 | 6 | 0 | 0 | 4 | 8 | 4 | 14 | 115 | 21 | 81 | 36 | 62 | 13 | 52 | 22 | 47 | 6 | 1 | 2 | 11 |
1,339 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrConvEncoder | import torch
from torch import Tensor, nn
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
from ...utils.backbone_utils import load_backbone
class ConditionalDetrConvEncoder(nn.Module):
"""
Convolutional backbone, using either the AutoBackbone API or one from the ... |
class ConditionalDetrConvEncoder(nn.Module):
'''
Convolutional backbone, using either the AutoBackbone API or one from the timm library.
nn.BatchNorm2d layers are replaced by ConditionalDetrFrozenBatchNorm2d as defined above.
'''
def __init__(self, config):
pass
def forward(self, pixe... | 3 | 1 | 31 | 3 | 25 | 3 | 8 | 0.2 | 1 | 4 | 0 | 0 | 2 | 3 | 2 | 12 | 70 | 10 | 50 | 16 | 47 | 10 | 37 | 16 | 34 | 12 | 1 | 4 | 15 |
1,340 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrConvModel | from torch import Tensor, nn
class ConditionalDetrConvModel(nn.Module):
"""
This module adds 2D position embeddings to all intermediate feature maps of the convolutional encoder.
"""
def __init__(self, conv_encoder, position_embedding):
super().__init__()
self.conv_encoder = conv_encod... |
class ConditionalDetrConvModel(nn.Module):
'''
This module adds 2D position embeddings to all intermediate feature maps of the convolutional encoder.
'''
def __init__(self, conv_encoder, position_embedding):
pass
def forward(self, pixel_values, pixel_mask):
pass | 3 | 1 | 7 | 1 | 5 | 1 | 2 | 0.45 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 19 | 3 | 11 | 8 | 8 | 5 | 11 | 8 | 8 | 2 | 1 | 1 | 3 |
1,341 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrDecoder | import torch
from torch import Tensor, nn
from .configuration_conditional_detr import ConditionalDetrConfig
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask
class ConditionalDetrDecoder(ConditionalDetrPreTrainedModel):
"""
Transformer decoder consisting of *config.decoder_layers* layers. Each... |
class ConditionalDetrDecoder(ConditionalDetrPreTrainedModel):
'''
Transformer decoder consisting of *config.decoder_layers* layers. Each layer is a [`ConditionalDetrDecoderLayer`].
The decoder updates the query embeddings through multiple self-attention and cross-attention layers.
Some small tweaks for... | 3 | 2 | 92 | 11 | 59 | 22 | 12 | 0.45 | 1 | 8 | 4 | 0 | 2 | 7 | 2 | 3 | 199 | 28 | 119 | 38 | 105 | 53 | 61 | 27 | 58 | 22 | 2 | 3 | 24 |
1,342 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrDecoderLayer | from typing import Optional, Union
from ...activations import ACT2FN
from ...modeling_layers import GradientCheckpointingLayer
import torch
from .configuration_conditional_detr import ConditionalDetrConfig
from torch import Tensor, nn
class ConditionalDetrDecoderLayer(GradientCheckpointingLayer):
def __init__(sel... |
class ConditionalDetrDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: ConditionalDetrConfig):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, object_queries: Optional[torch.Tensor]=None, query_position_embeddings: Optional[torch.Ten... | 3 | 1 | 84 | 11 | 55 | 18 | 3 | 0.32 | 1 | 5 | 2 | 0 | 2 | 23 | 2 | 12 | 169 | 23 | 111 | 52 | 97 | 36 | 78 | 41 | 75 | 4 | 1 | 1 | 5 |
1,343 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrDecoderOutput | import torch
from dataclasses import dataclass
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithCrossAttentions, Seq2SeqModelOutput
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
@dataclass
@auto_docstring(custom_int... | @dataclass
@auto_docstring(custom_intro='\n Base class for outputs of the Conditional DETR decoder. This class adds one attribute to\n BaseModelOutputWithCrossAttentions, namely an optional stack of intermediate decoder activations, i.e. the output\n of each decoder layer, each of them gone through a layernorm... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 8.67 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 31 | 2 | 3 | 3 | 2 | 26 | 3 | 3 | 2 | 0 | 2 | 0 | 0 |
1,344 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrEncoder | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithCrossAttentions, Seq2SeqModelOutput
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask
from .configuration_conditional_detr import ConditionalDetrConfig
from torch import Tensor, nn
import torch
class ConditionalDetrEncoder(Conditional... |
class ConditionalDetrEncoder(ConditionalDetrPreTrainedModel):
'''
Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a
[`ConditionalDetrEncoderLayer`].
The encoder updates the flattened feature map through multiple self-attention layers.
Small tweak for C... | 3 | 2 | 48 | 9 | 27 | 14 | 8 | 0.67 | 1 | 7 | 3 | 0 | 2 | 3 | 2 | 3 | 112 | 23 | 54 | 21 | 43 | 36 | 36 | 13 | 33 | 15 | 2 | 3 | 16 |
1,345 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrEncoderLayer | from .configuration_conditional_detr import ConditionalDetrConfig
from torch import Tensor, nn
import torch
from typing import Optional, Union
from ...activations import ACT2FN
class ConditionalDetrEncoderLayer(nn.Module):
def __init__(self, config: ConditionalDetrConfig):
super().__init__()
self.... |
class ConditionalDetrEncoderLayer(nn.Module):
def __init__(self, config: ConditionalDetrConfig):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, object_queries: Optional[torch.Tensor]=None, output_attentions: bool=False):
'''
Args:
hidden_... | 3 | 1 | 34 | 4 | 24 | 6 | 3 | 0.25 | 1 | 5 | 2 | 0 | 2 | 9 | 2 | 12 | 69 | 9 | 48 | 22 | 39 | 12 | 33 | 16 | 30 | 4 | 1 | 2 | 5 |
1,346 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrForObjectDetection | import torch
from typing import Optional, Union
from torch import Tensor, nn
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
from .configuration_conditional_detr import ConditionalDetrConfig
@auto_docstring(custom_intro='\n Conditional DETR Model (consisting of a back... | null | 7 | 1 | 48 | 6 | 27 | 15 | 4 | 0.54 | 1 | 9 | 4 | 0 | 3 | 3 | 3 | 4 | 151 | 21 | 85 | 35 | 66 | 46 | 40 | 21 | 36 | 10 | 2 | 3 | 12 |
1,347 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrForSegmentation | from .configuration_conditional_detr import ConditionalDetrConfig
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithCrossAttentions, Seq2SeqModelOutput
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
import torch
from typing import Optional, Union
@auto... | null | 5 | 1 | 100 | 17 | 54 | 29 | 7 | 0.51 | 1 | 9 | 6 | 0 | 2 | 3 | 2 | 3 | 203 | 35 | 111 | 43 | 94 | 57 | 50 | 30 | 47 | 13 | 2 | 2 | 14 |
1,348 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrFrozenBatchNorm2d | import torch
from torch import Tensor, nn
class ConditionalDetrFrozenBatchNorm2d(nn.Module):
"""
BatchNorm2d where the batch statistics and the affine parameters are fixed.
Copy-paste from torchvision.misc.ops with added eps before rqsrt, without which any other models than
torchvision.models.resnet[1... |
class ConditionalDetrFrozenBatchNorm2d(nn.Module):
'''
BatchNorm2d where the batch statistics and the affine parameters are fixed.
Copy-paste from torchvision.misc.ops with added eps before rqsrt, without which any other models than
torchvision.models.resnet[18,34,50,101] produce nans.
'''
def... | 4 | 1 | 9 | 0 | 8 | 1 | 1 | 0.28 | 1 | 1 | 0 | 0 | 3 | 0 | 3 | 13 | 37 | 5 | 25 | 13 | 19 | 7 | 21 | 11 | 17 | 2 | 1 | 1 | 4 |
1,349 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrLearnedPositionEmbedding | from torch import Tensor, nn
import torch
class ConditionalDetrLearnedPositionEmbedding(nn.Module):
"""
This module learns positional embeddings up to a fixed maximum size.
"""
def __init__(self, embedding_dim=256):
super().__init__()
self.row_embeddings = nn.Embedding(50, embedding_di... |
class ConditionalDetrLearnedPositionEmbedding(nn.Module):
'''
This module learns positional embeddings up to a fixed maximum size.
'''
def __init__(self, embedding_dim=256):
pass
def forward(self, pixel_values, pixel_mask=None):
pass | 3 | 1 | 8 | 0 | 8 | 0 | 1 | 0.19 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 21 | 2 | 16 | 11 | 13 | 3 | 16 | 11 | 13 | 1 | 1 | 0 | 2 |
1,350 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrMHAttentionMap | from torch import Tensor, nn
import torch
from typing import Optional, Union
class ConditionalDetrMHAttentionMap(nn.Module):
"""This is a 2D attention module, which only returns the attention softmax (no multiplication by value)"""
def __init__(self, query_dim, hidden_dim, num_heads, dropout=0.0, bias=True, s... |
class ConditionalDetrMHAttentionMap(nn.Module):
'''This is a 2D attention module, which only returns the attention softmax (no multiplication by value)'''
def __init__(self, query_dim, hidden_dim, num_heads, dropout=0.0, bias=True, std=None):
pass
def forward(self, q, k, mask: Optional[Tensor]=No... | 3 | 1 | 11 | 2 | 10 | 0 | 2 | 0.05 | 1 | 3 | 0 | 0 | 2 | 6 | 2 | 12 | 26 | 5 | 20 | 12 | 17 | 1 | 20 | 12 | 17 | 2 | 1 | 1 | 3 |
1,351 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrMLPPredictionHead | from torch import Tensor, nn
class ConditionalDetrMLPPredictionHead(nn.Module):
"""
Very simple multi-layer perceptron (MLP, also called FFN), used to predict the normalized center coordinates,
height and width of a bounding box w.r.t. an image.
Copied from https://github.com/facebookresearch/detr/blo... |
class ConditionalDetrMLPPredictionHead(nn.Module):
'''
Very simple multi-layer perceptron (MLP, also called FFN), used to predict the normalized center coordinates,
height and width of a bounding box w.r.t. an image.
Copied from https://github.com/facebookresearch/detr/blob/master/models/detr.py
''... | 3 | 1 | 5 | 0 | 5 | 0 | 2 | 0.5 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 19 | 4 | 10 | 7 | 7 | 5 | 10 | 7 | 7 | 3 | 1 | 1 | 4 |
1,352 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrMaskHeadSmallConv | import torch
from torch import Tensor, nn
class ConditionalDetrMaskHeadSmallConv(nn.Module):
"""
Simple convolutional head, using group norm. Upsampling is done using a FPN approach
"""
def __init__(self, dim, fpn_dims, context_dim):
super().__init__()
if dim % 8 != 0:
rais... |
class ConditionalDetrMaskHeadSmallConv(nn.Module):
'''
Simple convolutional head, using group norm. Upsampling is done using a FPN approach
'''
def __init__(self, dim, fpn_dims, context_dim):
pass
def forward(self, x: Tensor, bbox_mask: Tensor, fpns: list[Tensor]):
pass | 3 | 1 | 36 | 6 | 29 | 2 | 4 | 0.1 | 1 | 3 | 0 | 0 | 2 | 15 | 2 | 12 | 78 | 13 | 59 | 21 | 56 | 6 | 56 | 21 | 53 | 4 | 1 | 2 | 8 |
1,353 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrModel | from typing import Optional, Union
import torch
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithCrossAttentions, Seq2SeqModelOutput
from torch import Tensor, nn
from .configuration_conditional_detr import... | null | 8 | 1 | 25 | 4 | 15 | 6 | 3 | 0.4 | 1 | 10 | 7 | 0 | 6 | 5 | 6 | 7 | 160 | 30 | 93 | 39 | 73 | 37 | 46 | 27 | 39 | 11 | 2 | 1 | 18 |
1,354 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrObjectDetectionOutput | from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
import torch
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro='\n Output type of [`ConditionalDetrForObjectDetection`].\n ')
class ConditionalDetrObjectDetec... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`ConditionalDetrForObjectDetection`].\n ')
class ConditionalDetrObjectDetectionOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` are provided)):
Total loss as a linear combination of a ... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.46 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 60 | 2 | 13 | 13 | 12 | 45 | 13 | 13 | 12 | 0 | 1 | 0 | 0 |
1,355 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrPreTrainedModel | from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
from .configuration_conditional_detr import ConditionalDetrConfig
from ...modeling_utils import PreTrainedModel
from torch import Tensor, nn
@auto_docstring
class ConditionalDetrPreTrainedModel(PreTrainedModel):
config:... | @auto_docstring
class ConditionalDetrPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 22 | 1 | 19 | 2 | 7 | 0.08 | 1 | 2 | 2 | 5 | 1 | 0 | 1 | 1 | 28 | 2 | 24 | 8 | 22 | 2 | 22 | 8 | 20 | 7 | 1 | 2 | 7 |
1,356 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrSegmentationOutput | from ...utils import ModelOutput, auto_docstring, is_timm_available, logging, requires_backends
import torch
from typing import Optional, Union
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro='\n Output type of [`ConditionalDetrForSegmentation`].\n ')
class ConditionalDetrSegmentationOu... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`ConditionalDetrForSegmentation`].\n ')
class ConditionalDetrSegmentationOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` are provided)):
Total loss as a linear combination of a negati... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.64 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 67 | 2 | 14 | 14 | 13 | 51 | 14 | 14 | 13 | 0 | 1 | 0 | 0 |
1,357 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.ConditionalDetrSinePositionEmbedding | import math
from torch import Tensor, nn
import torch
class ConditionalDetrSinePositionEmbedding(nn.Module):
"""
This is a more standard version of the position embedding, very similar to the one used by the Attention is all you
need paper, generalized to work on images.
"""
def __init__(self, emb... |
class ConditionalDetrSinePositionEmbedding(nn.Module):
'''
This is a more standard version of the position embedding, very similar to the one used by the Attention is all you
need paper, generalized to work on images.
'''
def __init__(self, embedding_dim=64, temperature=10000, normalize=False, sca... | 3 | 1 | 14 | 1 | 13 | 0 | 3 | 0.15 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 35 | 4 | 27 | 13 | 24 | 4 | 27 | 13 | 24 | 3 | 1 | 1 | 6 |
1,358 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/conditional_detr/modeling_conditional_detr.py | transformers.models.conditional_detr.modeling_conditional_detr.MLP | from torch import Tensor, nn
class MLP(nn.Module):
"""
Very simple multi-layer perceptron (MLP, also called FFN), used to predict the normalized center coordinates,
height and width of a bounding box w.r.t. an image.
Copied from https://github.com/facebookresearch/detr/blob/master/models/detr.py
... |
class MLP(nn.Module):
'''
Very simple multi-layer perceptron (MLP, also called FFN), used to predict the normalized center coordinates,
height and width of a bounding box w.r.t. an image.
Copied from https://github.com/facebookresearch/detr/blob/master/models/detr.py
'''
def __init__(self, inp... | 3 | 1 | 5 | 0 | 5 | 0 | 2 | 0.5 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 19 | 4 | 10 | 7 | 7 | 5 | 10 | 7 | 7 | 3 | 1 | 1 | 4 |
1,359 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/configuration_convbert.py | transformers.models.convbert.configuration_convbert.ConvBertConfig | from ...configuration_utils import PretrainedConfig
class ConvBertConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`ConvBertModel`]. It is used to instantiate an
ConvBERT model according to the specified arguments, defining the model architecture. Instantiating... |
class ConvBertConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`ConvBertModel`]. It is used to instantiate an
ConvBERT 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.08 | 1 | 1 | 0 | 0 | 1 | 17 | 1 | 1 | 113 | 11 | 49 | 43 | 24 | 53 | 21 | 20 | 19 | 1 | 1 | 0 | 1 |
1,360 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/configuration_convbert.py | transformers.models.convbert.configuration_convbert.ConvBertOnnxConfig | from collections.abc import Mapping
from collections import OrderedDict
from ...onnx import OnnxConfig
class ConvBertOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
if self.task == 'multiple-choice':
dynamic_axis = {0: 'batch', 1: 'choice', 2: 'sequen... |
class ConvBertOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass | 3 | 0 | 12 | 0 | 12 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 1 | 14 | 0 | 14 | 4 | 11 | 0 | 6 | 3 | 4 | 2 | 1 | 1 | 2 |
1,361 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.ConvBertAttention | import torch
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from torch import nn
from typing import Callable, Optional, Union
class ConvBertAttention(nn.Module):
def __init__(self, config):
super().__init__()
self.self = ConvBertSelfAtt... |
class ConvBertAttention(nn.Module):
def __init__(self, config):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.Tens... | 4 | 0 | 13 | 1 | 12 | 1 | 1 | 0.08 | 1 | 6 | 2 | 0 | 3 | 3 | 3 | 13 | 43 | 4 | 37 | 18 | 26 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
1,362 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.ConvBertClassificationHead | from torch import nn
from ...activations import ACT2FN, get_activation
import torch
class ConvBertClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
... |
class ConvBertClassificationHead(nn.Module):
'''Head for sentence-level classification tasks.'''
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, **kwargs) -> torch.Tensor:
pass | 3 | 1 | 9 | 1 | 9 | 1 | 2 | 0.11 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 22 | 3 | 18 | 9 | 15 | 2 | 16 | 9 | 13 | 2 | 1 | 0 | 3 |
1,363 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.ConvBertEmbeddings | import torch
from torch import nn
from typing import Callable, Optional, Union
class ConvBertEmbeddings(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
super().__init__()
self.word_embeddings = nn.Embedding(config.vocab_size... |
class ConvBertEmbeddings(nn.Module):
'''Construct the embeddings from word, position and token_type embeddings.'''
def __init__(self, config):
pass
def forward(self, input_ids: Optional[torch.LongTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids: Optional[torch.LongTenso... | 3 | 1 | 27 | 3 | 21 | 3 | 4 | 0.16 | 1 | 1 | 0 | 0 | 2 | 5 | 2 | 12 | 58 | 8 | 43 | 21 | 34 | 7 | 31 | 15 | 28 | 6 | 1 | 2 | 7 |
1,364 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.ConvBertEncoder | from typing import Callable, Optional, Union
from torch import nn
import torch
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
class ConvBertEncoder(nn.Module):
def __init__... |
class ConvBertEncoder(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.Tensor]=None, encoder_attention_mask: Optional[torch.T... | 3 | 0 | 33 | 2 | 31 | 0 | 7 | 0 | 1 | 8 | 2 | 0 | 2 | 3 | 2 | 12 | 67 | 5 | 62 | 22 | 49 | 0 | 27 | 12 | 24 | 12 | 1 | 3 | 13 |
1,365 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.ConvBertForMaskedLM | from ...utils import auto_docstring, logging
from torch import nn
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch
from typing import Callable, Optional, Union
@auto_... | @auto_docstring
class ConvBertForMaskedLM(ConvBertPreTrainedModel):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, word_embeddings):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, a... | 7 | 1 | 17 | 2 | 13 | 2 | 2 | 0.15 | 1 | 5 | 3 | 0 | 4 | 3 | 4 | 5 | 78 | 11 | 59 | 28 | 36 | 9 | 26 | 15 | 21 | 5 | 2 | 1 | 8 |
1,366 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.ConvBertForMultipleChoice | from typing import Callable, Optional, Union
from ...utils import auto_docstring, logging
from torch import nn
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch.nn import... | @auto_docstring
class ConvBertForMultipleChoice(ConvBertPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids: O... | 5 | 1 | 37 | 5 | 29 | 4 | 6 | 0.1 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 3 | 84 | 10 | 67 | 30 | 44 | 7 | 28 | 15 | 25 | 11 | 2 | 1 | 12 |
1,367 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.ConvBertForQuestionAnswering | from torch import nn
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
import torch
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...utils import auto_docst... | @auto_docstring
class ConvBertForQuestionAnswering(ConvBertPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids... | 5 | 0 | 41 | 5 | 30 | 7 | 4 | 0.19 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 3 | 90 | 10 | 67 | 30 | 45 | 13 | 32 | 16 | 29 | 7 | 2 | 2 | 8 |
1,368 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.ConvBertForSequenceClassification | import torch
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from typing import Callable, Optional, Union
from ...utils import auto_docstring, logging
from torch.nn import BCEWith... | @auto_docstring(custom_intro='\n ConvBERT Model transformer with a sequence classification/regression head on top (a linear layer on top of the\n pooled output) e.g. for GLUE tasks.\n ')
class ConvBertForSequenceClassification(ConvBertPreTrainedModel):
def __init__(self, config):
pass
@auto_do... | 5 | 1 | 39 | 4 | 32 | 4 | 7 | 0.1 | 1 | 6 | 3 | 0 | 2 | 4 | 2 | 3 | 86 | 8 | 71 | 26 | 50 | 7 | 33 | 13 | 30 | 12 | 2 | 3 | 13 |
1,369 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.ConvBertForTokenClassification | import torch
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Callable, Optional, Union
from ...utils import auto_docstring, logging
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceCl... | @auto_docstring
class ConvBertForTokenClassification(ConvBertPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_i... | 5 | 1 | 32 | 4 | 26 | 3 | 4 | 0.09 | 1 | 4 | 2 | 0 | 2 | 4 | 2 | 3 | 72 | 9 | 58 | 27 | 37 | 5 | 23 | 14 | 20 | 5 | 2 | 1 | 7 |
1,370 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.ConvBertGeneratorPredictions | import torch
from torch import nn
from ...activations import ACT2FN, get_activation
class ConvBertGeneratorPredictions(nn.Module):
"""Prediction module for the generator, made up of two dense layers."""
def __init__(self, config):
super().__init__()
self.activation = get_activation('gelu')
... |
class ConvBertGeneratorPredictions(nn.Module):
'''Prediction module for the generator, made up of two dense layers.'''
def __init__(self, config):
pass
def forward(self, generator_hidden_states: torch.FloatTensor) -> torch.FloatTensor:
pass | 3 | 1 | 6 | 1 | 5 | 0 | 1 | 0.09 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 16 | 4 | 11 | 7 | 8 | 1 | 11 | 7 | 8 | 1 | 1 | 0 | 2 |
1,371 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.ConvBertIntermediate | import torch
from ...activations import ACT2FN, get_activation
from torch import nn
class ConvBertIntermediate(nn.Module):
def __init__(self, config):
super().__init__()
if config.num_groups == 1:
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
else:
... |
class ConvBertIntermediate(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 8 | 0 | 8 | 0 | 2 | 0 | 1 | 4 | 1 | 0 | 2 | 2 | 2 | 12 | 18 | 1 | 17 | 5 | 14 | 0 | 13 | 5 | 10 | 3 | 1 | 1 | 4 |
1,372 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.ConvBertLayer | import torch
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from typing import Callable, Optional, Union
from ...modeling_layers import GradientCheckpointingLayer
class ConvBertLayer(GradientCheckpointingLayer):
def __init__(self, config):
supe... |
class ConvBertLayer(GradientCheckpointingLayer):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.Tensor]=None, encoder_attention_mask: O... | 4 | 0 | 19 | 1 | 18 | 1 | 2 | 0.04 | 1 | 8 | 3 | 0 | 3 | 8 | 3 | 13 | 59 | 4 | 55 | 27 | 43 | 2 | 31 | 19 | 27 | 3 | 1 | 2 | 7 |
1,373 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.ConvBertModel | from torch import nn
from ...utils import auto_docstring, logging
import torch
from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
@auto_... | @auto_docstring
class ConvBertModel(ConvBertPreTrainedModel):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
def _prune_heads(self, heads_to_prune):
'''
Prunes heads of the model. heads_to_prun... | 8 | 1 | 17 | 2 | 14 | 1 | 4 | 0.07 | 1 | 6 | 3 | 0 | 5 | 4 | 5 | 6 | 94 | 14 | 75 | 30 | 52 | 5 | 43 | 18 | 37 | 12 | 2 | 2 | 18 |
1,374 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.ConvBertOutput | import torch
from torch import nn
class ConvBertOutput(nn.Module):
def __init__(self, config):
super().__init__()
if config.num_groups == 1:
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
else:
self.dense = GroupedLinearLayer(input_size=config.... |
class ConvBertOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 8 | 0 | 8 | 0 | 2 | 0 | 1 | 3 | 1 | 0 | 2 | 3 | 2 | 12 | 17 | 1 | 16 | 6 | 13 | 0 | 13 | 6 | 10 | 2 | 1 | 1 | 3 |
1,375 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.ConvBertPreTrainedModel | from ...modeling_utils import PreTrainedModel
from torch import nn
from .configuration_convbert import ConvBertConfig
from ...utils import auto_docstring, logging
@auto_docstring
class ConvBertPreTrainedModel(PreTrainedModel):
config: ConvBertConfig
base_model_prefix = 'convbert'
supports_gradient_checkpoi... | @auto_docstring
class ConvBertPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.41 | 1 | 0 | 0 | 6 | 1 | 0 | 1 | 1 | 26 | 2 | 17 | 6 | 15 | 7 | 15 | 6 | 13 | 6 | 1 | 2 | 6 |
1,376 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.ConvBertPredictionHeadTransform | from ...activations import ACT2FN, get_activation
import torch
from torch import nn
class ConvBertPredictionHeadTransform(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 ConvBertPredictionHeadTransform(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 |
1,377 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.ConvBertSelfAttention | import torch
from typing import Callable, Optional, Union
import math
from torch import nn
class ConvBertSelfAttention(nn.Module):
def __init__(self, config):
super().__init__()
if config.hidden_size % config.num_attention_heads != 0 and (not hasattr(config, 'embedding_size')):
raise V... |
class ConvBertSelfAttention(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.Tensor]=None, output_attentions: Optional[bool]=... | 3 | 0 | 41 | 6 | 31 | 3 | 3 | 0.11 | 1 | 6 | 1 | 0 | 3 | 13 | 3 | 13 | 126 | 21 | 95 | 43 | 84 | 10 | 69 | 36 | 65 | 5 | 1 | 1 | 10 |
1,378 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.ConvBertSelfOutput | import torch
from torch import nn
class ConvBertSelfOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropou... |
class ConvBertSelfOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
1,379 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.GroupedLinearLayer | from torch import nn
import torch
class GroupedLinearLayer(nn.Module):
def __init__(self, input_size, output_size, num_groups):
super().__init__()
self.input_size = input_size
self.output_size = output_size
self.num_groups = num_groups
self.group_in_dim = self.input_size //... |
class GroupedLinearLayer(nn.Module):
def __init__(self, input_size, output_size, num_groups):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 9 | 0 | 9 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 2 | 7 | 2 | 12 | 20 | 1 | 19 | 12 | 16 | 0 | 19 | 12 | 16 | 1 | 1 | 0 | 2 |
1,380 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/modeling_convbert.py | transformers.models.convbert.modeling_convbert.SeparableConv1D | import torch
from torch import nn
class SeparableConv1D(nn.Module):
"""This class implements separable convolution, i.e. a depthwise and a pointwise layer"""
def __init__(self, config, input_filters, output_filters, kernel_size, **kwargs):
super().__init__()
self.depthwise = nn.Conv1d(input_fi... |
class SeparableConv1D(nn.Module):
'''This class implements separable convolution, i.e. a depthwise and a pointwise layer'''
def __init__(self, config, input_filters, output_filters, kernel_size, **kwargs):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 1 | 10 | 1 | 10 | 0 | 1 | 0.05 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 24 | 3 | 20 | 7 | 17 | 1 | 13 | 7 | 10 | 1 | 1 | 0 | 2 |
1,381 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/tokenization_convbert.py | transformers.models.convbert.tokenization_convbert.ConvBertTokenizer | import collections
import os
from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
from typing import Optional
class ConvBertTokenizer(PreTrainedTokenizer):
"""
Construct a ConvBERT tokenizer. Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokeni... |
class ConvBertTokenizer(PreTrainedTokenizer):
'''
Construct a ConvBERT tokenizer. Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.
Args:
vocab... | 14 | 6 | 15 | 1 | 10 | 4 | 2 | 0.72 | 1 | 9 | 2 | 0 | 12 | 5 | 12 | 101 | 236 | 29 | 121 | 53 | 85 | 87 | 65 | 29 | 52 | 6 | 3 | 3 | 27 |
1,382 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convbert/tokenization_convbert_fast.py | transformers.models.convbert.tokenization_convbert_fast.ConvBertTokenizerFast | from ...tokenization_utils_fast import PreTrainedTokenizerFast
from tokenizers import normalizers
from .tokenization_convbert import ConvBertTokenizer
from typing import Optional
import json
class ConvBertTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" ConvBERT tokenizer (backed by HuggingFace's... |
class ConvBertTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" ConvBERT tokenizer (backed by HuggingFace's *tokenizers* library). Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should
refer to this superclass for... | 4 | 2 | 24 | 3 | 14 | 7 | 2 | 1.12 | 1 | 4 | 0 | 0 | 4 | 1 | 4 | 92 | 141 | 18 | 58 | 29 | 38 | 65 | 27 | 14 | 22 | 2 | 3 | 1 | 7 |
1,383 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convnext/configuration_convnext.py | transformers.models.convnext.configuration_convnext.ConvNextConfig | from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices
from ...configuration_utils import PretrainedConfig
class ConvNextConfig(BackboneConfigMixin, PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`ConvNextModel`]. It is used ... |
class ConvNextConfig(BackboneConfigMixin, PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`ConvNextModel`]. It is used to instantiate an
ConvNeXT model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the d... | 2 | 1 | 34 | 1 | 33 | 0 | 3 | 1.4 | 2 | 2 | 0 | 0 | 1 | 14 | 1 | 6 | 93 | 9 | 35 | 32 | 17 | 49 | 17 | 16 | 15 | 3 | 1 | 0 | 3 |
1,384 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convnext/configuration_convnext.py | transformers.models.convnext.configuration_convnext.ConvNextOnnxConfig | from collections.abc import Mapping
from collections import OrderedDict
from packaging import version
from ...onnx import OnnxConfig
class ConvNextOnnxConfig(OnnxConfig):
torch_onnx_minimum_version = version.parse('1.11')
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
return Ordere... |
class ConvNextOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def atol_for_validation(self) -> float:
pass | 5 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 4 | 0 | 0 | 2 | 0 | 2 | 2 | 14 | 2 | 12 | 6 | 7 | 0 | 6 | 4 | 3 | 1 | 1 | 0 | 2 |
1,385 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convnext/feature_extraction_convnext.py | transformers.models.convnext.feature_extraction_convnext.ConvNextFeatureExtractor | import warnings
from ...utils.import_utils import requires
from .image_processing_convnext import ConvNextImageProcessor
@requires(backends=('vision',))
class ConvNextFeatureExtractor(ConvNextImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn('The class ConvNextFeatureExtractor is... | @requires(backends=('vision',))
class ConvNextFeatureExtractor(ConvNextImageProcessor):
def __init__(self, *args, **kwargs) -> None:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 24 | 8 | 0 | 8 | 2 | 6 | 0 | 4 | 2 | 2 | 1 | 4 | 0 | 1 |
1,386 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convnext/image_processing_convnext.py | transformers.models.convnext.image_processing_convnext.ConvNextImageProcessor | from typing import Optional, Union
import numpy as np
from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import center_crop, get_resize_output_image_size, resize, to_channel_dimension_format
from ...utils.import_utils import requires
from ...utils import Tenso... | @requires(backends=('vision',))
class ConvNextImageProcessor(BaseImageProcessor):
'''
Constructs a ConvNeXT image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Controls whether to resize the image's (height, width) dimensions to the specified `size`. Can be overrid... | 6 | 3 | 76 | 5 | 47 | 24 | 8 | 0.74 | 1 | 8 | 2 | 1 | 3 | 9 | 3 | 23 | 270 | 21 | 143 | 55 | 102 | 106 | 55 | 18 | 51 | 16 | 3 | 1 | 24 |
1,387 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convnext/image_processing_convnext_fast.py | transformers.models.convnext.image_processing_convnext_fast.ConvNextImageProcessorFast | from ...image_processing_utils_fast import BaseImageProcessorFast, DefaultFastImageProcessorKwargs, group_images_by_shape, reorder_images
from ...utils import TensorType, auto_docstring, is_torchvision_v2_available
import torch
from ...image_processing_utils import BatchFeature
from ...image_transforms import get_resiz... | @auto_docstring
class ConvNextImageProcessorFast(BaseImageProcessorFast):
def __init__(self, **kwargs: Unpack[ConvNextFastImageProcessorKwargs]):
pass
@auto_docstring
def preprocess(self, images: ImageInput, **kwargs: Unpack[ConvNextFastImageProcessorKwargs]) -> BatchFeature:
pass
def ... | 7 | 1 | 27 | 2 | 19 | 6 | 3 | 0.25 | 1 | 10 | 4 | 0 | 4 | 0 | 4 | 38 | 131 | 10 | 97 | 57 | 60 | 24 | 44 | 25 | 39 | 6 | 4 | 2 | 11 |
1,388 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convnext/modeling_convnext.py | transformers.models.convnext.modeling_convnext.ConvNextBackbone | from ...modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
import torch
from ...utils.backbone_utils import BackboneMixin
from ...utils.generic import can_return_tuple
from typing import Optional
from ...utils import aut... | @auto_docstring(custom_intro='\n ConvNeXt backbone, to be used with frameworks like DETR and MaskFormer.\n ')
class ConvNextBackbone(ConvNextPreTrainedModel, BackboneMixin):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, pixel_values: torch.Tensor, ou... | 6 | 1 | 37 | 7 | 22 | 9 | 6 | 0.37 | 2 | 8 | 4 | 0 | 2 | 4 | 2 | 15 | 78 | 15 | 46 | 21 | 36 | 17 | 29 | 15 | 26 | 9 | 2 | 2 | 11 |
1,389 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convnext/modeling_convnext.py | transformers.models.convnext.modeling_convnext.ConvNextDropPath | from typing import Optional
from torch import nn
import torch
class ConvNextDropPath(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 = drop_... |
class ConvNextDropPath(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 |
1,390 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convnext/modeling_convnext.py | transformers.models.convnext.modeling_convnext.ConvNextEmbeddings | from torch import nn
import torch
class ConvNextEmbeddings(nn.Module):
"""This class is comparable to (and inspired by) the SwinEmbeddings class
found in src/transformers/models/swin/modeling_swin.py.
"""
def __init__(self, config):
super().__init__()
self.patch_embeddings = nn.Conv2d(... |
class ConvNextEmbeddings(nn.Module):
'''This class is comparable to (and inspired by) the SwinEmbeddings class
found in src/transformers/models/swin/modeling_swin.py.
'''
def __init__(self, config):
pass
def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor:
pass | 3 | 1 | 8 | 0 | 8 | 0 | 2 | 0.18 | 1 | 4 | 1 | 0 | 2 | 3 | 2 | 12 | 22 | 2 | 17 | 8 | 14 | 3 | 13 | 8 | 10 | 2 | 1 | 1 | 3 |
1,391 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convnext/modeling_convnext.py | transformers.models.convnext.modeling_convnext.ConvNextEncoder | import torch
from torch import nn
from ...modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from typing import Optional
class ConvNextEncoder(nn.Module):
def __init__(self, config):
super().__init__()
... |
class ConvNextEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, output_hidden_states: Optional[bool]=False) -> BaseModelOutputWithNoAttention:
pass | 3 | 0 | 22 | 3 | 19 | 0 | 5 | 0 | 1 | 7 | 2 | 0 | 2 | 1 | 2 | 12 | 45 | 6 | 39 | 16 | 31 | 0 | 22 | 11 | 19 | 6 | 1 | 2 | 9 |
1,392 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convnext/modeling_convnext.py | transformers.models.convnext.modeling_convnext.ConvNextForImageClassification | from torch import nn
from ...utils.generic import can_return_tuple
from ...utils import auto_docstring, logging
from typing import Optional
from ...modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
import torch
@auto_d... | @auto_docstring(custom_intro='\n ConvNext Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for\n ImageNet.\n ')
class ConvNextForImageClassification(ConvNextPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstri... | 6 | 1 | 33 | 5 | 24 | 4 | 8 | 0.14 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 74 | 10 | 56 | 19 | 40 | 8 | 32 | 12 | 29 | 13 | 2 | 3 | 15 |
1,393 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convnext/modeling_convnext.py | transformers.models.convnext.modeling_convnext.ConvNextLayer | import torch
from ...activations import ACT2FN
from torch import nn
class ConvNextLayer(nn.Module):
"""This corresponds to the `Block` class in the original implementation.
There are two equivalent implementations: [DwConv, LayerNorm (channels_first), Conv, GELU,1x1 Conv]; all in (N, C,
H, W) (2) [DwConv,... |
class ConvNextLayer(nn.Module):
'''This corresponds to the `Block` class in the original implementation.
There are two equivalent implementations: [DwConv, LayerNorm (channels_first), Conv, GELU,1x1 Conv]; all in (N, C,
H, W) (2) [DwConv, Permute to (N, H, W, C), LayerNorm (channels_last), Linear, GELU, Li... | 3 | 1 | 14 | 1 | 13 | 2 | 3 | 0.48 | 1 | 4 | 2 | 0 | 2 | 7 | 2 | 12 | 42 | 6 | 27 | 11 | 24 | 13 | 23 | 11 | 20 | 3 | 1 | 1 | 5 |
1,394 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convnext/modeling_convnext.py | transformers.models.convnext.modeling_convnext.ConvNextLayerNorm | from torch import nn
import torch
class ConvNextLayerNorm(nn.LayerNorm):
"""LayerNorm that supports two data formats: channels_last (default) or channels_first.
The ordering of the dimensions in the inputs. channels_last corresponds to inputs with shape (batch_size, height,
width, channels) while channels_... |
class ConvNextLayerNorm(nn.LayerNorm):
'''LayerNorm that supports two data formats: channels_last (default) or channels_first.
The ordering of the dimensions in the inputs. channels_last corresponds to inputs with shape (batch_size, height,
width, channels) while channels_first corresponds to inputs with s... | 3 | 2 | 11 | 0 | 11 | 0 | 3 | 0.18 | 1 | 3 | 0 | 0 | 2 | 5 | 2 | 12 | 28 | 2 | 22 | 11 | 19 | 4 | 21 | 11 | 18 | 3 | 1 | 1 | 5 |
1,395 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convnext/modeling_convnext.py | transformers.models.convnext.modeling_convnext.ConvNextModel | from torch import nn
from ...utils.generic import can_return_tuple
from ...utils import auto_docstring, logging
import torch
from ...modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from typing import Optional
@auto_d... | @auto_docstring
class ConvNextModel(ConvNextPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, pixel_values: Optional[torch.FloatTensor]=None, output_hidden_states: Optional[bool]=None) -> BaseModelOutputWithPoolingAndNoAttention:
pass | 6 | 0 | 24 | 5 | 17 | 2 | 3 | 0.07 | 1 | 6 | 3 | 0 | 2 | 4 | 2 | 3 | 57 | 11 | 43 | 17 | 27 | 3 | 20 | 11 | 17 | 5 | 2 | 1 | 6 |
1,396 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convnext/modeling_convnext.py | transformers.models.convnext.modeling_convnext.ConvNextPreTrainedModel | from .configuration_convnext import ConvNextConfig
from ...utils import auto_docstring, logging
from torch import nn
from ...modeling_utils import PreTrainedModel
@auto_docstring
class ConvNextPreTrainedModel(PreTrainedModel):
config: ConvNextConfig
base_model_prefix = 'convnext'
main_input_name = 'pixel_v... | @auto_docstring
class ConvNextPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 11 | 0 | 8 | 3 | 4 | 0.54 | 1 | 0 | 0 | 3 | 1 | 0 | 1 | 1 | 22 | 2 | 13 | 6 | 11 | 7 | 12 | 6 | 10 | 4 | 1 | 2 | 4 |
1,397 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convnext/modeling_convnext.py | transformers.models.convnext.modeling_convnext.ConvNextStage | import torch
from torch import nn
class ConvNextStage(nn.Module):
"""ConvNeXT stage, consisting of an optional downsampling layer + multiple residual blocks.
Args:
config ([`ConvNextConfig`]): Model configuration class.
in_channels (`int`): Number of input channels.
out_channels (`int`... |
class ConvNextStage(nn.Module):
'''ConvNeXT stage, consisting of an optional downsampling layer + multiple residual blocks.
Args:
config ([`ConvNextConfig`]): Model configuration class.
in_channels (`int`): Number of input channels.
out_channels (`int`): Number of output channels.
... | 3 | 1 | 9 | 1 | 9 | 0 | 2 | 0.44 | 1 | 5 | 2 | 0 | 2 | 2 | 2 | 12 | 30 | 4 | 18 | 5 | 15 | 8 | 12 | 5 | 9 | 2 | 1 | 1 | 3 |
1,398 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convnextv2/configuration_convnextv2.py | transformers.models.convnextv2.configuration_convnextv2.ConvNextV2Config | from ...configuration_utils import PretrainedConfig
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices
class ConvNextV2Config(BackboneConfigMixin, PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`ConvNextV2Model`]. It is u... |
class ConvNextV2Config(BackboneConfigMixin, PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`ConvNextV2Model`]. It is used to instantiate an
ConvNeXTV2 model according to the specified arguments, defining the model architecture. Instantiating a
configuration with... | 2 | 1 | 32 | 1 | 31 | 0 | 3 | 1.48 | 2 | 2 | 0 | 0 | 1 | 13 | 1 | 6 | 91 | 9 | 33 | 30 | 16 | 49 | 16 | 15 | 14 | 3 | 1 | 0 | 3 |
1,399 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/convnextv2/modeling_convnextv2.py | transformers.models.convnextv2.modeling_convnextv2.ConvNextV2Backbone | from ...utils import auto_docstring, logging
from ...modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from ...utils.backbone_utils import BackboneMixin
import torch
from typing import Optional
from torch import nn
from... | @auto_docstring(custom_intro='\n ConvNeXT V2 backbone, to be used with frameworks like DETR and MaskFormer.\n ')
class ConvNextV2Backbone(ConvNextV2PreTrainedModel, BackboneMixin):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, pixel_values: torch.Ten... | 6 | 1 | 37 | 7 | 22 | 9 | 6 | 0.37 | 2 | 8 | 4 | 0 | 2 | 4 | 2 | 15 | 78 | 15 | 46 | 21 | 36 | 17 | 29 | 15 | 26 | 9 | 2 | 2 | 11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.