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,300 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerTransformerDecoderQueryTransformer | from torch import Tensor, nn
import torch
class OneFormerTransformerDecoderQueryTransformer(nn.Module):
def __init__(self, d_model=512, nhead=8, num_decoder_layers=6, dim_feedforward=2048, dropout=0.1, activation='relu', normalize_before=False, return_intermediate_dec=False, layer_norm_eps=1e-05):
super()... |
class OneFormerTransformerDecoderQueryTransformer(nn.Module):
def __init__(self, d_model=512, nhead=8, num_decoder_layers=6, dim_feedforward=2048, dropout=0.1, activation='relu', normalize_before=False, return_intermediate_dec=False, layer_norm_eps=1e-05):
pass
def forward(self, src, mask, query_embe... | 3 | 0 | 21 | 2 | 19 | 0 | 2 | 0 | 1 | 3 | 2 | 0 | 2 | 3 | 2 | 12 | 44 | 5 | 39 | 21 | 25 | 0 | 20 | 10 | 17 | 3 | 1 | 1 | 4 |
4,301 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerTransformerDecoderQueryTransformerDecoder | import torch
from typing import Optional, Union
from torch import Tensor, nn
class OneFormerTransformerDecoderQueryTransformerDecoder(nn.Module):
def __init__(self, decoder_layer, num_layers, norm=None, return_intermediate=False):
super().__init__()
self.layers = _get_clones(decoder_layer, num_lay... |
class OneFormerTransformerDecoderQueryTransformerDecoder(nn.Module):
def __init__(self, decoder_layer, num_layers, norm=None, return_intermediate=False):
pass
def forward(self, output, memory, output_mask: Optional[Tensor]=None, memory_mask: Optional[Tensor]=None, output_key_padding_mask: Optional[Te... | 3 | 0 | 22 | 2 | 20 | 0 | 4 | 0 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 45 | 5 | 40 | 19 | 27 | 0 | 21 | 9 | 18 | 6 | 1 | 2 | 7 |
4,302 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerTransformerDecoderQueryTransformerDecoderLayer | from typing import Optional, Union
from torch import Tensor, nn
from ...activations import ACT2FN
class OneFormerTransformerDecoderQueryTransformerDecoderLayer(nn.Module):
def __init__(self, d_model, nhead, dim_feedforward=2048, dropout=0.1, activation='relu', normalize_before=False, layer_norm_eps=1e-05):
... |
class OneFormerTransformerDecoderQueryTransformerDecoderLayer(nn.Module):
def __init__(self, d_model, nhead, dim_feedforward=2048, dropout=0.1, activation='relu', normalize_before=False, layer_norm_eps=1e-05):
pass
def with_pos_embed(self, tensor, pos: Optional[Tensor]):
pass
def forward... | 6 | 0 | 24 | 0 | 24 | 0 | 1 | 0.01 | 1 | 2 | 0 | 0 | 5 | 13 | 5 | 15 | 126 | 6 | 119 | 62 | 74 | 1 | 50 | 23 | 44 | 2 | 1 | 1 | 7 |
4,303 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerTransformerDecoderSelfAttentionLayer | from typing import Optional, Union
from torch import Tensor, nn
from ...activations import ACT2FN
class OneFormerTransformerDecoderSelfAttentionLayer(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 OneFormerTransformerDecoderSelfAttentionLayer(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, output... | 6 | 0 | 10 | 1 | 9 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 5 | 5 | 5 | 15 | 56 | 8 | 48 | 34 | 22 | 0 | 24 | 14 | 18 | 2 | 1 | 1 | 7 |
4,304 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.OneFormerTransformerModule | from torch import Tensor, nn
from .configuration_oneformer import OneFormerConfig
class OneFormerTransformerModule(nn.Module):
"""
The OneFormer's transformer module.
"""
def __init__(self, in_features: int, config: OneFormerConfig):
super().__init__()
hidden_dim = config.hidden_dim
... |
class OneFormerTransformerModule(nn.Module):
'''
The OneFormer's transformer module.
'''
def __init__(self, in_features: int, config: OneFormerConfig):
pass
def forward(self, multi_scale_features: list[Tensor], mask_features: Tensor, task_token: Tensor, output_attentions: bool=False) -> O... | 3 | 1 | 32 | 4 | 27 | 1 | 3 | 0.09 | 1 | 10 | 4 | 0 | 2 | 6 | 2 | 12 | 69 | 10 | 54 | 24 | 45 | 5 | 31 | 18 | 28 | 3 | 1 | 2 | 6 |
4,305 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/modeling_oneformer.py | transformers.models.oneformer.modeling_oneformer.PredictionBlock | from torch import Tensor, nn
class PredictionBlock(nn.Module):
def __init__(self, in_dim: int, out_dim: int, activation: nn.Module) -> None:
super().__init__()
self.layers = [nn.Linear(in_dim, out_dim), activation]
for i, layer in enumerate(self.layers):
self.add_module(str(i),... |
class PredictionBlock(nn.Module):
def __init__(self, in_dim: int, out_dim: int, activation: nn.Module) -> None:
pass
def forward(self, input: Tensor) -> Tensor:
pass | 3 | 0 | 6 | 0 | 5 | 1 | 2 | 0.09 | 1 | 5 | 0 | 0 | 2 | 1 | 2 | 12 | 13 | 1 | 11 | 7 | 8 | 1 | 11 | 7 | 8 | 2 | 1 | 1 | 4 |
4,306 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/oneformer/processing_oneformer.py | transformers.models.oneformer.processing_oneformer.OneFormerProcessor | from ...processing_utils import ProcessorMixin
class OneFormerProcessor(ProcessorMixin):
"""
Constructs an OneFormer processor which wraps [`OneFormerImageProcessor`] and
[`CLIPTokenizer`]/[`CLIPTokenizerFast`] into a single processor that inherits both the image processor and
tokenizer functionalities... |
class OneFormerProcessor(ProcessorMixin):
'''
Constructs an OneFormer processor which wraps [`OneFormerImageProcessor`] and
[`CLIPTokenizer`]/[`CLIPTokenizerFast`] into a single processor that inherits both the image processor and
tokenizer functionalities.
Args:
image_processor ([`OneForme... | 8 | 6 | 21 | 4 | 11 | 6 | 4 | 0.67 | 1 | 6 | 0 | 0 | 7 | 2 | 7 | 24 | 176 | 37 | 83 | 32 | 73 | 56 | 77 | 30 | 69 | 9 | 2 | 2 | 27 |
4,307 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/openai/configuration_openai.py | transformers.models.openai.configuration_openai.OpenAIGPTConfig | from ...configuration_utils import PretrainedConfig
class OpenAIGPTConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`OpenAIGPTModel`] or a [`TFOpenAIGPTModel`]. It is
used to instantiate a GPT model according to the specified arguments, defining the model archi... |
class OpenAIGPTConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`OpenAIGPTModel`] or a [`TFOpenAIGPTModel`]. It is
used to instantiate a GPT model according to the specified arguments, defining the model architecture.
Instantiating a configuration with the ... | 2 | 1 | 37 | 0 | 37 | 0 | 1 | 1.51 | 1 | 1 | 0 | 0 | 1 | 16 | 1 | 1 | 129 | 16 | 45 | 39 | 24 | 68 | 21 | 20 | 19 | 1 | 1 | 0 | 1 |
4,308 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/openai/modeling_openai.py | transformers.models.openai.modeling_openai.Attention | from ...pytorch_utils import Conv1D, find_pruneable_heads_and_indices, prune_conv1d_layer
import torch
from torch import nn
import math
class Attention(nn.Module):
def __init__(self, nx, n_positions, config, scale=False):
super().__init__()
n_state = nx
if n_state % config.n_head != 0:
... |
class Attention(nn.Module):
def __init__(self, nx, n_positions, config, scale=False):
pass
def prune_heads(self, heads):
pass
def _attn(self, q, k, v, attention_mask=None, head_mask=None, output_attentions=False):
pass
def merge_heads(self, x):
pass
def split_he... | 7 | 0 | 14 | 1 | 12 | 2 | 2 | 0.15 | 1 | 4 | 1 | 0 | 6 | 8 | 6 | 16 | 91 | 13 | 71 | 27 | 64 | 11 | 64 | 27 | 57 | 5 | 1 | 1 | 13 |
4,309 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/openai/modeling_openai.py | transformers.models.openai.modeling_openai.Block | from torch import nn
class Block(nn.Module):
def __init__(self, n_positions, config, scale=False):
super().__init__()
nx = config.n_embd
self.attn = Attention(nx, n_positions, config, scale)
self.ln_1 = nn.LayerNorm(nx, eps=config.layer_norm_epsilon)
self.mlp = MLP(4 * nx, ... |
class Block(nn.Module):
def __init__(self, n_positions, config, scale=False):
pass
def forward(self, x, attention_mask=None, head_mask=None, output_attentions=False):
pass | 3 | 0 | 11 | 1 | 10 | 0 | 1 | 0 | 1 | 3 | 2 | 0 | 2 | 4 | 2 | 12 | 24 | 3 | 21 | 14 | 18 | 0 | 16 | 14 | 13 | 1 | 1 | 0 | 2 |
4,310 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/openai/modeling_openai.py | transformers.models.openai.modeling_openai.MLP | from ...pytorch_utils import Conv1D, find_pruneable_heads_and_indices, prune_conv1d_layer
from torch import nn
class MLP(nn.Module):
def __init__(self, n_state, config):
super().__init__()
nx = config.n_embd
self.c_fc = Conv1D(n_state, nx)
self.c_proj = Conv1D(nx, n_state)
... |
class MLP(nn.Module):
def __init__(self, n_state, config):
pass
def forward(self, x):
pass | 3 | 0 | 6 | 0 | 6 | 1 | 1 | 0.08 | 1 | 2 | 1 | 0 | 2 | 4 | 2 | 12 | 13 | 1 | 12 | 10 | 9 | 1 | 12 | 10 | 9 | 1 | 1 | 0 | 2 |
4,311 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/openai/modeling_openai.py | transformers.models.openai.modeling_openai.OpenAIGPTDoubleHeadsModel | import torch
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from torch import nn
from typing import Any, Callable, Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
@auto_docstring(custom_intro='\n OpenAI GPT Model transformer with a language modeling and a multiple-ch... | @auto_docstring(custom_intro='\n OpenAI GPT Model transformer with a language modeling and a multiple-choice classification head on top e.g. for\n RocStories/SWAG tasks. The two heads are two linear layers. The language modeling head has its weights tied to the\n input embeddings, the classification head t... | 5 | 1 | 27 | 3 | 16 | 8 | 3 | 0.45 | 1 | 5 | 2 | 0 | 4 | 3 | 4 | 5 | 114 | 17 | 67 | 33 | 46 | 30 | 34 | 18 | 29 | 7 | 2 | 2 | 10 |
4,312 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/openai/modeling_openai.py | transformers.models.openai.modeling_openai.OpenAIGPTForSequenceClassification | from ...utils import ModelOutput, auto_docstring, logging
import torch
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Any, Callable, Optional, Union
from torch import nn
@auto_docstring(custo... | null | 5 | 1 | 50 | 5 | 41 | 5 | 9 | 0.1 | 1 | 7 | 2 | 0 | 2 | 3 | 2 | 3 | 108 | 10 | 89 | 30 | 68 | 9 | 45 | 17 | 42 | 16 | 2 | 3 | 17 |
4,313 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/openai/modeling_openai.py | transformers.models.openai.modeling_openai.OpenAIGPTLMHeadModel | from ...generation import GenerationMixin
from typing import Any, Callable, Optional, Union
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput
import torch
from ...utils import ModelOutput, auto_docstring, logging
from torch import nn
@auto_docstring(custom_intro='\n OpenAI GP... | @auto_docstring(custom_intro='\n OpenAI GPT Model transformer with a language modeling head on top (linear layer with weights tied to the input\n embeddings).\n ')
class OpenAIGPTLMHeadModel(OpenAIGPTPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
@auto_docstring
def fo... | 6 | 1 | 14 | 1 | 11 | 2 | 2 | 0.14 | 2 | 7 | 2 | 0 | 5 | 2 | 5 | 6 | 83 | 10 | 64 | 28 | 39 | 9 | 25 | 14 | 19 | 5 | 2 | 1 | 9 |
4,314 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/openai/modeling_openai.py | transformers.models.openai.modeling_openai.OpenAIGPTModel | import torch
from typing import Any, Callable, Optional, Union
from torch import nn
from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_outputs import BaseModelOutput, CausalLMOutput, SequenceClassifierOutput
@auto_docstring
class OpenAIGPTModel(OpenAIGPTPreTrainedModel):
def __init__(self,... | @auto_docstring
class OpenAIGPTModel(OpenAIGPTPreTrainedModel):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, new_embeddings):
pass
def _prune_heads(self, heads_to_prune):
'''
Prunes heads of the model. he... | 8 | 1 | 22 | 3 | 16 | 4 | 5 | 0.22 | 1 | 9 | 2 | 0 | 5 | 4 | 5 | 6 | 122 | 18 | 86 | 32 | 63 | 19 | 59 | 20 | 53 | 18 | 2 | 2 | 23 |
4,315 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/openai/modeling_openai.py | transformers.models.openai.modeling_openai.OpenAIGPTPreTrainedModel | from torch import nn
from ...utils import ModelOutput, auto_docstring, logging
from ...modeling_utils import PreTrainedModel
from ...pytorch_utils import Conv1D, find_pruneable_heads_and_indices, prune_conv1d_layer
from .configuration_openai import OpenAIGPTConfig
@auto_docstring
class OpenAIGPTPreTrainedModel(PreTrai... | @auto_docstring
class OpenAIGPTPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights.'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.44 | 1 | 1 | 1 | 4 | 1 | 0 | 1 | 1 | 25 | 2 | 16 | 5 | 14 | 7 | 14 | 5 | 12 | 6 | 1 | 2 | 6 |
4,316 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/openai/tokenization_openai.py | transformers.models.openai.tokenization_openai.OpenAIGPTTokenizer | from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
import json
import os
from typing import Optional
class OpenAIGPTTokenizer(PreTrainedTokenizer):
"""
Construct a GPT Tokenizer. Based on Byte-Pair-Encoding with the following peculiarities:
- lowercases all... |
class OpenAIGPTTokenizer(PreTrainedTokenizer):
'''
Construct a GPT Tokenizer. Based on Byte-Pair-Encoding with the following peculiarities:
- lowercases all inputs,
- uses `SpaCy` tokenizer and `ftfy` for pre-BPE tokenization if they are installed, fallback to BERT's
`BasicTokenizer` if not.
... | 13 | 5 | 12 | 1 | 11 | 1 | 3 | 0.2 | 1 | 11 | 1 | 0 | 10 | 6 | 10 | 99 | 159 | 23 | 114 | 43 | 99 | 23 | 102 | 37 | 89 | 10 | 3 | 3 | 28 |
4,317 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/openai/tokenization_openai_fast.py | transformers.models.openai.tokenization_openai_fast.OpenAIGPTTokenizerFast | from typing import Optional
from .tokenization_openai import OpenAIGPTTokenizer
from ...tokenization_utils_fast import PreTrainedTokenizerFast
class OpenAIGPTTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" GPT Tokenizer (backed by HuggingFace's *tokenizers* library). Based on Byte-Pair-Encoding ... |
class OpenAIGPTTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" GPT Tokenizer (backed by HuggingFace's *tokenizers* library). Based on Byte-Pair-Encoding with
the following peculiarities:
- lower case all inputs
- uses BERT's BasicTokenizer for pre-BPE tokenization
This tokenizer ... | 5 | 1 | 2 | 0 | 2 | 0 | 1 | 1.33 | 1 | 3 | 0 | 0 | 3 | 0 | 3 | 91 | 35 | 7 | 12 | 9 | 7 | 16 | 11 | 8 | 7 | 1 | 3 | 0 | 3 |
4,318 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/opt/configuration_opt.py | transformers.models.opt.configuration_opt.OPTConfig | from ...configuration_utils import PretrainedConfig
class OPTConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`OPTModel`]. It is used to instantiate a OPT model
according to the specified arguments, defining the model architecture. Instantiating a configuration... |
class OPTConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`OPTModel`]. It is used to instantiate a OPT model
according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar configur... | 2 | 1 | 52 | 1 | 47 | 4 | 2 | 1.18 | 1 | 1 | 0 | 0 | 1 | 17 | 1 | 1 | 120 | 11 | 50 | 44 | 25 | 59 | 22 | 21 | 20 | 2 | 1 | 0 | 2 |
4,319 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/opt/modeling_opt.py | transformers.models.opt.modeling_opt.OPTAttention | from torch import nn
from .configuration_opt import OPTConfig
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
import torch
from ...cache_utils import Cache, DynamicCache
from typing import Callable, Optional, Union
from ...utils.deprecation import deprecate_kwarg
class OPTAttention(nn.Module):
... |
class OPTAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: OPTConfig, layer_idx: Optional[int]=None, **kwargs):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states... | 4 | 2 | 50 | 7 | 35 | 8 | 5 | 0.23 | 1 | 6 | 1 | 2 | 3 | 13 | 3 | 13 | 156 | 24 | 107 | 42 | 89 | 25 | 72 | 28 | 68 | 13 | 1 | 2 | 16 |
4,320 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/opt/modeling_opt.py | transformers.models.opt.modeling_opt.OPTDecoder | from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast
from ...cache_utils import Cache, DynamicCache
from ...modeling_attn_mask_utils import AttentionMaskConverter
from ...processing_utils import Unpack
from .configuration_opt imp... |
class OPTDecoder(OPTPreTrainedModel):
'''
Transformer decoder consisting of *config.num_hidden_layers* layers. Each layer is a [`OPTDecoderLayer`]
Args:
config: OPTConfig
'''
def __init__(self, config: OPTConfig):
pass
def _update_causal_mask(self, attention_mask: Union[torch.... | 7 | 3 | 55 | 8 | 35 | 11 | 10 | 0.35 | 1 | 13 | 4 | 0 | 5 | 14 | 5 | 6 | 285 | 48 | 175 | 57 | 149 | 62 | 102 | 37 | 96 | 36 | 2 | 3 | 49 |
4,321 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/opt/modeling_opt.py | transformers.models.opt.modeling_opt.OPTDecoderLayer | from ...utils.deprecation import deprecate_kwarg
from typing import Callable, Optional, Union
from ...modeling_flash_attention_utils import FlashAttentionKwargs
from ...activations import ACT2FN
from .configuration_opt import OPTConfig
from ...processing_utils import Unpack
import torch
from torch import nn
from ...mod... |
class OPTDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: OPTConfig, layer_idx: Optional[int]=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, l... | 4 | 1 | 47 | 9 | 28 | 11 | 4 | 0.37 | 1 | 4 | 1 | 0 | 2 | 9 | 2 | 12 | 96 | 18 | 57 | 25 | 45 | 21 | 39 | 16 | 36 | 7 | 1 | 1 | 8 |
4,322 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/opt/modeling_opt.py | transformers.models.opt.modeling_opt.OPTForCausalLM | from typing import Callable, Optional, Union
import torch
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging
from ...processing_utils import Unpack
from torch import nn
from ...generation import GenerationMixin
from ...cache_utils import Cache, DynamicCache
... |
class OPTForCausalLM(OPTPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
def set_decoder(self, decoder):
pass
def get_decoder(self):
pass
@can_return_... | 9 | 1 | 18 | 3 | 8 | 7 | 2 | 0.84 | 2 | 6 | 2 | 0 | 8 | 2 | 9 | 10 | 179 | 32 | 80 | 35 | 54 | 67 | 38 | 19 | 28 | 7 | 2 | 1 | 16 |
4,323 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/opt/modeling_opt.py | transformers.models.opt.modeling_opt.OPTForQuestionAnswering | from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast
from torch import nn
from ...cache_utils import Cache, DynamicCache
from .configuration_opt import OPTConfig
from typing import Callable, Optional, Union
from torch.nn import B... | @auto_docstring
class OPTForQuestionAnswering(OPTPreTrainedModel):
def __init__(self, config: OPTConfig):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, past_key_values... | 7 | 1 | 30 | 4 | 16 | 9 | 3 | 0.53 | 1 | 6 | 3 | 0 | 4 | 2 | 4 | 5 | 124 | 20 | 68 | 32 | 47 | 36 | 35 | 17 | 30 | 7 | 2 | 2 | 10 |
4,324 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/opt/modeling_opt.py | transformers.models.opt.modeling_opt.OPTForSequenceClassification | from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, QuestionAnsweringModelOutput, SequenceClassifierOutputWithPast
from ...cache_utils import Cache, DynamicCache
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...utils import TransformersKwargs, auto_docstring, can_re... | null | 7 | 1 | 26 | 2 | 22 | 2 | 5 | 0.08 | 1 | 8 | 3 | 0 | 4 | 3 | 4 | 5 | 117 | 11 | 98 | 33 | 72 | 8 | 49 | 19 | 44 | 16 | 2 | 3 | 19 |
4,325 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/opt/modeling_opt.py | transformers.models.opt.modeling_opt.OPTLearnedPositionalEmbedding | from typing import Callable, Optional, Union
import torch
from torch import nn
class OPTLearnedPositionalEmbedding(nn.Embedding):
"""
This module learns positional embeddings up to a fixed maximum size.
"""
def __init__(self, num_embeddings: int, embedding_dim: int):
self.offset = 2
su... |
class OPTLearnedPositionalEmbedding(nn.Embedding):
'''
This module learns positional embeddings up to a fixed maximum size.
'''
def __init__(self, num_embeddings: int, embedding_dim: int):
pass
def forward(self, attention_mask: torch.LongTensor, past_key_values_length: int=0, position_ids... | 3 | 2 | 10 | 1 | 7 | 2 | 2 | 0.47 | 1 | 2 | 0 | 0 | 2 | 1 | 2 | 2 | 26 | 4 | 15 | 9 | 7 | 7 | 10 | 4 | 7 | 2 | 1 | 1 | 3 |
4,326 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/opt/modeling_opt.py | transformers.models.opt.modeling_opt.OPTModel | from ...modeling_flash_attention_utils import FlashAttentionKwargs
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging
from ...processing_utils import Unpack
from .configuration_opt import OPTConfig
from ...cache_utils import Cache, DynamicCache
import torch
... | @auto_docstring
class OPTModel(OPTPreTrainedModel):
def __init__(self, config: OPTConfig):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=No... | 8 | 0 | 11 | 1 | 10 | 0 | 2 | 0.04 | 1 | 6 | 3 | 0 | 5 | 1 | 5 | 6 | 66 | 7 | 57 | 21 | 32 | 2 | 20 | 8 | 14 | 6 | 2 | 1 | 10 |
4,327 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/opt/modeling_opt.py | transformers.models.opt.modeling_opt.OPTPreTrainedModel | from torch import nn
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_opt import OPTConfig
@auto_docstring
class OPTPreTrainedModel(PreTrainedModel):
config: OP... | @auto_docstring
class OPTPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 10 | 0 | 10 | 0 | 5 | 0 | 1 | 0 | 0 | 5 | 1 | 0 | 1 | 1 | 18 | 1 | 17 | 9 | 15 | 0 | 16 | 9 | 14 | 5 | 1 | 2 | 5 |
4,328 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/configuration_owlv2.py | transformers.models.owlv2.configuration_owlv2.Owlv2Config | from ...configuration_utils import PretrainedConfig
class Owlv2Config(PretrainedConfig):
"""
[`Owlv2Config`] is the configuration class to store the configuration of an [`Owlv2Model`]. It is used to
instantiate an OWLv2 model according to the specified arguments, defining the text model and vision model
... |
class Owlv2Config(PretrainedConfig):
'''
[`Owlv2Config`] is the configuration class to store the configuration of an [`Owlv2Model`]. It is used to
instantiate an OWLv2 model according to the specified arguments, defining the text model and vision model
configs. Instantiating a configuration with the de... | 4 | 2 | 20 | 3 | 14 | 3 | 2 | 0.9 | 1 | 3 | 2 | 0 | 1 | 6 | 2 | 2 | 70 | 11 | 31 | 21 | 19 | 28 | 22 | 12 | 19 | 3 | 1 | 1 | 4 |
4,329 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/configuration_owlv2.py | transformers.models.owlv2.configuration_owlv2.Owlv2TextConfig | from ...configuration_utils import PretrainedConfig
class Owlv2TextConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of an [`Owlv2TextModel`]. It is used to instantiate an
Owlv2 text encoder according to the specified arguments, defining the model architecture. Instan... |
class Owlv2TextConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of an [`Owlv2TextModel`]. It is used to instantiate an
Owlv2 text encoder according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will y... | 2 | 1 | 31 | 1 | 30 | 0 | 1 | 1.52 | 1 | 1 | 0 | 0 | 1 | 11 | 1 | 1 | 94 | 11 | 33 | 32 | 14 | 50 | 16 | 15 | 14 | 1 | 1 | 0 | 1 |
4,330 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/configuration_owlv2.py | transformers.models.owlv2.configuration_owlv2.Owlv2VisionConfig | from ...configuration_utils import PretrainedConfig
class Owlv2VisionConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of an [`Owlv2VisionModel`]. It is used to instantiate
an OWLv2 image encoder according to the specified arguments, defining the model architecture. I... |
class Owlv2VisionConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of an [`Owlv2VisionModel`]. It is used to instantiate
an OWLv2 image encoder according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults w... | 2 | 1 | 30 | 1 | 29 | 0 | 1 | 1.38 | 1 | 1 | 0 | 0 | 1 | 12 | 1 | 1 | 86 | 10 | 32 | 31 | 15 | 44 | 17 | 16 | 15 | 1 | 1 | 0 | 1 |
4,331 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/image_processing_owlv2.py | transformers.models.owlv2.image_processing_owlv2.Owlv2ImageProcessor | from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from typing import TYPE_CHECKING, Optional, Union
from ...image_transforms import center_to_corners_format, pad, to_channel_dimension_format
import numpy as np
from ...utils import TensorType, filter_out_non_signature_kwargs, is_scipy... |
class Owlv2ImageProcessor(BaseImageProcessor):
'''
Constructs an OWLv2 image processor.
Args:
do_rescale (`bool`, *optional*, defaults to `True`):
Whether to rescale the image by the specified scale `rescale_factor`. Can be overridden by `do_rescale` in
the `preprocess` meth... | 8 | 6 | 63 | 7 | 35 | 21 | 7 | 0.74 | 1 | 10 | 2 | 0 | 6 | 9 | 6 | 26 | 422 | 52 | 214 | 97 | 161 | 158 | 127 | 51 | 120 | 16 | 3 | 4 | 41 |
4,332 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/modeling_owlv2.py | transformers.models.owlv2.modeling_owlv2.Owlv2Attention | from torch import Tensor, nn
import torch
from typing import Any, Optional, Union
class Owlv2Attention(nn.Module):
"""Multi-headed attention from 'Attention Is All You Need' paper"""
def __init__(self, config):
super().__init__()
self.config = config
self.embed_dim = config.hidden_size... |
class Owlv2Attention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config):
pass
def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Ten... | 4 | 2 | 33 | 6 | 25 | 3 | 4 | 0.12 | 1 | 5 | 0 | 0 | 3 | 10 | 3 | 13 | 105 | 20 | 76 | 30 | 66 | 9 | 55 | 24 | 51 | 8 | 1 | 2 | 11 |
4,333 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/modeling_owlv2.py | transformers.models.owlv2.modeling_owlv2.Owlv2BoxPredictionHead | from .configuration_owlv2 import Owlv2Config, Owlv2TextConfig, Owlv2VisionConfig
from torch import Tensor, nn
import torch
class Owlv2BoxPredictionHead(nn.Module):
def __init__(self, config: Owlv2Config, out_dim: int=4):
super().__init__()
width = config.vision_config.hidden_size
self.dens... |
class Owlv2BoxPredictionHead(nn.Module):
def __init__(self, config: Owlv2Config, out_dim: int=4):
pass
def forward(self, image_features: torch.Tensor) -> torch.FloatTensor:
pass | 3 | 0 | 8 | 1 | 7 | 0 | 1 | 0 | 1 | 4 | 1 | 0 | 2 | 4 | 2 | 12 | 17 | 2 | 15 | 9 | 12 | 0 | 15 | 9 | 12 | 1 | 1 | 0 | 2 |
4,334 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/modeling_owlv2.py | transformers.models.owlv2.modeling_owlv2.Owlv2ClassPredictionHead | from torch import Tensor, nn
from typing import Any, Optional, Union
from .configuration_owlv2 import Owlv2Config, Owlv2TextConfig, Owlv2VisionConfig
import torch
class Owlv2ClassPredictionHead(nn.Module):
def __init__(self, config: Owlv2Config):
super().__init__()
out_dim = config.text_config.hid... |
class Owlv2ClassPredictionHead(nn.Module):
def __init__(self, config: Owlv2Config):
pass
def forward(self, image_embeds: torch.FloatTensor, query_embeds: Optional[torch.FloatTensor], query_mask: Optional[torch.Tensor]) -> tuple[torch.FloatTensor]:
pass | 3 | 0 | 22 | 4 | 17 | 2 | 3 | 0.09 | 1 | 3 | 1 | 0 | 2 | 5 | 2 | 12 | 46 | 9 | 34 | 20 | 26 | 3 | 29 | 15 | 26 | 4 | 1 | 2 | 5 |
4,335 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/modeling_owlv2.py | transformers.models.owlv2.modeling_owlv2.Owlv2Encoder | from typing import Any, Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from torch import Tensor, nn
import torch
from .configuration_owlv2 import Owlv2Config, Owlv2TextConfig, Owlv2VisionConfig
class Owlv2Encoder(nn.Module):
"""
Transformer encoder consisting of `co... |
class Owlv2Encoder(nn.Module):
'''
Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a
[`Owlv2EncoderLayer`].
Args:
config: Owlv2Config
'''
def __init__(self, config: Owlv2Config):
pass
def forward(self, inputs_embeds, attent... | 3 | 2 | 39 | 3 | 25 | 11 | 7 | 0.56 | 1 | 8 | 3 | 0 | 2 | 2 | 2 | 12 | 87 | 9 | 50 | 18 | 39 | 28 | 26 | 10 | 23 | 12 | 1 | 2 | 13 |
4,336 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/modeling_owlv2.py | transformers.models.owlv2.modeling_owlv2.Owlv2EncoderLayer | from .configuration_owlv2 import Owlv2Config, Owlv2TextConfig, Owlv2VisionConfig
from typing import Any, Optional, Union
from ...modeling_layers import GradientCheckpointingLayer
import torch
from torch import Tensor, nn
class Owlv2EncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Owlv2Config):... |
class Owlv2EncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Owlv2Config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, causal_attention_mask: torch.Tensor, output_attentions: Optional[bool]=False) -> tuple[torch.FloatTensor]:
'''
... | 3 | 1 | 23 | 3 | 16 | 5 | 2 | 0.31 | 1 | 6 | 3 | 0 | 2 | 5 | 2 | 12 | 48 | 6 | 32 | 17 | 23 | 10 | 21 | 11 | 18 | 2 | 1 | 1 | 3 |
4,337 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/modeling_owlv2.py | transformers.models.owlv2.modeling_owlv2.Owlv2ForObjectDetection | from typing import Any, Optional, Union
from torch import Tensor, nn
import torch
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
from functools import lru_cache
from .configuration_owlv2 import Owlv2Config, Owlv2TextConfig, Owlv2VisionConfig
c... |
class Owlv2ForObjectDetection(Owlv2PreTrainedModel):
def __init__(self, config: Owlv2Config):
pass
@staticmethod
def normalize_grid_corner_coordinates(num_patches_height: int, num_patches_width: int) -> torch.Tensor:
pass
def objectness_predictor(self, image_features: torch.FloatTenso... | 16 | 5 | 43 | 5 | 25 | 12 | 2 | 0.49 | 1 | 13 | 6 | 0 | 10 | 10 | 11 | 12 | 497 | 70 | 287 | 144 | 221 | 140 | 152 | 92 | 140 | 5 | 2 | 2 | 27 |
4,338 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/modeling_owlv2.py | transformers.models.owlv2.modeling_owlv2.Owlv2ImageGuidedObjectDetectionOutput | from typing import Any, Optional, Union
import torch
from dataclasses import dataclass
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
@dataclass
@auto_docstring(custom... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`Owlv2ForObjectDetection.image_guided_detection`].\n ')
class Owlv2ImageGuidedObjectDetectionOutput(ModelOutput):
'''
logits (`torch.FloatTensor` of shape `(batch_size, num_patches, num_queries)`):
Classification logits (including no-obje... | 4 | 1 | 5 | 0 | 5 | 0 | 2 | 2.07 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 46 | 3 | 14 | 10 | 12 | 29 | 11 | 10 | 9 | 2 | 1 | 0 | 2 |
4,339 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/modeling_owlv2.py | transformers.models.owlv2.modeling_owlv2.Owlv2MLP | from torch import Tensor, nn
import torch
from ...activations import ACT2FN
class Owlv2MLP(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.activation_fn = ACT2FN[config.hidden_act]
self.fc1 = nn.Linear(config.hidden_size, config.intermediate_siz... |
class Owlv2MLP(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 13 | 1 | 12 | 7 | 9 | 0 | 12 | 7 | 9 | 1 | 1 | 0 | 2 |
4,340 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/modeling_owlv2.py | transformers.models.owlv2.modeling_owlv2.Owlv2Model | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from torch import Tensor, nn
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
from .configuration_owlv2 import Owlv2Config, Owlv2TextConfig, Owlv2VisionConfig
from typing... | @auto_docstring
class Owlv2Model(Owlv2PreTrainedModel):
def __init__(self, config: Owlv2Config):
pass
@filter_out_non_signature_kwargs()
@auto_docstring
def get_text_features(self, input_ids: torch.Tensor, attention_mask: Optional[torch.Tensor]=None) -> torch.FloatTensor:
'''
in... | 11 | 3 | 49 | 7 | 29 | 14 | 4 | 0.45 | 1 | 11 | 6 | 0 | 4 | 8 | 4 | 5 | 207 | 32 | 121 | 60 | 87 | 54 | 56 | 32 | 51 | 7 | 2 | 1 | 16 |
4,341 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/modeling_owlv2.py | transformers.models.owlv2.modeling_owlv2.Owlv2ObjectDetectionOutput | from dataclasses import dataclass
from typing import Any, Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
import torch
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
@dataclass
@auto_docstring(custom... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`Owlv2ForObjectDetection`].\n ')
class Owlv2ObjectDetectionOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` are provided)):
Total loss as a linear combination of a negative log-likehoo... | 4 | 1 | 5 | 0 | 5 | 0 | 2 | 2 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 51 | 3 | 16 | 12 | 14 | 32 | 13 | 12 | 11 | 2 | 1 | 0 | 2 |
4,342 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/modeling_owlv2.py | transformers.models.owlv2.modeling_owlv2.Owlv2Output | from typing import Any, Optional, Union
import torch
from dataclasses import dataclass
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
@dataclass
@auto_docstring
class ... | @dataclass
@auto_docstring
class Owlv2Output(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `return_loss` is `True`):
Contrastive loss for image-text similarity.
logits_per_image (`torch.FloatTensor` of shape `(image_batch_size, text_batch_size)`):
The... | 4 | 1 | 5 | 0 | 5 | 0 | 2 | 1.54 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 35 | 2 | 13 | 9 | 11 | 20 | 10 | 9 | 8 | 2 | 1 | 0 | 2 |
4,343 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/modeling_owlv2.py | transformers.models.owlv2.modeling_owlv2.Owlv2PreTrainedModel | from .configuration_owlv2 import Owlv2Config, Owlv2TextConfig, Owlv2VisionConfig
from torch import Tensor, nn
from ...modeling_utils import PreTrainedModel
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
@auto_docstring
class Owlv2PreTrainedMod... | @auto_docstring
class Owlv2PreTrainedModel(PreTrainedModel):
def _init_weights(self, module: nn.Module):
'''Initialize the weights'''
pass | 3 | 1 | 39 | 0 | 38 | 1 | 8 | 0.12 | 1 | 5 | 5 | 4 | 1 | 0 | 1 | 1 | 50 | 2 | 43 | 10 | 41 | 5 | 33 | 10 | 31 | 8 | 1 | 1 | 8 |
4,344 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/modeling_owlv2.py | transformers.models.owlv2.modeling_owlv2.Owlv2TextEmbeddings | from torch import Tensor, nn
import torch
from .configuration_owlv2 import Owlv2Config, Owlv2TextConfig, Owlv2VisionConfig
from typing import Any, Optional, Union
class Owlv2TextEmbeddings(nn.Module):
def __init__(self, config: Owlv2TextConfig):
super().__init__()
self.token_embedding = nn.Embeddi... |
class Owlv2TextEmbeddings(nn.Module):
def __init__(self, config: Owlv2TextConfig):
pass
def forward(self, input_ids: Optional[torch.LongTensor]=None, position_ids: Optional[torch.LongTensor]=None, inputs_embeds: Optional[torch.FloatTensor]=None) -> torch.Tensor:
pass | 3 | 0 | 14 | 3 | 11 | 1 | 3 | 0.05 | 1 | 3 | 1 | 0 | 2 | 2 | 2 | 12 | 29 | 6 | 22 | 13 | 14 | 1 | 15 | 8 | 12 | 4 | 1 | 1 | 5 |
4,345 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/modeling_owlv2.py | transformers.models.owlv2.modeling_owlv2.Owlv2TextModel | from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
from torch import Tensor, nn
from typing import Any, Optional, Union
import torch
from .configuration_owlv2 import Owlv2Config, Owlv2TextConfig, Owlv2VisionConfig
from ...modeling_outputs import Ba... |
class Owlv2TextModel(Owlv2PreTrainedModel):
def __init__(self, config: Owlv2TextConfig):
pass
def get_input_embeddings(self) -> nn.Module:
pass
def set_input_embeddings(self, value):
pass
@auto_docstring
def forward(self, input_ids: torch.Tensor, attention_mask: Optional[... | 6 | 1 | 11 | 1 | 6 | 4 | 1 | 0.59 | 1 | 6 | 3 | 0 | 4 | 1 | 4 | 5 | 50 | 7 | 27 | 15 | 13 | 16 | 12 | 7 | 7 | 1 | 2 | 0 | 4 |
4,346 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/modeling_owlv2.py | transformers.models.owlv2.modeling_owlv2.Owlv2TextTransformer | import torch
from typing import Any, Optional, Union
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from ...modeling_attn_mask_utils import _create_4d_causal_attention_... |
class Owlv2TextTransformer(nn.Module):
def __init__(self, config: Owlv2TextConfig):
pass
@auto_docstring
def forward(self, input_ids: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.Tensor]=None, output_attentions: Optional[bool]=None, output_hidden_states: ... | 4 | 1 | 34 | 4 | 26 | 5 | 4 | 0.19 | 1 | 8 | 4 | 0 | 2 | 4 | 2 | 12 | 72 | 8 | 54 | 23 | 41 | 10 | 25 | 14 | 22 | 6 | 1 | 1 | 7 |
4,347 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/modeling_owlv2.py | transformers.models.owlv2.modeling_owlv2.Owlv2VisionEmbeddings | import torch
from .configuration_owlv2 import Owlv2Config, Owlv2TextConfig, Owlv2VisionConfig
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
from torch import Tensor, nn
class Owlv2VisionEmbeddings(nn.Module):
def __init__(self, config: O... |
class Owlv2VisionEmbeddings(nn.Module):
def __init__(self, config: Owlv2VisionConfig):
pass
def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width: int) -> torch.Tensor:
'''
This method allows to interpolate the pre-trained position encodings, to be able to us... | 4 | 1 | 24 | 4 | 17 | 3 | 2 | 0.2 | 1 | 5 | 1 | 0 | 3 | 8 | 3 | 13 | 75 | 15 | 51 | 25 | 47 | 10 | 39 | 25 | 35 | 2 | 1 | 1 | 5 |
4,348 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/modeling_owlv2.py | transformers.models.owlv2.modeling_owlv2.Owlv2VisionModel | from torch import Tensor, nn
from typing import Any, Optional, Union
import torch
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from .configuration_owlv2 import Owlv2C... |
class Owlv2VisionModel(Owlv2PreTrainedModel):
def __init__(self, config: Owlv2VisionConfig):
pass
def get_input_embeddings(self) -> nn.Module:
pass
@auto_docstring
def forward(self, pixel_values: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=None, output_hidden_s... | 5 | 1 | 14 | 1 | 7 | 6 | 1 | 0.65 | 1 | 5 | 3 | 0 | 3 | 1 | 3 | 4 | 50 | 7 | 26 | 15 | 13 | 17 | 11 | 7 | 7 | 1 | 2 | 0 | 3 |
4,349 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/modeling_owlv2.py | transformers.models.owlv2.modeling_owlv2.Owlv2VisionTransformer | from typing import Any, Optional, Union
from .configuration_owlv2 import Owlv2Config, Owlv2TextConfig, Owlv2VisionConfig
import torch
from torch import Tensor, nn
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
from ...modeling_outputs import Ba... |
class Owlv2VisionTransformer(nn.Module):
def __init__(self, config: Owlv2VisionConfig):
pass
@auto_docstring
def forward(self, pixel_values: torch.FloatTensor, output_attentions: Optional[bool]=None, output_hidden_states: Optional[bool]=None, interpolate_pos_encoding: Optional[bool]=False, return_... | 4 | 0 | 27 | 4 | 21 | 2 | 3 | 0.09 | 1 | 6 | 4 | 0 | 2 | 5 | 2 | 12 | 57 | 9 | 44 | 21 | 32 | 4 | 23 | 13 | 20 | 5 | 1 | 1 | 6 |
4,350 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlv2/processing_owlv2.py | transformers.models.owlv2.processing_owlv2.Owlv2Processor | import warnings
from typing import TYPE_CHECKING, Optional, Union
from ...image_utils import ImageInput
from ...tokenization_utils_base import PreTokenizedInput, TextInput
from ...image_processing_utils import BatchFeature
from ...utils import TensorType, is_torch_available
from ...processing_utils import ImagesKwargs,... |
class Owlv2Processor(ProcessorMixin):
'''
Constructs an Owlv2 processor which wraps [`Owlv2ImageProcessor`]/[`Owlv2ImageProcessorFast`] and [`CLIPTokenizer`]/[`CLIPTokenizerFast`] into
a single processor that inherits both the image processor and tokenizer functionalities. See the
[`~OwlViTProcessor.__... | 6 | 5 | 31 | 4 | 14 | 13 | 4 | 1.02 | 1 | 9 | 1 | 0 | 7 | 0 | 7 | 24 | 243 | 35 | 103 | 36 | 80 | 105 | 69 | 24 | 58 | 16 | 2 | 4 | 26 |
4,351 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/configuration_owlvit.py | transformers.models.owlvit.configuration_owlvit.OwlViTConfig | from ...configuration_utils import PretrainedConfig
class OwlViTConfig(PretrainedConfig):
"""
[`OwlViTConfig`] is the configuration class to store the configuration of an [`OwlViTModel`]. It is used to
instantiate an OWL-ViT model according to the specified arguments, defining the text model and vision mod... |
class OwlViTConfig(PretrainedConfig):
'''
[`OwlViTConfig`] is the configuration class to store the configuration of an [`OwlViTModel`]. It is used to
instantiate an OWL-ViT model according to the specified arguments, defining the text model and vision model
configs. Instantiating a configuration with t... | 4 | 2 | 20 | 3 | 14 | 3 | 2 | 0.9 | 1 | 3 | 2 | 0 | 1 | 6 | 2 | 2 | 70 | 11 | 31 | 21 | 19 | 28 | 22 | 12 | 19 | 3 | 1 | 1 | 4 |
4,352 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/configuration_owlvit.py | transformers.models.owlvit.configuration_owlvit.OwlViTOnnxConfig | from ...onnx import OnnxConfig
from typing import TYPE_CHECKING, Any
from collections.abc import Mapping
from collections import OrderedDict
class OwlViTOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
return OrderedDict([('input_ids', {0: 'batch', 1: 'sequence'})... |
class OwlViTOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def outputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def atol_for_validation(self) -> float:
pass
def generate_dummy_inputs(self, proce... | 10 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 6 | 0 | 0 | 5 | 0 | 5 | 5 | 44 | 4 | 40 | 18 | 24 | 0 | 13 | 8 | 7 | 1 | 1 | 0 | 5 |
4,353 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/configuration_owlvit.py | transformers.models.owlvit.configuration_owlvit.OwlViTTextConfig | from ...configuration_utils import PretrainedConfig
class OwlViTTextConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of an [`OwlViTTextModel`]. It is used to instantiate an
OwlViT text encoder according to the specified arguments, defining the model architecture. Ins... |
class OwlViTTextConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of an [`OwlViTTextModel`]. It is used to instantiate an
OwlViT text encoder according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults wil... | 2 | 1 | 31 | 1 | 30 | 0 | 1 | 1.52 | 1 | 1 | 0 | 0 | 1 | 11 | 1 | 1 | 94 | 11 | 33 | 32 | 14 | 50 | 16 | 15 | 14 | 1 | 1 | 0 | 1 |
4,354 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/configuration_owlvit.py | transformers.models.owlvit.configuration_owlvit.OwlViTVisionConfig | from ...configuration_utils import PretrainedConfig
class OwlViTVisionConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of an [`OwlViTVisionModel`]. It is used to instantiate
an OWL-ViT image encoder according to the specified arguments, defining the model architectur... |
class OwlViTVisionConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of an [`OwlViTVisionModel`]. It is used to instantiate
an OWL-ViT image encoder according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaul... | 2 | 1 | 30 | 1 | 29 | 0 | 1 | 1.38 | 1 | 1 | 0 | 0 | 1 | 12 | 1 | 1 | 86 | 10 | 32 | 31 | 15 | 44 | 17 | 16 | 15 | 1 | 1 | 0 | 1 |
4,355 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/feature_extraction_owlvit.py | transformers.models.owlvit.feature_extraction_owlvit.OwlViTFeatureExtractor | from .image_processing_owlvit import OwlViTImageProcessor
import warnings
from ...utils.import_utils import requires
@requires(backends=('vision',))
class OwlViTFeatureExtractor(OwlViTImageProcessor):
def __init__(self, *args, **kwargs) -> None:
warnings.warn('The class OwlViTFeatureExtractor is deprecate... | @requires(backends=('vision',))
class OwlViTFeatureExtractor(OwlViTImageProcessor):
def __init__(self, *args, **kwargs) -> None:
pass | 3 | 0 | 7 | 0 | 7 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 29 | 8 | 0 | 8 | 2 | 6 | 0 | 4 | 2 | 2 | 1 | 4 | 0 | 1 |
4,356 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/image_processing_owlvit.py | transformers.models.owlvit.image_processing_owlvit.OwlViTImageProcessor | import numpy as np
from ...utils import TensorType, filter_out_non_signature_kwargs, is_torch_available, logging
import warnings
from ...utils.import_utils import requires
from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from typing import TYPE_CHECKING, Optional, Union
from ...imag... | @requires(backends=('vision',))
class OwlViTImageProcessor(BaseImageProcessor):
'''
Constructs an OWL-ViT image processor.
This image processor inherits from [`ImageProcessingMixin`] which contains most of the main methods. Users should
refer to this superclass for more information regarding those metho... | 11 | 8 | 56 | 6 | 29 | 21 | 6 | 0.85 | 1 | 11 | 2 | 1 | 8 | 10 | 8 | 28 | 498 | 61 | 237 | 107 | 172 | 201 | 134 | 51 | 125 | 18 | 3 | 4 | 46 |
4,357 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/modeling_owlvit.py | transformers.models.owlvit.modeling_owlvit.OwlViTAttention | from typing import Any, Optional, Union
import torch
from torch import Tensor, nn
class OwlViTAttention(nn.Module):
"""Multi-headed attention from 'Attention Is All You Need' paper"""
def __init__(self, config):
super().__init__()
self.config = config
self.embed_dim = config.hidden_siz... |
class OwlViTAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config):
pass
def _shape(self, tensor: torch.Tensor, seq_len: int, bsz: int):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Te... | 4 | 2 | 33 | 6 | 25 | 3 | 4 | 0.12 | 1 | 5 | 0 | 0 | 3 | 10 | 3 | 13 | 105 | 20 | 76 | 30 | 66 | 9 | 55 | 24 | 51 | 8 | 1 | 2 | 11 |
4,358 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/modeling_owlvit.py | transformers.models.owlvit.modeling_owlvit.OwlViTBoxPredictionHead | from torch import Tensor, nn
from .configuration_owlvit import OwlViTConfig, OwlViTTextConfig, OwlViTVisionConfig
import torch
class OwlViTBoxPredictionHead(nn.Module):
def __init__(self, config: OwlViTConfig, out_dim: int=4):
super().__init__()
width = config.vision_config.hidden_size
sel... |
class OwlViTBoxPredictionHead(nn.Module):
def __init__(self, config: OwlViTConfig, out_dim: int=4):
pass
def forward(self, image_features: torch.Tensor) -> torch.FloatTensor:
pass | 3 | 0 | 8 | 1 | 7 | 0 | 1 | 0 | 1 | 4 | 1 | 0 | 2 | 4 | 2 | 12 | 17 | 2 | 15 | 9 | 12 | 0 | 15 | 9 | 12 | 1 | 1 | 0 | 2 |
4,359 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/modeling_owlvit.py | transformers.models.owlvit.modeling_owlvit.OwlViTClassPredictionHead | from .configuration_owlvit import OwlViTConfig, OwlViTTextConfig, OwlViTVisionConfig
import torch
from torch import Tensor, nn
from typing import Any, Optional, Union
class OwlViTClassPredictionHead(nn.Module):
def __init__(self, config: OwlViTConfig):
super().__init__()
out_dim = config.text_conf... |
class OwlViTClassPredictionHead(nn.Module):
def __init__(self, config: OwlViTConfig):
pass
def forward(self, image_embeds: torch.FloatTensor, query_embeds: Optional[torch.FloatTensor], query_mask: Optional[torch.Tensor]) -> tuple[torch.FloatTensor]:
pass | 3 | 0 | 22 | 4 | 17 | 2 | 3 | 0.09 | 1 | 3 | 1 | 0 | 2 | 5 | 2 | 12 | 46 | 9 | 34 | 20 | 26 | 3 | 29 | 15 | 26 | 4 | 1 | 2 | 5 |
4,360 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/modeling_owlvit.py | transformers.models.owlvit.modeling_owlvit.OwlViTEncoder | from .configuration_owlvit import OwlViTConfig, OwlViTTextConfig, OwlViTVisionConfig
from typing import Any, Optional, Union
import torch
from torch import Tensor, nn
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
class OwlViTEncoder(nn.Module):
"""
Transformer encoder consisting o... |
class OwlViTEncoder(nn.Module):
'''
Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a
[`OwlViTEncoderLayer`].
Args:
config: OwlViTConfig
'''
def __init__(self, config: OwlViTConfig):
pass
def forward(self, inputs_embeds, at... | 3 | 2 | 39 | 3 | 25 | 11 | 7 | 0.56 | 1 | 8 | 3 | 0 | 2 | 2 | 2 | 12 | 87 | 9 | 50 | 18 | 39 | 28 | 26 | 10 | 23 | 12 | 1 | 2 | 13 |
4,361 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/modeling_owlvit.py | transformers.models.owlvit.modeling_owlvit.OwlViTEncoderLayer | from torch import Tensor, nn
import torch
from ...modeling_layers import GradientCheckpointingLayer
from typing import Any, Optional, Union
from .configuration_owlvit import OwlViTConfig, OwlViTTextConfig, OwlViTVisionConfig
class OwlViTEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: OwlViTCo... |
class OwlViTEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: OwlViTConfig):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, causal_attention_mask: torch.Tensor, output_attentions: Optional[bool]=False) -> tuple[torch.FloatTensor]:
'''
... | 3 | 1 | 23 | 3 | 16 | 5 | 2 | 0.31 | 1 | 6 | 3 | 0 | 2 | 5 | 2 | 12 | 48 | 6 | 32 | 17 | 23 | 10 | 21 | 11 | 18 | 2 | 1 | 1 | 3 |
4,362 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/modeling_owlvit.py | transformers.models.owlvit.modeling_owlvit.OwlViTForObjectDetection | from .configuration_owlvit import OwlViTConfig, OwlViTTextConfig, OwlViTVisionConfig
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
from typing import Any, Optional, Union
import torch
from torch import Tensor, nn
from functools import lru_cach... |
class OwlViTForObjectDetection(OwlViTPreTrainedModel):
def __init__(self, config: OwlViTConfig):
pass
@staticmethod
def normalize_grid_corner_coordinates(num_patches_height: int, num_patches_width: int) -> torch.Tensor:
pass
@lru_cache(maxsize=2)
def compute_box_bias(self, num_patc... | 15 | 4 | 44 | 5 | 27 | 11 | 3 | 0.41 | 1 | 13 | 6 | 0 | 9 | 9 | 10 | 11 | 455 | 63 | 278 | 140 | 213 | 114 | 145 | 88 | 134 | 5 | 2 | 2 | 26 |
4,363 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/modeling_owlvit.py | transformers.models.owlvit.modeling_owlvit.OwlViTImageGuidedObjectDetectionOutput | from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
import torch
from typing import Any, Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from dataclasses import dataclass
@dataclass
@auto_docstring(custom... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`OwlViTForObjectDetection.image_guided_detection`].\n ')
class OwlViTImageGuidedObjectDetectionOutput(ModelOutput):
'''
logits (`torch.FloatTensor` of shape `(batch_size, num_patches, num_queries)`):
Classification logits (including no-ob... | 4 | 1 | 5 | 0 | 5 | 0 | 2 | 2.07 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 46 | 3 | 14 | 10 | 12 | 29 | 11 | 10 | 9 | 2 | 1 | 0 | 2 |
4,364 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/modeling_owlvit.py | transformers.models.owlvit.modeling_owlvit.OwlViTMLP | from torch import Tensor, nn
import torch
from ...activations import ACT2FN
class OwlViTMLP(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.activation_fn = ACT2FN[config.hidden_act]
self.fc1 = nn.Linear(config.hidden_size, config.intermediate_si... |
class OwlViTMLP(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 13 | 1 | 12 | 7 | 9 | 0 | 12 | 7 | 9 | 1 | 1 | 0 | 2 |
4,365 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/modeling_owlvit.py | transformers.models.owlvit.modeling_owlvit.OwlViTModel | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
import torch
from .configuration_owlvit import OwlViTConfig, OwlViTTextConfig, OwlViTVisionConfig
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
from torch import Tenso... | @auto_docstring
class OwlViTModel(OwlViTPreTrainedModel):
def __init__(self, config: OwlViTConfig):
pass
@filter_out_non_signature_kwargs()
@auto_docstring
def get_text_features(self, input_ids: torch.Tensor, attention_mask: Optional[torch.Tensor]=None) -> torch.FloatTensor:
'''
... | 11 | 3 | 49 | 7 | 29 | 14 | 4 | 0.45 | 1 | 11 | 6 | 0 | 4 | 8 | 4 | 5 | 207 | 32 | 121 | 60 | 87 | 54 | 56 | 32 | 51 | 7 | 2 | 1 | 16 |
4,366 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/modeling_owlvit.py | transformers.models.owlvit.modeling_owlvit.OwlViTObjectDetectionOutput | from dataclasses import dataclass
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
from typing import Any, Optional, Union
import torch
@dataclass
@auto_docstring(custom... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`OwlViTForObjectDetection`].\n ')
class OwlViTObjectDetectionOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` are provided)):
Total loss as a linear combination of a negative log-likeh... | 4 | 1 | 5 | 0 | 5 | 0 | 2 | 1.93 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 47 | 3 | 15 | 11 | 13 | 29 | 12 | 11 | 10 | 2 | 1 | 0 | 2 |
4,367 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/modeling_owlvit.py | transformers.models.owlvit.modeling_owlvit.OwlViTOutput | from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
from typing import Any, Optional, Union
import torch
from dataclasses import dataclass
@dataclass
@auto_docstring
class ... | @dataclass
@auto_docstring
class OwlViTOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `return_loss` is `True`):
Contrastive loss for image-text similarity.
logits_per_image (`torch.FloatTensor` of shape `(image_batch_size, text_batch_size)`):
Th... | 4 | 1 | 5 | 0 | 5 | 0 | 2 | 1.54 | 1 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 35 | 2 | 13 | 9 | 11 | 20 | 10 | 9 | 8 | 2 | 1 | 0 | 2 |
4,368 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/modeling_owlvit.py | transformers.models.owlvit.modeling_owlvit.OwlViTPreTrainedModel | from .configuration_owlvit import OwlViTConfig, OwlViTTextConfig, OwlViTVisionConfig
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
from ...modeling_utils import PreTrainedModel
from torch import Tensor, nn
@auto_docstring
class OwlViTPreTrain... | @auto_docstring
class OwlViTPreTrainedModel(PreTrainedModel):
def _init_weights(self, module: nn.Module):
'''Initialize the weights'''
pass | 3 | 1 | 39 | 0 | 38 | 1 | 8 | 0.12 | 1 | 5 | 5 | 4 | 1 | 0 | 1 | 1 | 50 | 2 | 43 | 10 | 41 | 5 | 33 | 10 | 31 | 8 | 1 | 1 | 8 |
4,369 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/modeling_owlvit.py | transformers.models.owlvit.modeling_owlvit.OwlViTTextEmbeddings | from torch import Tensor, nn
from .configuration_owlvit import OwlViTConfig, OwlViTTextConfig, OwlViTVisionConfig
import torch
from typing import Any, Optional, Union
class OwlViTTextEmbeddings(nn.Module):
def __init__(self, config: OwlViTTextConfig):
super().__init__()
self.token_embedding = nn.E... |
class OwlViTTextEmbeddings(nn.Module):
def __init__(self, config: OwlViTTextConfig):
pass
def forward(self, input_ids: Optional[torch.LongTensor]=None, position_ids: Optional[torch.LongTensor]=None, inputs_embeds: Optional[torch.FloatTensor]=None) -> torch.Tensor:
pass | 3 | 0 | 14 | 3 | 11 | 1 | 3 | 0.05 | 1 | 3 | 1 | 0 | 2 | 2 | 2 | 12 | 29 | 6 | 22 | 13 | 14 | 1 | 15 | 8 | 12 | 4 | 1 | 1 | 5 |
4,370 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/modeling_owlvit.py | transformers.models.owlvit.modeling_owlvit.OwlViTTextModel | from typing import Any, Optional, Union
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
import torch
from .configuration_owlvit import OwlViTConfig, OwlViTTextConfig, OwlViTVisionConfig
from torch import Tensor, nn
from ...modeling_outputs impor... |
class OwlViTTextModel(OwlViTPreTrainedModel):
def __init__(self, config: OwlViTTextConfig):
pass
def get_input_embeddings(self) -> nn.Module:
pass
def set_input_embeddings(self, value):
pass
@auto_docstring
def forward(self, input_ids: torch.Tensor, attention_mask: Option... | 6 | 1 | 11 | 1 | 6 | 4 | 1 | 0.59 | 1 | 6 | 3 | 0 | 4 | 1 | 4 | 5 | 50 | 7 | 27 | 15 | 13 | 16 | 12 | 7 | 7 | 1 | 2 | 0 | 4 |
4,371 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/modeling_owlvit.py | transformers.models.owlvit.modeling_owlvit.OwlViTTextTransformer | from typing import Any, Optional, Union
from ...modeling_attn_mask_utils import _create_4d_causal_attention_mask, _prepare_4d_attention_mask
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available,... |
class OwlViTTextTransformer(nn.Module):
def __init__(self, config: OwlViTTextConfig):
pass
@auto_docstring
def forward(self, input_ids: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.Tensor]=None, output_attentions: Optional[bool]=None, output_hidden_states... | 4 | 1 | 34 | 4 | 26 | 5 | 4 | 0.19 | 1 | 8 | 4 | 0 | 2 | 4 | 2 | 12 | 72 | 8 | 54 | 23 | 41 | 10 | 25 | 14 | 22 | 6 | 1 | 1 | 7 |
4,372 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/modeling_owlvit.py | transformers.models.owlvit.modeling_owlvit.OwlViTVisionEmbeddings | from torch import Tensor, nn
from .configuration_owlvit import OwlViTConfig, OwlViTTextConfig, OwlViTVisionConfig
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
import torch
class OwlViTVisionEmbeddings(nn.Module):
def __init__(self, conf... |
class OwlViTVisionEmbeddings(nn.Module):
def __init__(self, config: OwlViTVisionConfig):
pass
def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width: int) -> torch.Tensor:
'''
This method allows to interpolate the pre-trained position encodings, to be able to ... | 4 | 1 | 22 | 3 | 17 | 3 | 2 | 0.2 | 1 | 5 | 1 | 0 | 3 | 8 | 3 | 13 | 71 | 11 | 51 | 25 | 47 | 10 | 39 | 25 | 35 | 2 | 1 | 1 | 5 |
4,373 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/modeling_owlvit.py | transformers.models.owlvit.modeling_owlvit.OwlViTVisionModel | import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from typing import Any, Optional, Union
from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
from .configuration_owlvit import OwlViTConfig, OwlViTTextConfig, Ow... |
class OwlViTVisionModel(OwlViTPreTrainedModel):
def __init__(self, config: OwlViTVisionConfig):
pass
def get_input_embeddings(self) -> nn.Module:
pass
@auto_docstring
def forward(self, pixel_values: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=None, output_hidde... | 5 | 1 | 14 | 1 | 7 | 6 | 1 | 0.65 | 1 | 5 | 3 | 0 | 3 | 1 | 3 | 4 | 50 | 7 | 26 | 15 | 13 | 17 | 11 | 7 | 7 | 1 | 2 | 0 | 3 |
4,374 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/modeling_owlvit.py | transformers.models.owlvit.modeling_owlvit.OwlViTVisionTransformer | from ...utils import ModelOutput, auto_docstring, filter_out_non_signature_kwargs, is_vision_available, logging, torch_int
import torch
from typing import Any, Optional, Union
from .configuration_owlvit import OwlViTConfig, OwlViTTextConfig, OwlViTVisionConfig
from torch import Tensor, nn
from ...modeling_outputs impor... |
class OwlViTVisionTransformer(nn.Module):
def __init__(self, config: OwlViTVisionConfig):
pass
@auto_docstring
def forward(self, pixel_values: torch.FloatTensor, output_attentions: Optional[bool]=None, output_hidden_states: Optional[bool]=None, interpolate_pos_encoding: Optional[bool]=False, retur... | 4 | 0 | 27 | 4 | 21 | 2 | 3 | 0.09 | 1 | 6 | 4 | 0 | 2 | 5 | 2 | 12 | 57 | 9 | 44 | 21 | 32 | 4 | 23 | 13 | 20 | 5 | 1 | 1 | 6 |
4,375 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/owlvit/processing_owlvit.py | transformers.models.owlvit.processing_owlvit.OwlViTProcessor | from typing import TYPE_CHECKING, Optional, Union
from ...utils import TensorType, is_torch_available
from ...image_utils import ImageInput
from ...processing_utils import ImagesKwargs, ProcessingKwargs, ProcessorMixin, Unpack
import warnings
import numpy as np
from ...tokenization_utils_base import PreTokenizedInput, ... |
class OwlViTProcessor(ProcessorMixin):
'''
Constructs an OWL-ViT processor which wraps [`OwlViTImageProcessor`] and [`CLIPTokenizer`]/[`CLIPTokenizerFast`]
into a single processor that inherits both the image processor and tokenizer functionalities. See the
[`~OwlViTProcessor.__call__`] and [`~OwlViTPr... | 11 | 6 | 25 | 3 | 13 | 9 | 3 | 0.78 | 1 | 9 | 1 | 0 | 10 | 0 | 10 | 27 | 275 | 40 | 132 | 42 | 104 | 103 | 86 | 28 | 72 | 16 | 2 | 4 | 33 |
4,376 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/paligemma/configuration_paligemma.py | transformers.models.paligemma.configuration_paligemma.PaliGemmaConfig | from ..auto import CONFIG_MAPPING, AutoConfig
from ...configuration_utils import PretrainedConfig
class PaliGemmaConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`PaliGemmaForConditionalGeneration`]. It is used to instantiate an
PaliGemmamodel according to the ... |
class PaliGemmaConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`PaliGemmaForConditionalGeneration`]. It is used to instantiate an
PaliGemmamodel according to the specified arguments, defining the model architecture. Instantiating a configuration
with the d... | 2 | 1 | 16 | 1 | 16 | 0 | 3 | 0.54 | 1 | 3 | 0 | 0 | 4 | 8 | 4 | 4 | 122 | 17 | 68 | 28 | 51 | 37 | 32 | 16 | 27 | 7 | 1 | 1 | 10 |
4,377 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/paligemma/modeling_paligemma.py | transformers.models.paligemma.modeling_paligemma.PaliGemmaCausalLMOutputWithPast | import torch
from ...cache_utils import Cache, StaticCache
from dataclasses import dataclass
from typing import Optional, Union
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging
@dataclass
@auto_docstring(custom_intro='\n Base class for PaliGemma causal language model (... | @dataclass
@auto_docstring(custom_intro='\n Base class for PaliGemma causal language model (or autoregressive) outputs.\n ')
class PaliGemmaCausalLMOutputWithPast(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Language modeling loss (f... | 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 |
4,378 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/paligemma/modeling_paligemma.py | transformers.models.paligemma.modeling_paligemma.PaliGemmaForConditionalGeneration | from ...cache_utils import Cache, StaticCache
from torch import nn
from ...processing_utils import Unpack
import torch
from .configuration_paligemma import PaliGemmaConfig
from typing import Optional, Union
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging
from ...generatio... | @auto_docstring(custom_intro='\n The Base Paligemma model which consists of a vision backbone and a language model without language modeling head.,\n ')
class PaliGemmaForConditionalGeneration(PaliGemmaPreTrainedModel, GenerationMixin):
def __init__(self, config: PaliGemmaConfig):
pass
def get_i... | 20 | 2 | 28 | 3 | 20 | 5 | 4 | 0.26 | 2 | 13 | 8 | 0 | 11 | 7 | 11 | 12 | 323 | 42 | 225 | 90 | 171 | 58 | 122 | 49 | 110 | 18 | 2 | 2 | 44 |
4,379 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/paligemma/modeling_paligemma.py | transformers.models.paligemma.modeling_paligemma.PaliGemmaMultiModalProjector | from .configuration_paligemma import PaliGemmaConfig
from torch import nn
class PaliGemmaMultiModalProjector(nn.Module):
def __init__(self, config: PaliGemmaConfig):
super().__init__()
self.linear = nn.Linear(config.vision_config.hidden_size, config.vision_config.projection_dim, bias=True)
de... |
class PaliGemmaMultiModalProjector(nn.Module):
def __init__(self, config: PaliGemmaConfig):
pass
def forward(self, image_features):
pass | 3 | 0 | 4 | 1 | 3 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 2 | 1 | 2 | 12 | 9 | 2 | 7 | 5 | 4 | 0 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
4,380 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/paligemma/modeling_paligemma.py | transformers.models.paligemma.modeling_paligemma.PaliGemmaPreTrainedModel | from ...modeling_utils import PreTrainedModel
from .configuration_paligemma import PaliGemmaConfig
from torch import nn
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, can_return_tuple, logging
@auto_docstring
class PaliGemmaPreTrainedModel(PreTrainedModel):
config: PaliGemmaConfig
base_m... | @auto_docstring
class PaliGemmaPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 20 | 2 | 16 | 2 | 7 | 0.07 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 32 | 3 | 27 | 13 | 25 | 2 | 22 | 13 | 20 | 7 | 1 | 2 | 7 |
4,381 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/paligemma/processing_paligemma.py | transformers.models.paligemma.processing_paligemma.PaliGemmaImagesKwargs | from ...processing_utils import ImagesKwargs, MultiModalData, ProcessingKwargs, ProcessorMixin, TextKwargs, Unpack
from typing import Optional, Union
class PaliGemmaImagesKwargs(ImagesKwargs):
do_convert_rgb: Optional[bool] |
class PaliGemmaImagesKwargs(ImagesKwargs):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
4,382 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/paligemma/processing_paligemma.py | transformers.models.paligemma.processing_paligemma.PaliGemmaProcessor | import numpy as np
from ...processing_utils import ImagesKwargs, MultiModalData, ProcessingKwargs, ProcessorMixin, TextKwargs, Unpack
from typing import Optional, Union
from ...feature_extraction_utils import BatchFeature
from ...image_utils import ImageInput, is_valid_image
from ...tokenization_utils_base import Added... |
class PaliGemmaProcessor(ProcessorMixin):
'''
Constructs a PaliGemma processor which wraps a PaliGemma image processor and a PaliGemma tokenizer into a single processor.
[`PaliGemmaProcessor`] offers all the functionalities of [`SiglipImageProcessor`] and [`GemmaTokenizerFast`]. See the
[`~PaliGemmaPro... | 4 | 3 | 41 | 5 | 24 | 12 | 6 | 0.62 | 1 | 7 | 2 | 0 | 5 | 2 | 5 | 22 | 233 | 31 | 125 | 42 | 105 | 77 | 77 | 28 | 71 | 20 | 2 | 4 | 28 |
4,383 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/paligemma/processing_paligemma.py | transformers.models.paligemma.processing_paligemma.PaliGemmaProcessorKwargs | from ...processing_utils import ImagesKwargs, MultiModalData, ProcessingKwargs, ProcessorMixin, TextKwargs, Unpack
class PaliGemmaProcessorKwargs(ProcessingKwargs, total=False):
text_kwargs: PaliGemmaTextKwargs
images_kwargs: PaliGemmaImagesKwargs
_defaults = {'text_kwargs': {'padding': False, 'return_mm_t... |
class PaliGemmaProcessorKwargs(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 | 4 | 2 | 3 | 0 | 3 | 0 | 0 |
4,384 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/paligemma/processing_paligemma.py | transformers.models.paligemma.processing_paligemma.PaliGemmaTextKwargs | from ...processing_utils import ImagesKwargs, MultiModalData, ProcessingKwargs, ProcessorMixin, TextKwargs, Unpack
from typing import Optional, Union
from ...tokenization_utils_base import AddedToken, PreTokenizedInput, TextInput
class PaliGemmaTextKwargs(TextKwargs):
suffix: Optional[Union[TextInput, PreTokenized... |
class PaliGemmaTextKwargs(TextKwargs):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
4,385 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/configuration_patchtsmixer.py | transformers.models.patchtsmixer.configuration_patchtsmixer.PatchTSMixerConfig | from ...configuration_utils import PretrainedConfig
from typing import Optional, Union
class PatchTSMixerConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`PatchTSMixerModel`]. It is used to instantiate a
PatchTSMixer model according to the specified arguments, ... |
class PatchTSMixerConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`PatchTSMixerModel`]. It is used to instantiate a
PatchTSMixer model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults wi... | 2 | 1 | 83 | 0 | 77 | 6 | 1 | 1.39 | 1 | 6 | 0 | 0 | 1 | 37 | 1 | 1 | 207 | 9 | 83 | 79 | 43 | 115 | 42 | 41 | 40 | 1 | 1 | 0 | 1 |
4,386 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.FeatureMixerBlock | import torch
from .configuration_patchtsmixer import PatchTSMixerConfig
import torch.nn as nn
class FeatureMixerBlock(nn.Module):
"""This module mixes the hidden feature dimension.
Args:
config (`PatchTSMixerConfig`):
Configuration.
"""
def __init__(self, config: PatchTSMixerConf... |
class FeatureMixerBlock(nn.Module):
'''This module mixes the hidden feature dimension.
Args:
config (`PatchTSMixerConfig`):
Configuration.
'''
def __init__(self, config: PatchTSMixerConfig):
pass
def forward(self, hidden: torch.Tensor):
'''
Args:
... | 3 | 2 | 17 | 4 | 10 | 4 | 2 | 0.6 | 1 | 6 | 4 | 0 | 2 | 4 | 2 | 12 | 43 | 11 | 20 | 9 | 17 | 12 | 16 | 9 | 13 | 2 | 1 | 1 | 4 |
4,387 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.InjectScalerStatistics4D | import torch.nn as nn
import torch
class InjectScalerStatistics4D(nn.Module):
def __init__(self, d_model: int, num_patches: int, expansion: int=2):
super().__init__()
self.inverse_trans_expansion = nn.Linear(d_model + 2, expansion * d_model)
self.inverse_trans_compression = nn.Linear(expan... |
class InjectScalerStatistics4D(nn.Module):
def __init__(self, d_model: int, num_patches: int, expansion: int=2):
pass
def forward(self, inputs: torch.Tensor, loc: torch.Tensor, scale: torch.Tensor):
'''
Args:
inputs (`torch.Tensor` of shape `(batch_size, num_input_channels... | 3 | 1 | 18 | 4 | 11 | 10 | 1 | 0.91 | 1 | 3 | 0 | 0 | 2 | 5 | 2 | 12 | 38 | 8 | 22 | 11 | 19 | 20 | 22 | 11 | 19 | 1 | 1 | 0 | 2 |
4,388 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchMixerBlock | from .configuration_patchtsmixer import PatchTSMixerConfig
import torch.nn as nn
class PatchMixerBlock(nn.Module):
"""This module mixes the patch dimension.
Args:
config (`PatchTSMixerConfig`):
Configuration.
"""
def __init__(self, config: PatchTSMixerConfig):
super().__in... |
class PatchMixerBlock(nn.Module):
'''This module mixes the patch dimension.
Args:
config (`PatchTSMixerConfig`):
Configuration.
'''
def __init__(self, config: PatchTSMixerConfig):
pass
def forward(self, hidden_state):
'''
Args:
hidden_state ... | 3 | 2 | 29 | 7 | 18 | 4 | 4 | 0.35 | 1 | 6 | 5 | 0 | 2 | 7 | 2 | 12 | 67 | 17 | 37 | 15 | 34 | 13 | 29 | 15 | 26 | 4 | 1 | 1 | 7 |
4,389 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerAttention | from typing import Callable, Optional, Union
import torch.nn as nn
from ...processing_utils import Unpack
import torch
from .configuration_patchtsmixer import PatchTSMixerConfig
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS
from ...modeling_flash_attention_utils import FlashAttentionKwargs
class PatchTSMixerAt... |
class PatchTSMixerAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, embed_dim: int, num_heads: int, dropout: float=0.0, is_decoder: bool=False, bias: bool=True, is_causal: bool=False, config: Optional[PatchTSMixerConfig]=None):
pass
def f... | 3 | 2 | 50 | 7 | 35 | 8 | 5 | 0.24 | 1 | 7 | 1 | 0 | 3 | 12 | 3 | 13 | 156 | 23 | 107 | 44 | 86 | 26 | 68 | 27 | 64 | 12 | 1 | 2 | 15 |
4,390 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerBatchNorm | import torch
from .configuration_patchtsmixer import PatchTSMixerConfig
import torch.nn as nn
class PatchTSMixerBatchNorm(nn.Module):
"""
Compute batch normalization over the sequence length (time) dimension.
"""
def __init__(self, config: PatchTSMixerConfig):
super().__init__()
self.b... |
class PatchTSMixerBatchNorm(nn.Module):
'''
Compute batch normalization over the sequence length (time) dimension.
'''
def __init__(self, config: PatchTSMixerConfig):
pass
def forward(self, inputs: torch.Tensor):
'''
Parameters:
inputs (`torch.Tensor` of shape ... | 3 | 2 | 7 | 0 | 4 | 4 | 1 | 1.38 | 1 | 3 | 1 | 0 | 2 | 1 | 2 | 12 | 20 | 2 | 8 | 5 | 5 | 11 | 8 | 5 | 5 | 1 | 1 | 0 | 2 |
4,391 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerBlock | from .configuration_patchtsmixer import PatchTSMixerConfig
import torch.nn as nn
class PatchTSMixerBlock(nn.Module):
"""The main computing framework of the `PatchTSMixer` model.
Args:
config (`PatchTSMixerConfig`):
Configuration.
"""
def __init__(self, config: PatchTSMixerConfig):... |
class PatchTSMixerBlock(nn.Module):
'''The main computing framework of the `PatchTSMixer` model.
Args:
config (`PatchTSMixerConfig`):
Configuration.
'''
def __init__(self, config: PatchTSMixerConfig):
pass
def forward(self, hidden_state, output_hidden_states: bool=Fals... | 3 | 2 | 15 | 3 | 8 | 5 | 3 | 0.88 | 1 | 5 | 2 | 0 | 2 | 1 | 2 | 12 | 39 | 9 | 16 | 8 | 13 | 14 | 15 | 8 | 12 | 4 | 1 | 2 | 5 |
4,392 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerChannelFeatureMixerBlock | import torch
from .configuration_patchtsmixer import PatchTSMixerConfig
import torch.nn as nn
class PatchTSMixerChannelFeatureMixerBlock(nn.Module):
"""This module mixes the features in the channel dimension.
Args:
config (`PatchTSMixerConfig`):
Configuration.
"""
def __init__(sel... |
class PatchTSMixerChannelFeatureMixerBlock(nn.Module):
'''This module mixes the features in the channel dimension.
Args:
config (`PatchTSMixerConfig`):
Configuration.
'''
def __init__(self, config: PatchTSMixerConfig):
pass
def forward(self, inputs: torch.Tensor):
... | 3 | 2 | 19 | 4 | 12 | 4 | 2 | 0.5 | 1 | 6 | 4 | 0 | 2 | 4 | 2 | 12 | 46 | 10 | 24 | 9 | 21 | 12 | 18 | 9 | 15 | 2 | 1 | 1 | 4 |
4,393 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerEncoder | from ...utils import auto_docstring, logging
from typing import Callable, Optional, Union
import torch.nn as nn
import torch
from .configuration_patchtsmixer import PatchTSMixerConfig
class PatchTSMixerEncoder(PatchTSMixerPreTrainedModel):
"""
Encoder for PatchTSMixer which inputs patched time-series and outpu... |
class PatchTSMixerEncoder(PatchTSMixerPreTrainedModel):
'''
Encoder for PatchTSMixer which inputs patched time-series and outputs patched embeddings.
Args:
config (`PatchTSMixerConfig`):
Configuration.
'''
def __init__(self, config: PatchTSMixerConfig):
pass
@auto_d... | 4 | 2 | 32 | 7 | 16 | 10 | 4 | 0.76 | 1 | 8 | 4 | 0 | 2 | 4 | 2 | 130 | 74 | 16 | 33 | 15 | 24 | 25 | 20 | 9 | 17 | 4 | 3 | 1 | 7 |
4,394 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerForPreTrainingOutput | from ...utils import auto_docstring, logging
from typing import Callable, Optional, Union
from transformers.utils import ModelOutput
from dataclasses import dataclass
import torch.nn as nn
import torch
@dataclass
@auto_docstring(custom_intro='\n Output type of [`PatchTSMixerForPreTrainingOutput`].\n ')
class Pat... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`PatchTSMixerForPreTrainingOutput`].\n ')
class PatchTSMixerForPreTrainingOutput(ModelOutput):
'''
loss (*optional*, returned when `y` is provided, `torch.FloatTensor` of shape `()`):
Total loss
prediction_outputs (`torch.FloatTensor`... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 62 | 19 | 2 | 5 | 5 | 4 | 12 | 5 | 5 | 4 | 0 | 4 | 0 | 0 |
4,395 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerForPrediction | from ...utils import auto_docstring, logging
from typing import Callable, Optional, Union
from ...time_series_utils import NegativeBinomialOutput, NormalOutput, StudentTOutput
import torch.nn as nn
import torch
from .configuration_patchtsmixer import PatchTSMixerConfig
class PatchTSMixerForPrediction(PatchTSMixerPreTr... |
class PatchTSMixerForPrediction(PatchTSMixerPreTrainedModel):
'''
`PatchTSMixer` for forecasting application.
Args:
config (`PatchTSMixerConfig`):
Configuration.
Returns:
`None`.
'''
def __init__(self, config: PatchTSMixerConfig):
pass
@auto_docstring
... | 6 | 3 | 64 | 7 | 43 | 15 | 6 | 0.41 | 1 | 15 | 9 | 0 | 3 | 7 | 3 | 131 | 209 | 27 | 132 | 38 | 114 | 54 | 62 | 25 | 58 | 14 | 3 | 3 | 19 |
4,396 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerForPredictionHead | from .configuration_patchtsmixer import PatchTSMixerConfig
import torch.nn as nn
class PatchTSMixerForPredictionHead(nn.Module):
"""Prediction Head for Forecasting
Args:
config (`PatchTSMixerConfig`):
Configuration.
"""
def __init__(self, config: PatchTSMixerConfig, distribution_o... |
class PatchTSMixerForPredictionHead(nn.Module):
'''Prediction Head for Forecasting
Args:
config (`PatchTSMixerConfig`):
Configuration.
'''
def __init__(self, config: PatchTSMixerConfig, distribution_output=None):
pass
def forward(self, hidden_features):
'''
... | 3 | 2 | 23 | 5 | 14 | 7 | 4 | 0.64 | 1 | 3 | 1 | 0 | 2 | 4 | 2 | 12 | 54 | 13 | 28 | 8 | 25 | 18 | 23 | 8 | 20 | 4 | 1 | 2 | 7 |
4,397 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerForPredictionOutput | from ...utils import auto_docstring, logging
from typing import Callable, Optional, Union
from transformers.utils import ModelOutput
from dataclasses import dataclass
import torch.nn as nn
import torch
@dataclass
@auto_docstring(custom_intro='\n Output type of [`PatchTSMixerForPredictionOutput`].\n ')
class Patc... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`PatchTSMixerForPredictionOutput`].\n ')
class PatchTSMixerForPredictionOutput(ModelOutput):
'''
loss (*optional*, returned when `y` is provided, `torch.FloatTensor` of shape `()`):
Total loss.
prediction_outputs (`torch.FloatTensor` ... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.29 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 62 | 26 | 3 | 7 | 7 | 6 | 16 | 7 | 7 | 6 | 0 | 4 | 0 | 0 |
4,398 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerForPretraining | from ...utils import auto_docstring, logging
from typing import Callable, Optional, Union
import torch.nn as nn
import torch
from .configuration_patchtsmixer import PatchTSMixerConfig
@auto_docstring(custom_intro='\n `PatchTSMixer` for mask pretraining.\n ')
class PatchTSMixerForPretraining(PatchTSMixerPreTraine... | @auto_docstring(custom_intro='\n `PatchTSMixer` for mask pretraining.\n ')
class PatchTSMixerForPretraining(PatchTSMixerPreTrainedModel):
def __init__(self, config: PatchTSMixerConfig):
pass
@auto_docstring
def forward(self, past_values: torch.Tensor, observed_mask: Optional[torch.Tensor]=Non... | 5 | 1 | 38 | 5 | 26 | 9 | 5 | 0.45 | 1 | 9 | 5 | 0 | 2 | 4 | 2 | 130 | 90 | 14 | 55 | 19 | 43 | 25 | 26 | 11 | 23 | 7 | 3 | 1 | 9 |
4,399 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/patchtsmixer/modeling_patchtsmixer.py | transformers.models.patchtsmixer.modeling_patchtsmixer.PatchTSMixerForRegression | from ...utils import auto_docstring, logging
from typing import Callable, Optional, Union
from ...time_series_utils import NegativeBinomialOutput, NormalOutput, StudentTOutput
import torch.nn as nn
import torch
from .configuration_patchtsmixer import PatchTSMixerConfig
@auto_docstring(custom_intro='\n `PatchTSMixer... | @auto_docstring(custom_intro='\n `PatchTSMixer` for regression application.\n ')
class PatchTSMixerForRegression(PatchTSMixerPreTrainedModel):
def __init__(self, config: PatchTSMixerConfig):
pass
@auto_docstring
def forward(self, past_values: torch.Tensor, target_values: Optional[torch.Tensor... | 7 | 2 | 54 | 8 | 34 | 13 | 5 | 0.45 | 1 | 17 | 10 | 0 | 3 | 7 | 3 | 131 | 177 | 29 | 106 | 34 | 90 | 48 | 53 | 22 | 49 | 10 | 3 | 3 | 16 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.