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,200 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo/modeling_olmo.py | transformers.models.olmo.modeling_olmo.OlmoMLP | import torch.nn as nn
from ...activations import ACT2FN
class OlmoMLP(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.hidd... |
class OlmoMLP(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 |
4,201 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo/modeling_olmo.py | transformers.models.olmo.modeling_olmo.OlmoModel | from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
import torch.nn as nn
from ...cache_utils import Cache, DynamicCache
from ...processing_utils import Unpack
import torch.nn.functional as F
from ...masking_utils import create_causal_mask
from .configuration_olmo import OlmoConfig
from ...utils.g... | @auto_docstring
class OlmoModel(OlmoPreTrainedModel):
def __init__(self, config: OlmoConfig):
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 | 40 | 5 | 30 | 6 | 6 | 0.22 | 1 | 16 | 10 | 1 | 5 | 7 | 6 | 7 | 257 | 34 | 184 | 65 | 146 | 40 | 89 | 34 | 82 | 21 | 2 | 2 | 37 |
4,202 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo/modeling_olmo.py | transformers.models.olmo.modeling_olmo.OlmoPreTrainedModel | from .configuration_olmo import OlmoConfig
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
@auto_docstring
class OlmoPreTrainedModel(PreTrainedModel):
config: OlmoConfig
base_model_prefix = 'model'
supports_gra... | @auto_docstring
class OlmoPreTrainedModel(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 |
4,203 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo/modeling_olmo.py | transformers.models.olmo.modeling_olmo.OlmoRotaryEmbedding | import torch.nn.functional as F
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
import torch
from .configuration_olmo import OlmoConfig
import torch.nn as nn
class OlmoRotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, config: OlmoConfig, device=None):
su... |
class OlmoRotaryEmbedding(nn.Module):
def __init__(self, config: OlmoConfig, 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,204 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo/modular_olmo.py | transformers.models.olmo.modular_olmo.OlmoAttention | import torch.nn as nn
import torch.nn.functional as F
from typing import Callable, Optional
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache
import torch
from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForC... |
class OlmoAttention(LlamaAttention):
@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: Optional[torch.Tensor], past_key_values: Optional[Cache]=None, cache_positi... | 3 | 0 | 57 | 8 | 48 | 1 | 6 | 0.02 | 1 | 2 | 1 | 0 | 1 | 1 | 1 | 13 | 58 | 8 | 49 | 20 | 39 | 1 | 28 | 11 | 26 | 6 | 2 | 2 | 6 |
4,205 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo/modular_olmo.py | transformers.models.olmo.modular_olmo.OlmoDecoderLayer | from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaMLP, LlamaModel, LlamaRotaryEmbedding, eager_attention_forward, rotate_half
from .configuration_olmo import OlmoConfig
class OlmoDecoderLayer(LlamaDecoderLayer):
def __init__(self, config: OlmoConfig, layer_idx: int):
... |
class OlmoDecoderLayer(LlamaDecoderLayer):
def __init__(self, config: OlmoConfig, layer_idx: int):
pass | 2 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 5 | 3 | 0 | 1 | 3 | 1 | 13 | 6 | 0 | 6 | 5 | 4 | 0 | 6 | 5 | 4 | 1 | 2 | 0 | 1 |
4,206 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo/modular_olmo.py | transformers.models.olmo.modular_olmo.OlmoForCausalLM | from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaMLP, LlamaModel, LlamaRotaryEmbedding, eager_attention_forward, rotate_half
class OlmoForCausalLM(LlamaForCausalLM):
pass |
class OlmoForCausalLM(LlamaForCausalLM):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 9 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
4,207 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo/modular_olmo.py | transformers.models.olmo.modular_olmo.OlmoLayerNorm | import torch.nn.functional as F
import torch.nn as nn
import torch
class OlmoLayerNorm(nn.Module):
"""LayerNorm but with no learnable weight or bias."""
def __init__(self, hidden_size: int) -> None:
super().__init__()
self.normalized_shape = (hidden_size,)
def forward(self, hidden_states:... |
class OlmoLayerNorm(nn.Module):
'''LayerNorm but with no learnable weight or bias.'''
def __init__(self, hidden_size: int) -> None:
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 1 | 4 | 0 | 4 | 0 | 1 | 0.11 | 1 | 3 | 0 | 0 | 2 | 1 | 2 | 12 | 12 | 2 | 9 | 5 | 6 | 1 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
4,208 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo/modular_olmo.py | transformers.models.olmo.modular_olmo.OlmoMLP | from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaMLP, LlamaModel, LlamaRotaryEmbedding, eager_attention_forward, rotate_half
import torch.nn as nn
class OlmoMLP(LlamaMLP):
def __init__(self, config):
super().__init__(config)
self.gate_proj = nn.Linear(se... |
class OlmoMLP(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 |
4,209 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo/modular_olmo.py | transformers.models.olmo.modular_olmo.OlmoModel | from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaMLP, LlamaModel, LlamaRotaryEmbedding, eager_attention_forward, rotate_half
import torch.nn as nn
from .configuration_olmo import OlmoConfig
class OlmoModel(LlamaModel):
def __init__(self, config: OlmoConfig):
sup... |
class OlmoModel(LlamaModel):
def __init__(self, config: OlmoConfig):
pass | 2 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 5 | 3 | 0 | 1 | 2 | 1 | 8 | 7 | 0 | 7 | 4 | 5 | 0 | 5 | 4 | 3 | 1 | 3 | 0 | 1 |
4,210 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo2/configuration_olmo2.py | transformers.models.olmo2.configuration_olmo2.Olmo2Config | from ...configuration_utils import PretrainedConfig
class Olmo2Config(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Olmo2Model`]. It is used to instantiate an OLMo2
model according to the specified arguments, defining the model architecture. Instantiating a config... |
class Olmo2Config(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Olmo2Model`]. It is used to instantiate an OLMo2
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar c... | 3 | 2 | 36 | 2 | 32 | 2 | 4 | 1.03 | 1 | 4 | 0 | 0 | 2 | 15 | 2 | 2 | 162 | 14 | 75 | 45 | 50 | 77 | 35 | 23 | 32 | 5 | 1 | 1 | 7 |
4,211 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo2/modeling_olmo2.py | transformers.models.olmo2.modeling_olmo2.Olmo2Attention | import torch.nn as nn
from .configuration_olmo2 import Olmo2Config
from typing import Callable, Optional, Union
from ...utils.deprecation import deprecate_kwarg
from transformers.utils.generic import TransformersKwargs
from ...processing_utils import Unpack
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrai... |
class Olmo2Attention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: Olmo2Config, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torc... | 4 | 1 | 38 | 4 | 34 | 1 | 3 | 0.03 | 1 | 6 | 3 | 0 | 2 | 13 | 2 | 12 | 80 | 10 | 68 | 33 | 57 | 2 | 39 | 25 | 36 | 5 | 1 | 2 | 6 |
4,212 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo2/modeling_olmo2.py | transformers.models.olmo2.modeling_olmo2.Olmo2DecoderLayer | import torch
from transformers.utils.generic import TransformersKwargs
import torch.nn as nn
from ...utils.deprecation import deprecate_kwarg
from .configuration_olmo2 import Olmo2Config
from ...cache_utils import Cache, DynamicCache
from typing import Callable, Optional, Union
from ...modeling_layers import GradientCh... |
class Olmo2DecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Olmo2Config, 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 | 24 | 3 | 21 | 2 | 2 | 0.07 | 1 | 9 | 5 | 0 | 2 | 5 | 2 | 12 | 50 | 6 | 42 | 22 | 28 | 3 | 21 | 11 | 18 | 2 | 1 | 1 | 3 |
4,213 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo2/modeling_olmo2.py | transformers.models.olmo2.modeling_olmo2.Olmo2ForCausalLM | from ...generation import GenerationMixin
import torch.nn as nn
from ...utils import auto_docstring, can_return_tuple
import torch
from ...processing_utils import Unpack
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from typing import Callable, Optional, Union
from transformers.utils.g... | @auto_docstring
class Olmo2ForCausalLM(Olmo2PreTrainedModel, 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]=N... | 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,214 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo2/modeling_olmo2.py | transformers.models.olmo2.modeling_olmo2.Olmo2MLP | from ...activations import ACT2FN
import torch.nn as nn
class Olmo2MLP(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.hid... |
class Olmo2MLP(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 |
4,215 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo2/modeling_olmo2.py | transformers.models.olmo2.modeling_olmo2.Olmo2Model | from transformers.utils.generic import TransformersKwargs
from ...cache_utils import Cache, DynamicCache
import torch
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from typing import Callable, Optional, Union
import torch.nn as nn
from .configuration_olmo2 import Olmo2Config
from ...pr... | @auto_docstring
class Olmo2Model(Olmo2PreTrainedModel):
def __init__(self, config: Olmo2Config):
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, pas... | 6 | 0 | 40 | 5 | 30 | 6 | 6 | 0.22 | 1 | 16 | 10 | 0 | 5 | 7 | 6 | 7 | 257 | 34 | 184 | 65 | 146 | 40 | 89 | 34 | 82 | 21 | 2 | 2 | 37 |
4,216 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo2/modeling_olmo2.py | transformers.models.olmo2.modeling_olmo2.Olmo2PreTrainedModel | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_olmo2 import Olmo2Config
from ...utils import auto_docstring, can_return_tuple
@auto_docstring
class Olmo2PreTrainedModel(PreTrainedModel):
config: Olmo2Config
base_model_prefix = 'model'
supports_gradient_checkpoint... | @auto_docstring
class Olmo2PreTrainedModel(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 |
4,217 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo2/modeling_olmo2.py | transformers.models.olmo2.modeling_olmo2.Olmo2RMSNorm | import torch
from ...integrations import use_kernel_forward_from_hub
import torch.nn as nn
@use_kernel_forward_from_hub('RMSNorm')
class Olmo2RMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
"""
Olmo2RMSNorm is equivalent to T5LayerNorm
"""
super().__init__()
... | @use_kernel_forward_from_hub('RMSNorm')
class Olmo2RMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
'''
Olmo2RMSNorm 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,218 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo2/modeling_olmo2.py | transformers.models.olmo2.modeling_olmo2.Olmo2RotaryEmbedding | import torch
import torch.nn as nn
from .configuration_olmo2 import Olmo2Config
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
class Olmo2RotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, config: Olmo2Config, device=None):
super().__init__()
if ... |
class Olmo2RotaryEmbedding(nn.Module):
def __init__(self, config: Olmo2Config, 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,219 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo2/modular_olmo2.py | transformers.models.olmo2.modular_olmo2.Olmo2Attention | from ...cache_utils import Cache
from ..olmo.modeling_olmo import OlmoAttention, OlmoDecoderLayer, OlmoForCausalLM, OlmoModel, OlmoRotaryEmbedding, apply_rotary_pos_emb
import torch
from ...utils.deprecation import deprecate_kwarg
from ...processing_utils import Unpack
from ..llama.modeling_llama import LlamaPreTrained... |
class Olmo2Attention(OlmoAttention):
def __init__(self, config: Olmo2Config, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, position_embeddings: tuple[torch.Tensor, torch.Tensor], at... | 4 | 0 | 28 | 4 | 24 | 1 | 3 | 0.02 | 1 | 6 | 3 | 0 | 2 | 3 | 2 | 14 | 58 | 8 | 49 | 23 | 38 | 1 | 28 | 14 | 25 | 5 | 2 | 2 | 6 |
4,220 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo2/modular_olmo2.py | transformers.models.olmo2.modular_olmo2.Olmo2Config | from ..olmo.configuration_olmo import OlmoConfig
class Olmo2Config(OlmoConfig):
"""
This is the configuration class to store the configuration of a [`Olmo2Model`]. It is used to instantiate an OLMo2
model according to the specified arguments, defining the model architecture. Instantiating a configuration w... |
class Olmo2Config(OlmoConfig):
'''
This is the configuration class to store the configuration of a [`Olmo2Model`]. It is used to instantiate an OLMo2
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configu... | 2 | 1 | 47 | 1 | 46 | 0 | 1 | 1.28 | 1 | 1 | 0 | 0 | 1 | 1 | 1 | 3 | 136 | 10 | 57 | 27 | 33 | 73 | 7 | 5 | 5 | 1 | 2 | 0 | 1 |
4,221 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo2/modular_olmo2.py | transformers.models.olmo2.modular_olmo2.Olmo2DecoderLayer | import torch.nn as nn
from typing import Callable, Optional
from ..olmo.modeling_olmo import OlmoAttention, OlmoDecoderLayer, OlmoForCausalLM, OlmoModel, OlmoRotaryEmbedding, apply_rotary_pos_emb
from ...cache_utils import Cache
from transformers.utils.generic import TransformersKwargs
import torch
from ...processing_u... |
class Olmo2DecoderLayer(OlmoDecoderLayer):
def __init__(self, config: Olmo2Config, 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: Optional... | 4 | 0 | 23 | 2 | 20 | 2 | 2 | 0.07 | 1 | 8 | 4 | 0 | 2 | 3 | 2 | 14 | 48 | 5 | 41 | 20 | 27 | 3 | 20 | 9 | 17 | 2 | 2 | 1 | 3 |
4,222 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo2/modular_olmo2.py | transformers.models.olmo2.modular_olmo2.Olmo2ForCausalLM | from ..olmo.modeling_olmo import OlmoAttention, OlmoDecoderLayer, OlmoForCausalLM, OlmoModel, OlmoRotaryEmbedding, apply_rotary_pos_emb
class Olmo2ForCausalLM(OlmoForCausalLM):
pass |
class Olmo2ForCausalLM(OlmoForCausalLM):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 9 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
4,223 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo2/modular_olmo2.py | transformers.models.olmo2.modular_olmo2.Olmo2Model | from ..olmo.modeling_olmo import OlmoAttention, OlmoDecoderLayer, OlmoForCausalLM, OlmoModel, OlmoRotaryEmbedding, apply_rotary_pos_emb
import torch.nn as nn
class Olmo2Model(OlmoModel):
def __init__(self, config: Olmo2Config):
super().__init__(config)
self.norm = Olmo2RMSNorm(config.hidden_size, ... |
class Olmo2Model(OlmoModel):
def __init__(self, config: Olmo2Config):
pass | 2 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 5 | 3 | 0 | 1 | 2 | 1 | 8 | 7 | 0 | 7 | 4 | 5 | 0 | 5 | 4 | 3 | 1 | 3 | 0 | 1 |
4,224 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmo2/modular_olmo2.py | transformers.models.olmo2.modular_olmo2.Olmo2RMSNorm | import torch
from ..llama.modeling_llama import LlamaPreTrainedModel, LlamaRMSNorm, eager_attention_forward
import torch.nn as nn
class Olmo2RMSNorm(LlamaRMSNorm):
def forward(self, hidden_states):
input_dtype = hidden_states.dtype
hidden_states = hidden_states.to(torch.float32)
variance =... |
class Olmo2RMSNorm(LlamaRMSNorm):
def forward(self, hidden_states):
pass | 2 | 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 |
4,225 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmoe/configuration_olmoe.py | transformers.models.olmoe.configuration_olmoe.OlmoeConfig | from ...modeling_rope_utils import rope_config_validation
from ...configuration_utils import PretrainedConfig
class OlmoeConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`OlmoeModel`]. It is used to instantiate an OLMoE
model according to the specified argument... |
class OlmoeConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`OlmoeModel`]. It is used to instantiate an OLMoE
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar c... | 2 | 1 | 68 | 3 | 62 | 3 | 3 | 1.31 | 1 | 1 | 0 | 0 | 1 | 21 | 1 | 1 | 162 | 12 | 65 | 53 | 35 | 85 | 31 | 25 | 29 | 3 | 1 | 1 | 3 |
4,226 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmoe/modeling_olmoe.py | transformers.models.olmoe.modeling_olmoe.OlmoeAttention | import math
from ...utils.deprecation import deprecate_kwarg
from typing import Optional, Union
from .configuration_olmoe import OlmoeConfig
import torch.nn.functional as F
import torch
from torch import nn
from ...cache_utils import Cache, DynamicCache, StaticCache
class OlmoeAttention(nn.Module):
"""Multi-headed... |
class OlmoeAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: OlmoeConfig, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torc... | 4 | 1 | 50 | 9 | 40 | 2 | 5 | 0.05 | 1 | 8 | 3 | 2 | 2 | 17 | 2 | 12 | 104 | 20 | 81 | 40 | 67 | 4 | 58 | 29 | 55 | 6 | 1 | 1 | 9 |
4,227 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmoe/modeling_olmoe.py | transformers.models.olmoe.modeling_olmoe.OlmoeDecoderLayer | from ...utils.deprecation import deprecate_kwarg
from ...modeling_layers import GradientCheckpointingLayer
from typing import Optional, Union
import torch
from ...cache_utils import Cache, DynamicCache, StaticCache
from .configuration_olmoe import OlmoeConfig
import torch.nn.functional as F
class OlmoeDecoderLayer(Gra... |
class OlmoeDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: OlmoeConfig, 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 | 1 | 42 | 5 | 23 | 14 | 3 | 0.57 | 1 | 8 | 4 | 0 | 2 | 5 | 2 | 12 | 85 | 11 | 47 | 24 | 32 | 27 | 25 | 12 | 22 | 4 | 1 | 1 | 5 |
4,228 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmoe/modeling_olmoe.py | transformers.models.olmoe.modeling_olmoe.OlmoeFlashAttention2 | from ...cache_utils import Cache, DynamicCache, StaticCache
import torch.nn.functional as F
from ...utils.deprecation import deprecate_kwarg
from typing import Optional, Union
from ...modeling_flash_attention_utils import flash_attn_supports_top_left_mask, is_flash_attn_available
import torch
class OlmoeFlashAttention... |
class OlmoeFlashAttention2(OlmoeAttention):
'''
OLMoE flash attention module. This module inherits from `OlmoeAttention` 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 with p... | 4 | 1 | 49 | 8 | 34 | 8 | 5 | 0.29 | 1 | 4 | 1 | 0 | 2 | 1 | 2 | 14 | 106 | 18 | 68 | 26 | 54 | 20 | 42 | 15 | 39 | 8 | 2 | 2 | 9 |
4,229 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmoe/modeling_olmoe.py | transformers.models.olmoe.modeling_olmoe.OlmoeForCausalLM | from ...modeling_outputs import MoeCausalLMOutputWithPast, MoeModelOutputWithPast
from ...generation import GenerationMixin
from typing import Optional, Union
from ...cache_utils import Cache, DynamicCache, StaticCache
from torch import nn
from ...utils import auto_docstring, logging
import torch
import torch.nn.functi... |
class OlmoeForCausalLM(OlmoePreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
@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_values: Optional[Cache]... | 4 | 1 | 17 | 2 | 11 | 4 | 3 | 0.32 | 2 | 7 | 2 | 0 | 8 | 6 | 8 | 9 | 145 | 22 | 94 | 40 | 66 | 30 | 46 | 23 | 37 | 13 | 2 | 2 | 20 |
4,230 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmoe/modeling_olmoe.py | transformers.models.olmoe.modeling_olmoe.OlmoeMLP | from torch import nn
from ...activations import ACT2FN
class OlmoeMLP(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.hidd... |
class OlmoeMLP(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 |
4,231 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmoe/modeling_olmoe.py | transformers.models.olmoe.modeling_olmoe.OlmoeModel | from ...modeling_attn_mask_utils import AttentionMaskConverter
from typing import Optional, Union
from .configuration_olmoe import OlmoeConfig
from ...utils import auto_docstring, logging
from ...modeling_outputs import MoeCausalLMOutputWithPast, MoeModelOutputWithPast
import torch
from ...cache_utils import Cache, Dyn... | @auto_docstring
class OlmoeModel(OlmoePreTrainedModel):
def __init__(self, config: OlmoeConfig):
pass
@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_values: Optional[U... | 8 | 1 | 45 | 5 | 34 | 6 | 7 | 0.21 | 1 | 16 | 9 | 0 | 5 | 7 | 6 | 7 | 287 | 36 | 209 | 68 | 171 | 44 | 105 | 37 | 98 | 28 | 2 | 2 | 44 |
4,232 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmoe/modeling_olmoe.py | transformers.models.olmoe.modeling_olmoe.OlmoePreTrainedModel | from .configuration_olmoe import OlmoeConfig
from ...modeling_utils import PreTrainedModel
from ...utils import auto_docstring, logging
from torch import nn
@auto_docstring
class OlmoePreTrainedModel(PreTrainedModel):
config: OlmoeConfig
base_model_prefix = 'model'
supports_gradient_checkpointing = True
... | @auto_docstring
class OlmoePreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 10 | 0 | 10 | 0 | 5 | 0.05 | 1 | 0 | 0 | 2 | 1 | 0 | 1 | 1 | 22 | 1 | 21 | 13 | 19 | 1 | 20 | 13 | 18 | 5 | 1 | 2 | 5 |
4,233 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmoe/modeling_olmoe.py | transformers.models.olmoe.modeling_olmoe.OlmoeRMSNorm | import torch.nn.functional as F
import torch
from torch import nn
class OlmoeRMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-05):
"""
OlmoeRMSNorm is equivalent to T5LayerNorm
"""
super().__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
self... |
class OlmoeRMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-05):
'''
OlmoeRMSNorm is equivalent to T5LayerNorm
'''
pass
def forward(self, hidden_states):
pass
def extra_repr(self):
pass | 4 | 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,234 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmoe/modeling_olmoe.py | transformers.models.olmoe.modeling_olmoe.OlmoeRotaryEmbedding | from .configuration_olmoe import OlmoeConfig
import torch
import torch.nn.functional as F
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
from torch import nn
class OlmoeRotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, config: OlmoeConfig, device=None):
... |
class OlmoeRotaryEmbedding(nn.Module):
def __init__(self, config: OlmoeConfig, 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,235 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmoe/modeling_olmoe.py | transformers.models.olmoe.modeling_olmoe.OlmoeSdpaAttention | from ...cache_utils import Cache, DynamicCache, StaticCache
import torch
from ...utils.deprecation import deprecate_kwarg
import torch.nn.functional as F
from typing import Optional, Union
class OlmoeSdpaAttention(OlmoeAttention):
"""
OLMoE attention module using torch.nn.functional.scaled_dot_product_attentio... |
class OlmoeSdpaAttention(OlmoeAttention):
'''
OLMoE attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
`OlmoeAttention` as the weights of the module stays untouched. The only changes are on the forward pass to adapt to
SDPA API.
'''
@deprecate_kwa... | 3 | 1 | 85 | 14 | 64 | 7 | 8 | 0.2 | 1 | 4 | 1 | 0 | 1 | 0 | 1 | 13 | 93 | 15 | 65 | 21 | 53 | 13 | 36 | 11 | 34 | 8 | 2 | 1 | 8 |
4,236 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/olmoe/modeling_olmoe.py | transformers.models.olmoe.modeling_olmoe.OlmoeSparseMoeBlock | import torch.nn.functional as F
from torch import nn
import torch
class OlmoeSparseMoeBlock(nn.Module):
def __init__(self, config):
super().__init__()
self.num_experts = config.num_experts
self.top_k = config.num_experts_per_tok
self.norm_topk_prob = config.norm_topk_prob
s... |
class OlmoeSparseMoeBlock(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 22 | 3 | 14 | 5 | 2 | 0.34 | 1 | 5 | 1 | 0 | 2 | 5 | 2 | 12 | 46 | 7 | 29 | 19 | 26 | 10 | 27 | 19 | 24 | 3 | 1 | 1 | 4 |
4,237 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/configuration_omdet_turbo.py | transformers.models.omdet_turbo.configuration_omdet_turbo.OmDetTurboConfig | from ...utils.backbone_utils import verify_backbone_config_arguments
from ..auto import CONFIG_MAPPING
from ...configuration_utils import PretrainedConfig
class OmDetTurboConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`OmDetTurboForObjectDetection`].
It is us... |
class OmDetTurboConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`OmDetTurboForObjectDetection`].
It is used to instantiate a OmDet-Turbo model according to the specified arguments, defining the model architecture
Instantiating a configuration with the defa... | 4 | 1 | 138 | 5 | 133 | 0 | 8 | 0.81 | 1 | 3 | 0 | 0 | 1 | 44 | 1 | 1 | 265 | 14 | 139 | 98 | 90 | 112 | 65 | 51 | 63 | 8 | 1 | 2 | 8 |
4,238 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboCSPRepLayer | from torch import Tensor, nn
from .configuration_omdet_turbo import OmDetTurboConfig
class OmDetTurboCSPRepLayer(nn.Module):
"""
Cross Stage Partial (CSP) network layer with RepVGG blocks.
"""
def __init__(self, config: OmDetTurboConfig):
super().__init__()
in_channels = config.encoder... |
class OmDetTurboCSPRepLayer(nn.Module):
'''
Cross Stage Partial (CSP) network layer with RepVGG blocks.
'''
def __init__(self, config: OmDetTurboConfig):
pass
def forward(self, hidden_state):
pass | 3 | 1 | 11 | 1 | 10 | 0 | 2 | 0.14 | 1 | 6 | 3 | 0 | 2 | 4 | 2 | 12 | 28 | 4 | 21 | 15 | 18 | 3 | 20 | 15 | 17 | 2 | 1 | 1 | 3 |
4,239 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboConvNormLayer | from ...activations import ACT2CLS, ACT2FN
from torch import Tensor, nn
class OmDetTurboConvNormLayer(nn.Module):
def __init__(self, config, in_channels, out_channels, kernel_size, stride, padding=None, activation=None):
super().__init__()
self.conv = nn.Conv2d(in_channels, out_channels, kernel_si... |
class OmDetTurboConvNormLayer(nn.Module):
def __init__(self, config, in_channels, out_channels, kernel_size, stride, padding=None, activation=None):
pass
def forward(self, hidden_state):
pass | 3 | 0 | 9 | 0 | 9 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 19 | 1 | 18 | 6 | 15 | 0 | 11 | 6 | 8 | 3 | 1 | 0 | 4 |
4,240 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboDecoder | from ...modeling_attn_mask_utils import _prepare_4d_attention_mask
import torch.nn.functional as F
from .configuration_omdet_turbo import OmDetTurboConfig
import torch
from functools import lru_cache
from torch import Tensor, nn
class OmDetTurboDecoder(OmDetTurboPreTrainedModel):
def __init__(self, config: OmDetT... |
class OmDetTurboDecoder(OmDetTurboPreTrainedModel):
def __init__(self, config: OmDetTurboConfig):
pass
@lru_cache(maxsize=32)
def generate_anchors(self, spatial_shapes=None, grid_size=0.05, device='cpu', dtype=torch.float32):
pass
def _get_encoder_input(self, vision_features):
... | 7 | 1 | 62 | 5 | 49 | 8 | 7 | 0.16 | 1 | 11 | 5 | 0 | 5 | 17 | 5 | 11 | 317 | 29 | 249 | 82 | 231 | 39 | 134 | 69 | 128 | 20 | 2 | 3 | 34 |
4,241 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboDeformableTransformerDecoderLayer | import torch.nn.functional as F
import torch
from ...activations import ACT2CLS, ACT2FN
from ...modeling_layers import GradientCheckpointingLayer
from torch import Tensor, nn
class OmDetTurboDeformableTransformerDecoderLayer(GradientCheckpointingLayer):
"""
A single layer of the Deformable Transformer Decoder.... |
class OmDetTurboDeformableTransformerDecoderLayer(GradientCheckpointingLayer):
'''
A single layer of the Deformable Transformer Decoder.
'''
def __init__(self, config):
pass
@staticmethod
def with_pos_embed(tensor, pos):
pass
def forward(self, decoder_embeddings, task_feat... | 5 | 1 | 33 | 3 | 27 | 2 | 3 | 0.12 | 1 | 3 | 2 | 0 | 2 | 14 | 3 | 13 | 107 | 13 | 84 | 40 | 65 | 10 | 43 | 25 | 39 | 6 | 1 | 0 | 9 |
4,242 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboEncoder | import torch
from typing import Optional, Union
from .configuration_omdet_turbo import OmDetTurboConfig
from torch import Tensor, nn
import torch.nn.functional as F
class OmDetTurboEncoder(nn.Module):
def __init__(self, config: OmDetTurboConfig):
super().__init__()
self.layers = nn.ModuleList([OmD... |
class OmDetTurboEncoder(nn.Module):
def __init__(self, config: OmDetTurboConfig):
pass
def forward(self, src, src_mask=None, pos_embed=None, output_attentions: bool=False) -> tuple[Union[torch.Tensor, tuple[torch.Tensor]]]:
pass | 3 | 0 | 11 | 1 | 10 | 0 | 3 | 0 | 1 | 6 | 2 | 0 | 2 | 1 | 2 | 12 | 23 | 3 | 20 | 9 | 15 | 0 | 13 | 7 | 10 | 4 | 1 | 2 | 5 |
4,243 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboEncoderLayer | import torch.nn.functional as F
import torch
from typing import Optional, Union
from ...activations import ACT2CLS, ACT2FN
from .configuration_omdet_turbo import OmDetTurboConfig
from torch import Tensor, nn
class OmDetTurboEncoderLayer(nn.Module):
def __init__(self, config: OmDetTurboConfig):
super().__i... |
class OmDetTurboEncoderLayer(nn.Module):
def __init__(self, config: OmDetTurboConfig):
pass
@staticmethod
def with_pos_embed(tensor, pos_embed):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, position_embeddings: Optional[torch.Tensor]=None, output_a... | 5 | 1 | 22 | 1 | 17 | 4 | 3 | 0.23 | 1 | 5 | 2 | 0 | 2 | 8 | 3 | 13 | 70 | 5 | 53 | 23 | 42 | 12 | 35 | 16 | 31 | 5 | 1 | 2 | 8 |
4,244 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboForObjectDetection | import torch
from ...utils import auto_docstring, logging
from typing import Optional, Union
from .configuration_omdet_turbo import OmDetTurboConfig
from torch import Tensor, nn
import torch.nn.functional as F
@auto_docstring(custom_intro='\n OmDetTurbo Model (consisting of a vision and a text backbone, and encoder... | @auto_docstring(custom_intro='\n OmDetTurbo Model (consisting of a vision and a text backbone, and encoder-decoder architecture) outputting\n bounding boxes and classes scores for tasks such as COCO detection.\n ')
class OmDetTurboForObjectDetection(OmDetTurboPreTrainedModel):
def __init__(self, config: O... | 8 | 1 | 30 | 2 | 21 | 7 | 2 | 0.32 | 1 | 12 | 7 | 0 | 5 | 8 | 5 | 11 | 157 | 16 | 107 | 36 | 85 | 34 | 36 | 21 | 30 | 7 | 2 | 1 | 11 |
4,245 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboHybridEncoder | from .configuration_omdet_turbo import OmDetTurboConfig
import torch
import torch.nn.functional as F
from torch import Tensor, nn
class OmDetTurboHybridEncoder(nn.Module):
"""
Encoder consisting of channel projection layers, a set of `OmDetTurboEncoder`, a top-down Feature Pyramid Network
(FPN) and a botto... |
class OmDetTurboHybridEncoder(nn.Module):
'''
Encoder consisting of channel projection layers, a set of `OmDetTurboEncoder`, a top-down Feature Pyramid Network
(FPN) and a bottom-up Path Aggregation Network (PAN). More details on the paper: https://huggingface.co/papers/2304.08069
Args:
config:... | 5 | 2 | 54 | 4 | 43 | 7 | 7 | 0.2 | 1 | 10 | 5 | 0 | 2 | 13 | 3 | 13 | 174 | 15 | 132 | 50 | 119 | 27 | 77 | 41 | 73 | 14 | 1 | 2 | 20 |
4,246 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboLRUCache | from collections import OrderedDict
class OmDetTurboLRUCache:
def __init__(self, capacity: int):
self.cache = OrderedDict()
self.capacity = capacity
self.current_load = 0
def has(self, key) -> bool:
return key in self.cache
def get(self, key):
"""
Get the ... |
class OmDetTurboLRUCache:
def __init__(self, capacity: int):
pass
def has(self, key) -> bool:
pass
def get(self, key):
'''
Get the value of the key if the key exists in the cache, otherwise return None.
Move the key to the end of the cache to show that it was rece... | 5 | 2 | 7 | 0 | 5 | 2 | 2 | 0.45 | 0 | 3 | 0 | 0 | 4 | 3 | 4 | 4 | 33 | 4 | 20 | 8 | 15 | 9 | 20 | 8 | 15 | 3 | 0 | 2 | 7 |
4,247 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboLanguageBackbone | import torch
from .configuration_omdet_turbo import OmDetTurboConfig
from torch import Tensor, nn
from ..auto import AutoModel
import torch.nn.functional as F
class OmDetTurboLanguageBackbone(nn.Module):
def __init__(self, config: OmDetTurboConfig):
super().__init__()
self.model = AutoModel.from_c... |
class OmDetTurboLanguageBackbone(nn.Module):
def __init__(self, config: OmDetTurboConfig):
pass
def forward(self, hidden_states, mask=None, encode_type='task'):
pass | 3 | 0 | 10 | 0 | 10 | 0 | 3 | 0 | 1 | 4 | 2 | 0 | 2 | 2 | 2 | 12 | 22 | 1 | 21 | 12 | 18 | 0 | 19 | 12 | 16 | 4 | 1 | 2 | 5 |
4,248 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboMLP | from torch import Tensor, nn
import torch.nn.functional as F
class OmDetTurboMLP(nn.Module):
"""Very simple multi-layer perceptron (also called FFN)"""
def __init__(self, input_dim, hidden_dim, output_dim, num_layers):
super().__init__()
self.num_layers = num_layers
hidden_layers_dims ... |
class OmDetTurboMLP(nn.Module):
'''Very simple multi-layer perceptron (also called FFN)'''
def __init__(self, input_dim, hidden_dim, output_dim, num_layers):
pass
def forward(self, x):
pass | 3 | 1 | 6 | 0 | 6 | 0 | 2 | 0.08 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 16 | 2 | 13 | 8 | 10 | 1 | 11 | 8 | 8 | 3 | 1 | 1 | 4 |
4,249 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboMLPWithDropout | from ...activations import ACT2CLS, ACT2FN
from torch import Tensor, nn
class OmDetTurboMLPWithDropout(nn.Module):
def __init__(self, config):
super().__init__()
self.linear1 = nn.Linear(config.class_embed_dim, config.task_encoder_hidden_dim)
self.activation = ACT2FN[config.decoder_activat... |
class OmDetTurboMLPWithDropout(nn.Module):
def __init__(self, config):
pass
def forward(self, x):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 4 | 2 | 12 | 10 | 1 | 9 | 7 | 6 | 0 | 9 | 7 | 6 | 1 | 1 | 0 | 2 |
4,250 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboMultiheadAttention | import torch.nn.functional as F
import torch
import math
from typing import Optional, Union
from torch import Tensor, nn
class OmDetTurboMultiheadAttention(nn.Module):
"""Equivalent implementation of nn.MultiheadAttention with `batch_first=True`."""
def __init__(self, config, hidden_size, num_attention_heads,... |
class OmDetTurboMultiheadAttention(nn.Module):
'''Equivalent implementation of nn.MultiheadAttention with `batch_first=True`.'''
def __init__(self, config, hidden_size, num_attention_heads, dropout):
pass
def forward(self, queries: torch.Tensor, keys: torch.Tensor, values: torch.Tensor, attention... | 3 | 1 | 19 | 3 | 14 | 1 | 2 | 0.11 | 1 | 5 | 0 | 0 | 3 | 8 | 3 | 13 | 61 | 12 | 44 | 28 | 33 | 5 | 34 | 21 | 30 | 3 | 1 | 1 | 6 |
4,251 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboMultiscaleDeformableAttention | import torch.nn.functional as F
import torch
import warnings
from typing import Optional, Union
from .configuration_omdet_turbo import OmDetTurboConfig
from torch import Tensor, nn
class OmDetTurboMultiscaleDeformableAttention(nn.Module):
"""
Multiscale deformable attention as proposed in Deformable DETR.
... |
class OmDetTurboMultiscaleDeformableAttention(nn.Module):
'''
Multiscale deformable attention as proposed in Deformable DETR.
'''
def __init__(self, config: OmDetTurboConfig, num_heads: int, n_points: int):
pass
def with_pos_embed(self, tensor: torch.Tensor, position_embeddings: Optio... | 4 | 1 | 39 | 3 | 33 | 3 | 5 | 0.11 | 1 | 9 | 2 | 0 | 3 | 10 | 3 | 13 | 125 | 13 | 101 | 39 | 85 | 11 | 55 | 26 | 51 | 8 | 1 | 2 | 15 |
4,252 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboObjectDetectionOutput | import torch
from ...file_utils import ModelOutput
from ...utils import auto_docstring, logging
from typing import Optional, Union
from dataclasses import dataclass
import torch.nn.functional as F
@dataclass
@auto_docstring(custom_intro='\n Output type of [`OmDetTurboObjectDetectionOutput`].\n ')
class OmDetTurb... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`OmDetTurboObjectDetectionOutput`].\n ')
class OmDetTurboObjectDetectionOutput(ModelOutput):
'''
loss (`torch.FloatTensor`):
The loss value.
decoder_coord_logits (`torch.FloatTensor` of shape `(batch_size, num_queries, 4)`):
T... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.71 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 54 | 2 | 14 | 14 | 13 | 38 | 14 | 14 | 13 | 0 | 1 | 0 | 0 |
4,253 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboPreTrainedModel | import torch
from ...utils import auto_docstring, logging
import math
from ...modeling_utils import PreTrainedModel
from .configuration_omdet_turbo import OmDetTurboConfig
from torch import Tensor, nn
import torch.nn.functional as F
@auto_docstring
class OmDetTurboPreTrainedModel(PreTrainedModel):
config: OmDetTur... | @auto_docstring
class OmDetTurboPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass
def linear_init_(module_to_init):
pass
def _set_gradient_checkpointing(self, module, value=False):
pass
@staticmethod
def _get_cache_key_at_index(input_ids, ... | 10 | 0 | 19 | 1 | 17 | 0 | 4 | 0.02 | 1 | 5 | 2 | 2 | 5 | 0 | 6 | 6 | 136 | 16 | 118 | 57 | 102 | 2 | 104 | 49 | 96 | 8 | 1 | 2 | 27 |
4,254 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboRepVggBlock | from .configuration_omdet_turbo import OmDetTurboConfig
from ...activations import ACT2CLS, ACT2FN
from torch import Tensor, nn
class OmDetTurboRepVggBlock(nn.Module):
"""
RepVGG architecture block introduced by the work "RepVGG: Making VGG-style ConvNets Great Again".
"""
def __init__(self, config: O... |
class OmDetTurboRepVggBlock(nn.Module):
'''
RepVGG architecture block introduced by the work "RepVGG: Making VGG-style ConvNets Great Again".
'''
def __init__(self, config: OmDetTurboConfig):
pass
def forward(self, x):
pass | 3 | 1 | 6 | 1 | 5 | 0 | 2 | 0.27 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 12 | 17 | 3 | 11 | 9 | 8 | 3 | 11 | 9 | 8 | 2 | 1 | 0 | 3 |
4,255 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboResidualLayer | from torch import Tensor, nn
class OmDetTurboResidualLayer(nn.Module):
"""
A residual connection followed by a layer norm.
"""
def __init__(self, config):
super().__init__()
self.norm1 = nn.LayerNorm(config.class_embed_dim, eps=config.layer_norm_eps)
self.dropout = nn.Dropout(c... |
class OmDetTurboResidualLayer(nn.Module):
'''
A residual connection followed by a layer norm.
'''
def __init__(self, config):
pass
def forward(self, x, y):
pass | 3 | 1 | 3 | 0 | 3 | 0 | 1 | 0.43 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 12 | 2 | 7 | 5 | 4 | 3 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
4,256 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboTaskEncoder | from torch import Tensor, nn
class OmDetTurboTaskEncoder(nn.Module):
def __init__(self, config):
super().__init__()
self.mlp = OmDetTurboMLPWithDropout(config)
self.res1 = OmDetTurboResidualLayer(config)
def forward(self, x):
mlp_out = self.mlp(x)
x = self.res1(x, mlp_... |
class OmDetTurboTaskEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, x):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 3 | 2 | 0 | 2 | 2 | 2 | 12 | 10 | 1 | 9 | 6 | 6 | 0 | 9 | 6 | 6 | 1 | 1 | 0 | 2 |
4,257 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/modeling_omdet_turbo.py | transformers.models.omdet_turbo.modeling_omdet_turbo.OmDetTurboVisionBackbone | from .configuration_omdet_turbo import OmDetTurboConfig
from ...utils.backbone_utils import load_backbone
from torch import Tensor, nn
class OmDetTurboVisionBackbone(nn.Module):
def __init__(self, config: OmDetTurboConfig):
super().__init__()
self.apply_layernorm_after_vision_backbone = config.app... |
class OmDetTurboVisionBackbone(nn.Module):
def __init__(self, config: OmDetTurboConfig):
pass
def forward(self, pixel_values):
pass | 3 | 0 | 8 | 1 | 8 | 0 | 2 | 0 | 1 | 3 | 1 | 0 | 2 | 3 | 2 | 12 | 18 | 2 | 16 | 7 | 13 | 0 | 11 | 7 | 8 | 2 | 1 | 1 | 3 |
4,258 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/processing_omdet_turbo.py | transformers.models.omdet_turbo.processing_omdet_turbo.DictWithDeprecationWarning | import warnings
class DictWithDeprecationWarning(dict):
message = 'The `classes` key is deprecated for `OmDetTurboProcessor.post_process_grounded_object_detection` output dict and will be removed in a 4.51.0 version. Please use `text_labels` instead.'
def __getitem__(self, key):
if key == 'classes':
... |
class DictWithDeprecationWarning(dict):
def __getitem__(self, key):
pass
def get(self, key, *args, **kwargs):
pass | 3 | 0 | 5 | 0 | 5 | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 2 | 0 | 2 | 29 | 17 | 2 | 15 | 4 | 12 | 0 | 12 | 4 | 9 | 2 | 2 | 1 | 4 |
4,259 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/processing_omdet_turbo.py | transformers.models.omdet_turbo.processing_omdet_turbo.OmDetTurboProcessor | from ...image_utils import ImageInput
from ...utils import TensorType, is_torch_available, is_torchvision_available
from ...processing_utils import ProcessingKwargs, ProcessorMixin, TextKwargs, Unpack
from typing import TYPE_CHECKING, Optional, Union
from ...feature_extraction_utils import BatchFeature
from ...utils.im... | @requires(backends=('vision', 'torchvision'))
class OmDetTurboProcessor(ProcessorMixin):
'''
Constructs a OmDet-Turbo processor which wraps a Deformable DETR image processor and an AutoTokenizer into a
single processor.
[`OmDetTurboProcessor`] offers all the functionalities of [`DetrImageProcessor`] and... | 8 | 3 | 30 | 4 | 18 | 9 | 4 | 0.59 | 1 | 12 | 3 | 0 | 6 | 0 | 6 | 23 | 209 | 33 | 111 | 48 | 87 | 65 | 66 | 32 | 59 | 10 | 2 | 2 | 22 |
4,260 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/processing_omdet_turbo.py | transformers.models.omdet_turbo.processing_omdet_turbo.OmDetTurboProcessorKwargs | from ...processing_utils import ProcessingKwargs, ProcessorMixin, TextKwargs, Unpack
class OmDetTurboProcessorKwargs(ProcessingKwargs, total=False):
text_kwargs: OmDetTurboTextKwargs
_defaults = {'text_kwargs': {'add_special_tokens': True, 'padding': 'max_length', 'truncation': True, 'max_length': 77, 'stride'... |
class OmDetTurboProcessorKwargs(ProcessingKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 19 | 0 | 19 | 2 | 18 | 0 | 3 | 2 | 2 | 0 | 3 | 0 | 0 |
4,261 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/omdet_turbo/processing_omdet_turbo.py | transformers.models.omdet_turbo.processing_omdet_turbo.OmDetTurboTextKwargs | from ...tokenization_utils_base import PreTokenizedInput, TextInput
from ...processing_utils import ProcessingKwargs, ProcessorMixin, TextKwargs, Unpack
from typing import TYPE_CHECKING, Optional, Union
class OmDetTurboTextKwargs(TextKwargs, total=False):
task: Optional[Union[str, list[str], TextInput, PreTokenize... |
class OmDetTurboTextKwargs(TextKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
4,262 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/configuration_oneformer.py | transformers.models.oneformer.configuration_oneformer.OneFormerConfig | from ..auto import CONFIG_MAPPING
from ...configuration_utils import PretrainedConfig
from typing import Optional
from ...utils.backbone_utils import verify_backbone_config_arguments
class OneFormerConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`OneFormerModel`].... |
class OneFormerConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`OneFormerModel`]. It is used to instantiate a
OneFormer model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield ... | 4 | 1 | 124 | 3 | 121 | 0 | 3 | 0.92 | 1 | 7 | 0 | 0 | 1 | 46 | 1 | 1 | 247 | 9 | 124 | 100 | 74 | 114 | 58 | 52 | 56 | 3 | 1 | 1 | 3 |
4,263 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/convert_to_hf_oneformer.py | transformers.models.oneformer.convert_to_hf_oneformer.Args | from dataclasses import dataclass
@dataclass
class Args:
"""Fake command line arguments needed by oneformer/detectron2 implementation"""
config_file: str | @dataclass
class Args:
'''Fake command line arguments needed by oneformer/detectron2 implementation'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 0 | 0 | 0 |
4,264 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/convert_to_hf_oneformer.py | transformers.models.oneformer.convert_to_hf_oneformer.OriginalOneFormerCheckpointToOursConverter | from pprint import pformat
from transformers.models.oneformer.modeling_oneformer import OneFormerConfig, OneFormerForUniversalSegmentation, OneFormerForUniversalSegmentationOutput, OneFormerModel, OneFormerModelOutput
from collections.abc import Iterator
from torch import Tensor, nn
from pathlib import Path
class Orig... |
class OriginalOneFormerCheckpointToOursConverter:
def __init__(self, original_model: nn.Module, config: OneFormerConfig):
pass
def pop_all(self, renamed_keys: list[tuple[str, str]], dst_state_dict: StateDict, src_state_dict: StateDict):
pass
def replace_swin_backbone(self, dst_state_dict... | 31 | 0 | 29 | 4 | 24 | 1 | 2 | 0.06 | 0 | 9 | 1 | 0 | 11 | 2 | 12 | 12 | 693 | 112 | 549 | 98 | 518 | 34 | 232 | 97 | 202 | 5 | 0 | 2 | 50 |
4,265 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/convert_to_hf_oneformer.py | transformers.models.oneformer.convert_to_hf_oneformer.OriginalOneFormerConfigToOursConverter | from transformers import CLIPTokenizer, DinatConfig, SwinConfig
from transformers.models.oneformer.modeling_oneformer import OneFormerConfig, OneFormerForUniversalSegmentation, OneFormerForUniversalSegmentationOutput, OneFormerModel, OneFormerModelOutput
class OriginalOneFormerConfigToOursConverter:
def __call__(... |
class OriginalOneFormerConfigToOursConverter:
def __call__(self, original_config: object, is_swin: bool) -> OneFormerConfig:
pass | 2 | 0 | 82 | 4 | 78 | 0 | 4 | 0 | 0 | 8 | 0 | 0 | 1 | 0 | 1 | 1 | 83 | 4 | 79 | 8 | 77 | 0 | 14 | 8 | 12 | 4 | 0 | 2 | 4 |
4,266 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/convert_to_hf_oneformer.py | transformers.models.oneformer.convert_to_hf_oneformer.OriginalOneFormerConfigToProcessorConverter | from transformers import CLIPTokenizer, DinatConfig, SwinConfig
import torch
from transformers.models.oneformer.processing_oneformer import OneFormerProcessor
from transformers.models.oneformer.image_processing_oneformer import OneFormerImageProcessor
class OriginalOneFormerConfigToProcessorConverter:
def __call_... |
class OriginalOneFormerConfigToProcessorConverter:
def __call__(self, original_config: object, model_repo: str) -> OneFormerProcessor:
pass | 2 | 0 | 32 | 4 | 28 | 0 | 4 | 0 | 0 | 6 | 0 | 0 | 1 | 0 | 1 | 1 | 33 | 4 | 29 | 8 | 27 | 0 | 13 | 8 | 11 | 4 | 0 | 1 | 4 |
4,267 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/convert_to_hf_oneformer.py | transformers.models.oneformer.convert_to_hf_oneformer.TrackedStateDict | from typing import Any
class TrackedStateDict:
def __init__(self, to_track: dict):
"""This class "tracks" a python dictionary by keeping track of which item is accessed.
Args:
to_track (Dict): The dictionary we wish to track
"""
self.to_track = to_track
self._s... |
class TrackedStateDict:
def __init__(self, to_track: dict):
'''This class "tracks" a python dictionary by keeping track of which item is accessed.
Args:
to_track (Dict): The dictionary we wish to track
'''
pass
def __getitem__(self, key: str) -> Any:
pass
... | 6 | 2 | 5 | 0 | 2 | 2 | 1 | 0.77 | 0 | 3 | 0 | 0 | 5 | 2 | 5 | 5 | 29 | 6 | 13 | 8 | 7 | 10 | 13 | 8 | 7 | 1 | 0 | 0 | 5 |
4,268 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/image_processing_oneformer.py | transformers.models.oneformer.image_processing_oneformer.OneFormerImageProcessor | import numpy as np
from ...utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, TensorType, filter_out_non_signature_kwargs, is_torch_available, is_torch_tensor, logging
from ...image_utils import ChannelDimension, ImageInput, PILImageResampling, get_image_size, infer_channel_dimension_format, is_scaled_image, mak... |
class OneFormerImageProcessor(BaseImageProcessor):
'''
Constructs a OneFormer image processor. The image processor can be used to prepare image(s), task input(s) and
optional text inputs and targets for the model.
This image processor inherits from [`BaseImageProcessor`] which contains most of the main... | 23 | 12 | 45 | 4 | 30 | 11 | 5 | 0.45 | 1 | 16 | 3 | 0 | 19 | 16 | 20 | 40 | 979 | 111 | 603 | 280 | 443 | 273 | 332 | 144 | 311 | 17 | 3 | 4 | 105 |
4,269 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerAttention | from torch import Tensor, nn
from typing import Optional, Union
import torch
class OneFormerAttention(nn.Module):
"""
Multi-headed attention from 'Attention Is All You Need' paper. Here, we add position embeddings to the queries and
keys (as explained in the DETR paper).
"""
def __init__(self, emb... |
class OneFormerAttention(nn.Module):
'''
Multi-headed attention from 'Attention Is All You Need' paper. Here, we add position embeddings to the queries and
keys (as explained in the DETR paper).
'''
def __init__(self, embed_dim: int, num_heads: int, dropout: float=0.0, is_decoder: bool=False, bias... | 5 | 2 | 31 | 5 | 23 | 3 | 5 | 0.18 | 1 | 6 | 0 | 0 | 4 | 9 | 4 | 14 | 134 | 23 | 94 | 42 | 74 | 17 | 63 | 27 | 58 | 13 | 1 | 2 | 18 |
4,270 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerForUniversalSegmentation | from torch import Tensor, nn
from .configuration_oneformer import OneFormerConfig
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, is_accelerate_available, is_scipy_available, logging, requires_backends
@auto_docstring(custom_intro='\n OneFormer Model for instance, semantic and p... | @auto_docstring(custom_intro='\n OneFormer Model for instance, semantic and panoptic image segmentation.\n ')
class OneFormerForUniversalSegmentation(OneFormerPreTrainedModel):
def __init__(self, config: OneFormerConfig):
pass
def get_loss_dict(self, masks_queries_logits: Tensor, class_queries_l... | 7 | 1 | 53 | 7 | 29 | 17 | 4 | 0.57 | 1 | 11 | 5 | 0 | 4 | 4 | 4 | 5 | 221 | 32 | 120 | 43 | 91 | 69 | 41 | 20 | 36 | 9 | 2 | 3 | 15 |
4,271 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerForUniversalSegmentationOutput | from ...utils import ModelOutput, auto_docstring, is_accelerate_available, is_scipy_available, logging, requires_backends
import torch
from typing import Optional, Union
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro='\n Class for outputs of [`OneFormerForUniversalSegmentationOutput`].\n\... | @dataclass
@auto_docstring(custom_intro='\n Class for outputs of [`OneFormerForUniversalSegmentationOutput`].\n\n This output can be directly passed to [`~OneFormerImageProcessor.post_process_semantic_segmentation`] or\n [`~OneFormerImageProcessor.post_process_instance_segmentation`] or\n [`~OneFormerImageP... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.94 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 66 | 3 | 16 | 16 | 15 | 47 | 16 | 16 | 15 | 0 | 1 | 0 | 0 |
4,272 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerHungarianMatcher | from torch.cuda.amp import autocast
from torch import Tensor, nn
import numpy as np
import torch
class OneFormerHungarianMatcher(nn.Module):
def __init__(self, cost_class: float=1.0, cost_mask: float=1.0, cost_dice: float=1.0, num_points: int=12544):
"""This class computes an assignment between the labels... |
class OneFormerHungarianMatcher(nn.Module):
def __init__(self, cost_class: float=1.0, cost_mask: float=1.0, cost_dice: float=1.0, num_points: int=12544):
'''This class computes an assignment between the labels and the predictions of the network.
For efficiency reasons, the labels don't include the... | 4 | 2 | 52 | 7 | 22 | 23 | 2 | 1 | 1 | 7 | 0 | 0 | 2 | 4 | 2 | 12 | 107 | 15 | 46 | 22 | 40 | 46 | 33 | 19 | 30 | 2 | 1 | 2 | 4 |
4,273 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerLoss | import torch
from torch import Tensor, nn
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, is_accelerate_available, is_scipy_available, logging, requires_backends
import numpy as np
class OneFormerLoss(nn.Module):
def __init__(self, num_classes: int, matcher: OneFormerHungarian... |
class OneFormerLoss(nn.Module):
def __init__(self, num_classes: int, matcher: OneFormerHungarianMatcher, weight_dict: dict[str, float], eos_coef: float, num_points: int, oversample_ratio: float, importance_sample_ratio: float, contrastive_temperature: Optional[float]=None):
'''
This class computes... | 13 | 8 | 31 | 3 | 15 | 12 | 2 | 0.81 | 1 | 11 | 1 | 0 | 12 | 9 | 12 | 22 | 385 | 48 | 186 | 112 | 142 | 151 | 126 | 81 | 113 | 4 | 1 | 2 | 22 |
4,274 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerMLPPredictionHead | from torch import Tensor, nn
class OneFormerMLPPredictionHead(nn.Module):
def __init__(self, input_dim: int, hidden_dim: int, output_dim: int, num_layers: int=3):
"""
A classic Multi Layer Perceptron (MLP).
Args:
input_dim (`int`):
The input dimensions.
... |
class OneFormerMLPPredictionHead(nn.Module):
def __init__(self, input_dim: int, hidden_dim: int, output_dim: int, num_layers: int=3):
'''
A classic Multi Layer Perceptron (MLP).
Args:
input_dim (`int`):
The input dimensions.
hidden_dim (`int`):
... | 3 | 1 | 14 | 2 | 6 | 6 | 2 | 0.92 | 1 | 6 | 1 | 0 | 2 | 1 | 2 | 12 | 29 | 4 | 13 | 8 | 10 | 12 | 11 | 8 | 8 | 3 | 1 | 1 | 4 |
4,275 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerModel | import torch
from torch import Tensor, nn
from typing import Optional, Union
from .configuration_oneformer import OneFormerConfig
from ...utils import ModelOutput, auto_docstring, is_accelerate_available, is_scipy_available, logging, requires_backends
@auto_docstring
class OneFormerModel(OneFormerPreTrainedModel):
... | @auto_docstring
class OneFormerModel(OneFormerPreTrainedModel):
def __init__(self, config: OneFormerConfig):
pass
@auto_docstring
def forward(self, pixel_values: Tensor, task_inputs: Tensor, text_inputs: Optional[Tensor]=None, pixel_mask: Optional[Tensor]=None, output_hidden_states: Optional[bool]=... | 5 | 1 | 59 | 12 | 36 | 12 | 6 | 0.31 | 1 | 11 | 6 | 0 | 2 | 5 | 2 | 3 | 123 | 25 | 75 | 32 | 61 | 23 | 43 | 22 | 40 | 10 | 2 | 2 | 12 |
4,276 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerModelOutput | import torch
from typing import Optional, Union
from dataclasses import dataclass
from ...utils import ModelOutput, auto_docstring, is_accelerate_available, is_scipy_available, logging, requires_backends
@dataclass
@auto_docstring(custom_intro='\n Class for outputs of [`OneFormerModel`]. This class returns all the ... | @dataclass
@auto_docstring(custom_intro='\n Class for outputs of [`OneFormerModel`]. This class returns all the needed hidden states to compute the logits.\n ')
class OneFormerModelOutput(ModelOutput):
'''
encoder_hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=T... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.75 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 47 | 2 | 12 | 12 | 11 | 33 | 12 | 12 | 11 | 0 | 1 | 0 | 0 |
4,277 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerPixelDecoder | from torch import Tensor, nn
import torch
from .configuration_oneformer import OneFormerConfig
import numpy as np
class OneFormerPixelDecoder(nn.Module):
def __init__(self, config: OneFormerConfig, feature_channels):
super().__init__()
self.config = config
self.position_embedding = OneForm... |
class OneFormerPixelDecoder(nn.Module):
def __init__(self, config: OneFormerConfig, feature_channels):
pass
def get_valid_ratio(self, mask, dtype=torch.float32):
'''Get the valid ratio of all feature maps.'''
pass
def forward(self, features, encoder_outputs=None, output_attention... | 4 | 1 | 65 | 7 | 53 | 4 | 6 | 0.08 | 1 | 11 | 4 | 0 | 3 | 13 | 3 | 13 | 197 | 23 | 161 | 66 | 150 | 13 | 97 | 59 | 93 | 12 | 1 | 2 | 17 |
4,278 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerPixelDecoderEncoderLayer | from .configuration_oneformer import OneFormerConfig
from torch import Tensor, nn
import torch
from typing import Optional, Union
class OneFormerPixelDecoderEncoderLayer(nn.Module):
def __init__(self, config: OneFormerConfig):
super().__init__()
self.embed_dim = config.conv_dim
self.self_a... |
class OneFormerPixelDecoderEncoderLayer(nn.Module):
def __init__(self, config: OneFormerConfig):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, position_embeddings: Optional[torch.Tensor]=None, reference_points=None, spatial_shapes=None, level_start_index=None, outp... | 3 | 1 | 44 | 6 | 29 | 10 | 3 | 0.33 | 1 | 5 | 2 | 0 | 2 | 10 | 2 | 12 | 89 | 12 | 58 | 26 | 46 | 19 | 34 | 17 | 31 | 4 | 1 | 2 | 5 |
4,279 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerPixelDecoderEncoderMultiscaleDeformableAttention | import warnings
from torch import Tensor, nn
import torch
from typing import Optional, Union
class OneFormerPixelDecoderEncoderMultiscaleDeformableAttention(nn.Module):
"""
Multiscale deformable attention as proposed in Deformable DETR.
"""
def __init__(self, embed_dim: int, num_heads: int, n_levels: ... |
class OneFormerPixelDecoderEncoderMultiscaleDeformableAttention(nn.Module):
'''
Multiscale deformable attention as proposed in Deformable DETR.
'''
def __init__(self, embed_dim: int, num_heads: int, n_levels: int, n_points: int):
pass
def with_pos_embed(self, tensor: torch.Tensor, pos... | 4 | 1 | 28 | 2 | 24 | 2 | 4 | 0.11 | 1 | 6 | 0 | 0 | 3 | 9 | 3 | 13 | 91 | 9 | 74 | 33 | 59 | 8 | 41 | 22 | 37 | 6 | 1 | 1 | 11 |
4,280 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerPixelDecoderEncoderOnly | import torch
from ...modeling_outputs import BaseModelOutput
from .configuration_oneformer import OneFormerConfig
from torch import Tensor, nn
class OneFormerPixelDecoderEncoderOnly(nn.Module):
"""
Transformer encoder consisting of *config.encoder_layers* deformable attention layers. Each layer is a
[`OneF... |
class OneFormerPixelDecoderEncoderOnly(nn.Module):
'''
Transformer encoder consisting of *config.encoder_layers* deformable attention layers. Each layer is a
[`OneFormerPixelDecoderEncoderLayer`].
The encoder updates the flattened multi-scale feature maps through multiple deformable attention layers.
... | 5 | 3 | 35 | 3 | 20 | 13 | 4 | 0.73 | 1 | 6 | 3 | 0 | 2 | 3 | 3 | 13 | 120 | 13 | 62 | 30 | 46 | 45 | 35 | 18 | 31 | 10 | 1 | 2 | 13 |
4,281 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerPixelDecoderFrozenBatchNorm2d | import torch
from torch import Tensor, nn
class OneFormerPixelDecoderFrozenBatchNorm2d(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.re... |
class OneFormerPixelDecoderFrozenBatchNorm2d(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.
'''
... | 4 | 1 | 8 | 0 | 8 | 0 | 1 | 0.2 | 1 | 1 | 0 | 0 | 3 | 0 | 3 | 13 | 35 | 5 | 25 | 13 | 19 | 5 | 21 | 11 | 17 | 2 | 1 | 1 | 4 |
4,282 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerPixelDecoderOutput | from typing import Optional, Union
from dataclasses import dataclass
import torch
from ...utils import ModelOutput, auto_docstring, is_accelerate_available, is_scipy_available, logging, requires_backends
@dataclass
@auto_docstring(custom_intro="\n OneFormer's pixel decoder module output, practically a Multi-Scale D... | @dataclass
@auto_docstring(custom_intro="\n OneFormer's pixel decoder module output, practically a Multi-Scale Deformable Attention based decoder. It returns\n the mask features and the multiscale features.\n ")
class OneFormerPixelDecoderOutput(ModelOutput):
'''
multi_scale_features (`tuple(torch.Floa... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.75 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 21 | 2 | 4 | 4 | 3 | 15 | 4 | 4 | 3 | 0 | 1 | 0 | 0 |
4,283 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerPixelLevelModule | from ...utils.backbone_utils import load_backbone
from .configuration_oneformer import OneFormerConfig
from torch import Tensor, nn
class OneFormerPixelLevelModule(nn.Module):
def __init__(self, config: OneFormerConfig):
"""
Pixel Level Module proposed in [Masked-attention Mask Transformer for Uni... |
class OneFormerPixelLevelModule(nn.Module):
def __init__(self, config: OneFormerConfig):
'''
Pixel Level Module proposed in [Masked-attention Mask Transformer for Universal Image
Segmentation](https://huggingface.co/papers/2112.01527). It runs the input image through a backbone and a pixel... | 3 | 1 | 11 | 1 | 6 | 4 | 1 | 0.62 | 1 | 8 | 4 | 0 | 2 | 2 | 2 | 12 | 23 | 2 | 13 | 7 | 10 | 8 | 9 | 7 | 6 | 1 | 1 | 0 | 2 |
4,284 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerPixelLevelModuleOutput | import torch
from typing import Optional, Union
from dataclasses import dataclass
from ...utils import ModelOutput, auto_docstring, is_accelerate_available, is_scipy_available, logging, requires_backends
@dataclass
@auto_docstring(custom_intro="\n OneFormer's pixel level module output. It returns both the last and ... | @dataclass
@auto_docstring(custom_intro="\n OneFormer's pixel level module output. It returns both the last and (optionally) the hidden states from the\n `encoder` and `decoder`. By default, the `encoder` is a Swin/Dinat Backbone and the `decoder` is a Multi-Scale\n Deformable Attention based decoder.\n ")
... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 20 | 2 | 4 | 4 | 3 | 14 | 4 | 4 | 3 | 0 | 1 | 0 | 0 |
4,285 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerPreTrainedModel | from torch import Tensor, nn
from ...utils import ModelOutput, auto_docstring, is_accelerate_available, is_scipy_available, logging, requires_backends
from .configuration_oneformer import OneFormerConfig
from ...modeling_utils import PreTrainedModel
import torch
import numpy as np
import math
@auto_docstring
class One... | @auto_docstring
class OneFormerPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: nn.Module):
pass | 3 | 0 | 108 | 0 | 108 | 0 | 50 | 0 | 1 | 16 | 15 | 2 | 1 | 0 | 1 | 1 | 113 | 1 | 112 | 17 | 110 | 0 | 90 | 17 | 88 | 50 | 1 | 5 | 50 |
4,286 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerSinePositionEmbedding | from ...pytorch_utils import compile_compatible_method_lru_cache
import torch
import math
from torch import Tensor, nn
from typing import Optional, Union
class OneFormerSinePositionEmbedding(nn.Module):
"""
This is a more standard version of the position embedding, very similar to the one used by the Attention... |
class OneFormerSinePositionEmbedding(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, num_pos_feats: int=64, temperature: int=10000, normalize: bool=... | 4 | 1 | 15 | 1 | 14 | 0 | 3 | 0.14 | 1 | 6 | 0 | 0 | 2 | 4 | 2 | 12 | 37 | 4 | 29 | 17 | 24 | 4 | 27 | 15 | 24 | 3 | 1 | 1 | 6 |
4,287 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerTaskModel | from .configuration_oneformer import OneFormerConfig
from torch import Tensor, nn
class OneFormerTaskModel(nn.Module):
def __init__(self, config: OneFormerConfig):
super().__init__()
self.task_mlp = OneFormerMLPPredictionHead(config.task_seq_len, config.hidden_dim, config.hidden_dim, 2)
def f... |
class OneFormerTaskModel(nn.Module):
def __init__(self, config: OneFormerConfig):
pass
def forward(self, inputs: Tensor) -> Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 4 | 2 | 0 | 2 | 1 | 2 | 12 | 13 | 1 | 12 | 5 | 9 | 0 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
4,288 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerTextContextDecoder | from torch import Tensor, nn
class OneFormerTextContextDecoder(nn.Module):
def __init__(self, transformer_width=256, transformer_heads=4, transformer_layers=6, visual_dim=1024, dropout=0.1, layer_norm_eps=1e-05, **kwargs):
super().__init__()
self.memory_proj = nn.Sequential(nn.LayerNorm(visual_dim... |
class OneFormerTextContextDecoder(nn.Module):
def __init__(self, transformer_width=256, transformer_heads=4, transformer_layers=6, visual_dim=1024, dropout=0.1, layer_norm_eps=1e-05, **kwargs):
pass
def forward(self, text, visual):
pass | 3 | 0 | 21 | 3 | 18 | 0 | 2 | 0 | 1 | 3 | 1 | 0 | 2 | 4 | 2 | 12 | 43 | 7 | 36 | 19 | 24 | 0 | 13 | 9 | 10 | 2 | 1 | 1 | 3 |
4,289 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerTextEncoder | import torch
from torch import Tensor, nn
class OneFormerTextEncoder(nn.Module):
def __init__(self, context_length: int, width: int, layers: int, vocab_size, use_checkpoint=False, layer_norm_eps=1e-05):
super().__init__()
heads = width // 64
self.context_length = context_length
sel... |
class OneFormerTextEncoder(nn.Module):
def __init__(self, context_length: int, width: int, layers: int, vocab_size, use_checkpoint=False, layer_norm_eps=1e-05):
pass
def build_attention_mask(self):
pass
def forward(self, text):
pass | 4 | 0 | 14 | 1 | 13 | 1 | 1 | 0.08 | 1 | 4 | 1 | 0 | 3 | 6 | 3 | 13 | 45 | 4 | 39 | 21 | 27 | 3 | 24 | 13 | 20 | 1 | 1 | 0 | 3 |
4,290 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerTextMLP | from torch import Tensor, nn
import torch
from typing import Optional, Union
from ...activations import ACT2FN
class OneFormerTextMLP(nn.Module):
def __init__(self, hidden_size: Optional[int]=None, intermediate_size: Optional[int]=None, output_size: Optional[int]=None):
super().__init__()
self.act... |
class OneFormerTextMLP(nn.Module):
def __init__(self, hidden_size: Optional[int]=None, intermediate_size: Optional[int]=None, output_size: Optional[int]=None):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 9 | 0 | 9 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 12 | 20 | 1 | 19 | 11 | 11 | 0 | 14 | 6 | 11 | 1 | 1 | 0 | 2 |
4,291 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerTextMapper | import torch
from torch import Tensor, nn
from .configuration_oneformer import OneFormerConfig
class OneFormerTextMapper(nn.Module):
def __init__(self, config: OneFormerConfig):
super().__init__()
self.text_encoder = OneFormerTextEncoder(context_length=config.text_encoder_context_length, width=con... |
class OneFormerTextMapper(nn.Module):
def __init__(self, config: OneFormerConfig):
pass
def forward(self, inputs: Tensor) -> Tensor:
pass
def encode_text(self, text):
pass | 4 | 0 | 19 | 2 | 16 | 0 | 3 | 0.02 | 1 | 6 | 3 | 0 | 3 | 3 | 3 | 13 | 59 | 8 | 50 | 18 | 43 | 1 | 32 | 15 | 28 | 6 | 1 | 2 | 9 |
4,292 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerTextMapperAttention | import torch
from torch import Tensor, nn
class OneFormerTextMapperAttention(nn.Module):
def __init__(self, dim, num_heads=8, qkv_bias=False, qk_scale=None, attn_drop=0.0, proj_drop=0.0):
super().__init__()
self.num_heads = num_heads
head_dim = dim // num_heads
self.scale = qk_scal... |
class OneFormerTextMapperAttention(nn.Module):
def __init__(self, dim, num_heads=8, qkv_bias=False, qk_scale=None, attn_drop=0.0, proj_drop=0.0):
pass
def forward(self, q, k, v):
pass | 3 | 0 | 16 | 3 | 13 | 1 | 2 | 0.04 | 1 | 3 | 0 | 0 | 2 | 8 | 2 | 12 | 34 | 7 | 26 | 16 | 23 | 1 | 26 | 16 | 23 | 2 | 1 | 1 | 3 |
4,293 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerTextTransformer | import torch
from torch import Tensor, nn
from typing import Optional, Union
class OneFormerTextTransformer(nn.Module):
def __init__(self, width: int, layers: int, heads: int, attn_mask: Optional[torch.Tensor]=None, use_checkpoint=False, layer_norm_eps=1e-05):
super().__init__()
self.width = width... |
class OneFormerTextTransformer(nn.Module):
def __init__(self, width: int, layers: int, heads: int, attn_mask: Optional[torch.Tensor]=None, use_checkpoint=False, layer_norm_eps=1e-05):
pass
def forward(self, hidden_states: torch.Tensor):
pass | 3 | 0 | 12 | 0 | 12 | 0 | 2 | 0 | 1 | 5 | 1 | 0 | 2 | 4 | 2 | 12 | 25 | 1 | 24 | 17 | 13 | 0 | 13 | 8 | 10 | 3 | 1 | 2 | 4 |
4,294 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerTextTransformerDecoderLayer | from torch import Tensor, nn
class OneFormerTextTransformerDecoderLayer(nn.Module):
def __init__(self, d_model, nhead, dropout=0.1, layer_norm_eps=1e-05):
super().__init__()
self.self_attn = OneFormerTextMapperAttention(d_model, nhead, proj_drop=dropout)
self.cross_attn = OneFormerTextMapp... |
class OneFormerTextTransformerDecoderLayer(nn.Module):
def __init__(self, d_model, nhead, dropout=0.1, layer_norm_eps=1e-05):
pass
def forward(self, hidden_state, mem):
pass | 3 | 0 | 13 | 1 | 12 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 2 | 7 | 2 | 12 | 28 | 3 | 25 | 17 | 16 | 0 | 17 | 11 | 14 | 1 | 1 | 0 | 2 |
4,295 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerTextTransformerLayer | from torch import Tensor, nn
from typing import Optional, Union
from ...modeling_layers import GradientCheckpointingLayer
import torch
class OneFormerTextTransformerLayer(GradientCheckpointingLayer):
def __init__(self, width: int, heads: int, attn_mask: torch.Tensor, layer_norm_eps=1e-05):
super().__init_... |
class OneFormerTextTransformerLayer(GradientCheckpointingLayer):
def __init__(self, width: int, heads: int, attn_mask: torch.Tensor, layer_norm_eps=1e-05):
pass
def forward(self, hidden_states: torch.Tensor, key_padding_mask: Optional[torch.Tensor]=None) -> torch.FloatTensor:
pass | 3 | 0 | 15 | 2 | 14 | 0 | 1 | 0 | 1 | 4 | 1 | 0 | 2 | 5 | 2 | 12 | 32 | 4 | 28 | 13 | 21 | 0 | 18 | 9 | 15 | 1 | 1 | 0 | 2 |
4,296 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerTransformerDecoder | import torch
from torch import Tensor, nn
from .configuration_oneformer import OneFormerConfig
class OneFormerTransformerDecoder(nn.Module):
"""
Transformer decoder
"""
def __init__(self, in_channels: int, config: OneFormerConfig):
super().__init__()
self.config = config
self.d... |
class OneFormerTransformerDecoder(nn.Module):
'''
Transformer decoder
'''
def __init__(self, in_channels: int, config: OneFormerConfig):
pass
def forward(self, task_token=None, multi_stage_features=None, multi_stage_positional_embeddings=None, mask_features=None, query_features=None, quer... | 6 | 1 | 37 | 6 | 30 | 2 | 2 | 0.07 | 1 | 12 | 5 | 0 | 4 | 13 | 4 | 14 | 158 | 28 | 121 | 47 | 104 | 9 | 54 | 34 | 49 | 6 | 1 | 1 | 9 |
4,297 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerTransformerDecoderCrossAttentionLayer | from ...activations import ACT2FN
from torch import Tensor, nn
from typing import Optional, Union
class OneFormerTransformerDecoderCrossAttentionLayer(nn.Module):
def __init__(self, embed_dim, num_heads, dropout=0.0, activation='relu', normalize_before=False, layer_norm_eps=1e-05):
super().__init__()
... |
class OneFormerTransformerDecoderCrossAttentionLayer(nn.Module):
def __init__(self, embed_dim, num_heads, dropout=0.0, activation='relu', normalize_before=False, layer_norm_eps=1e-05):
pass
def with_pos_embed(self, tensor, pos: Optional[Tensor]):
pass
def forward_post(self, output, memor... | 6 | 0 | 13 | 1 | 12 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 5 | 5 | 5 | 15 | 70 | 8 | 62 | 40 | 30 | 0 | 24 | 14 | 18 | 2 | 1 | 1 | 7 |
4,298 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerTransformerDecoderFFNLayer | from torch import Tensor, nn
from typing import Optional, Union
from ...activations import ACT2FN
class OneFormerTransformerDecoderFFNLayer(nn.Module):
def __init__(self, d_model, dim_feedforward=2048, dropout=0.0, activation='relu', normalize_before=False, layer_norm_eps=1e-05):
super().__init__()
... |
class OneFormerTransformerDecoderFFNLayer(nn.Module):
def __init__(self, d_model, dim_feedforward=2048, dropout=0.0, activation='relu', normalize_before=False, layer_norm_eps=1e-05):
pass
def with_pos_embed(self, tensor, pos: Optional[Tensor]):
pass
def forward_post(self, output):
... | 6 | 0 | 7 | 0 | 6 | 0 | 1 | 0.03 | 1 | 2 | 0 | 0 | 5 | 6 | 5 | 15 | 40 | 6 | 33 | 22 | 19 | 1 | 25 | 14 | 19 | 2 | 1 | 1 | 7 |
4,299 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerTransformerDecoderLayer | from typing import Optional, Union
import torch
from .configuration_oneformer import OneFormerConfig
from torch import Tensor, nn
class OneFormerTransformerDecoderLayer(nn.Module):
def __init__(self, config: OneFormerConfig):
super().__init__()
self.embed_dim = config.hidden_dim
self.num_f... |
class OneFormerTransformerDecoderLayer(nn.Module):
def __init__(self, config: OneFormerConfig):
pass
def forward(self, index: int, output: torch.Tensor, multi_stage_features: list[torch.Tensor], multi_stage_positional_embeddings: list[torch.Tensor], attention_mask: Optional[torch.Tensor]=None, query_... | 3 | 1 | 42 | 5 | 28 | 9 | 2 | 0.32 | 1 | 8 | 4 | 0 | 2 | 5 | 2 | 12 | 85 | 11 | 57 | 21 | 45 | 18 | 18 | 12 | 15 | 2 | 1 | 1 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.