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,700 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt_v2/modeling_pvt_v2.py | transformers.models.pvt_v2.modeling_pvt_v2.PvtV2EncoderLayer | from ...modeling_layers import GradientCheckpointingLayer
import torch
from .configuration_pvt_v2 import PvtV2Config
from torch import nn
class PvtV2EncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: PvtV2Config, layer_idx: int):
super().__init__()
self.patch_embedding = PvtV2Ove... |
class PvtV2EncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: PvtV2Config, layer_idx: int):
pass
def forward(self, hidden_states, output_attentions):
pass | 3 | 0 | 21 | 2 | 16 | 3 | 4 | 0.19 | 1 | 6 | 3 | 0 | 2 | 3 | 2 | 12 | 43 | 5 | 32 | 14 | 29 | 6 | 23 | 14 | 20 | 5 | 1 | 2 | 7 |
4,701 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt_v2/modeling_pvt_v2.py | transformers.models.pvt_v2.modeling_pvt_v2.PvtV2ForImageClassification | from ...utils import auto_docstring, logging
from torch import nn
from .configuration_pvt_v2 import PvtV2Config
from ...modeling_outputs import BackboneOutput, BaseModelOutput, ImageClassifierOutput
import torch
from typing import Optional, Union
@auto_docstring(custom_intro='\n Pvt-v2 Model transformer with an ima... | @auto_docstring(custom_intro='\n Pvt-v2 Model transformer with an image classification head on top (a linear layer on top of the final hidden state\n of the [CLS] token) e.g. for ImageNet.\n ')
class PvtV2ForImageClassification(PvtV2PreTrainedModel):
def __init__(self, config: PvtV2Config) -> None:
... | 5 | 1 | 41 | 6 | 30 | 6 | 7 | 0.16 | 1 | 8 | 3 | 0 | 2 | 3 | 2 | 3 | 91 | 13 | 67 | 21 | 50 | 11 | 36 | 13 | 33 | 12 | 2 | 3 | 14 |
4,702 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt_v2/modeling_pvt_v2.py | transformers.models.pvt_v2.modeling_pvt_v2.PvtV2Model | from ...utils import auto_docstring, logging
import torch
from .configuration_pvt_v2 import PvtV2Config
from ...modeling_outputs import BackboneOutput, BaseModelOutput, ImageClassifierOutput
from typing import Optional, Union
@auto_docstring
class PvtV2Model(PvtV2PreTrainedModel):
def __init__(self, config: PvtV2... | @auto_docstring
class PvtV2Model(PvtV2PreTrainedModel):
def __init__(self, config: PvtV2Config):
pass
def _prune_heads(self, heads_to_prune):
'''
Prunes heads of the model. heads_to_prune: dict of {layer_num: list of heads to prune in this layer} See base
class PreTrainedModel
... | 6 | 1 | 15 | 2 | 11 | 2 | 3 | 0.14 | 1 | 5 | 3 | 1 | 3 | 2 | 3 | 4 | 56 | 7 | 43 | 16 | 25 | 6 | 18 | 9 | 14 | 5 | 2 | 1 | 8 |
4,703 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt_v2/modeling_pvt_v2.py | transformers.models.pvt_v2.modeling_pvt_v2.PvtV2OverlapPatchEmbeddings | from torch import nn
from .configuration_pvt_v2 import PvtV2Config
class PvtV2OverlapPatchEmbeddings(nn.Module):
"""Image to Patch Embedding"""
def __init__(self, config: PvtV2Config, layer_idx: int):
super().__init__()
patch_size = config.patch_sizes[layer_idx]
patch_size = (patch_siz... |
class PvtV2OverlapPatchEmbeddings(nn.Module):
'''Image to Patch Embedding'''
def __init__(self, config: PvtV2Config, layer_idx: int):
pass
def forward(self, pixel_values):
pass | 3 | 1 | 11 | 0 | 11 | 0 | 2 | 0.04 | 1 | 3 | 1 | 0 | 2 | 3 | 2 | 12 | 26 | 2 | 23 | 12 | 20 | 1 | 17 | 12 | 14 | 3 | 1 | 0 | 4 |
4,704 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt_v2/modeling_pvt_v2.py | transformers.models.pvt_v2.modeling_pvt_v2.PvtV2PreTrainedModel | import math
from ...utils import auto_docstring, logging
from typing import Optional, Union
from torch import nn
from .configuration_pvt_v2 import PvtV2Config
from ...modeling_utils import PreTrainedModel
@auto_docstring
class PvtV2PreTrainedModel(PreTrainedModel):
config: PvtV2Config
base_model_prefix = 'pvt_... | @auto_docstring
class PvtV2PreTrainedModel(PreTrainedModel):
def _init_weights(self, module: Union[nn.Linear, nn.Conv2d, nn.LayerNorm]) -> None:
'''Initialize the weights'''
pass | 3 | 1 | 17 | 0 | 14 | 3 | 6 | 0.37 | 1 | 0 | 0 | 2 | 1 | 0 | 1 | 1 | 28 | 2 | 19 | 7 | 17 | 7 | 17 | 7 | 15 | 6 | 1 | 2 | 6 |
4,705 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/pvt_v2/modeling_pvt_v2.py | transformers.models.pvt_v2.modeling_pvt_v2.PvtV2SelfAttention | from torch import nn
import torch
from .configuration_pvt_v2 import PvtV2Config
from ...pytorch_utils import find_pruneable_heads_and_indices, prune_linear_layer
import math
class PvtV2SelfAttention(nn.Module):
"""Efficient self-attention mechanism."""
def __init__(self, config: PvtV2Config, hidden_size: int,... |
class PvtV2SelfAttention(nn.Module):
'''Efficient self-attention mechanism.'''
def __init__(self, config: PvtV2Config, hidden_size: int, num_attention_heads: int, spatial_reduction_ratio: int):
pass
def transpose_for_scores(self, hidden_states) -> torch.Tensor:
pass
def forward(self,... | 5 | 1 | 25 | 4 | 20 | 2 | 3 | 0.09 | 1 | 7 | 1 | 0 | 4 | 17 | 4 | 14 | 105 | 18 | 80 | 38 | 69 | 7 | 61 | 32 | 56 | 4 | 1 | 1 | 11 |
4,706 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/configuration_qwen2.py | transformers.models.qwen2.configuration_qwen2.Qwen2Config | from ...configuration_utils import PretrainedConfig, layer_type_validation
from ...modeling_rope_utils import rope_config_validation
class Qwen2Config(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Qwen2Model`]. It is used to instantiate a
Qwen2 model according to ... |
class Qwen2Config(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Qwen2Model`]. It is used to instantiate a
Qwen2 model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar co... | 2 | 1 | 54 | 3 | 48 | 3 | 4 | 1.65 | 1 | 1 | 0 | 0 | 1 | 17 | 1 | 1 | 172 | 13 | 60 | 43 | 37 | 99 | 28 | 22 | 26 | 4 | 1 | 1 | 4 |
4,707 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modeling_qwen2.py | transformers.models.qwen2.modeling_qwen2.Qwen2Attention | from typing import Callable, Optional, Union
import torch
from ...processing_utils import Unpack
from ...cache_utils import Cache, DynamicCache
from ...modeling_flash_attention_utils import FlashAttentionKwargs
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...utils.deprecation import depre... |
class Qwen2Attention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: Qwen2Config, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, posit... | 4 | 1 | 35 | 4 | 31 | 1 | 4 | 0.05 | 1 | 6 | 3 | 0 | 2 | 11 | 2 | 12 | 74 | 9 | 63 | 32 | 52 | 3 | 37 | 24 | 34 | 6 | 1 | 2 | 7 |
4,708 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modeling_qwen2.py | transformers.models.qwen2.modeling_qwen2.Qwen2DecoderLayer | import torch
from typing import Callable, Optional, Union
from ...utils.deprecation import deprecate_kwarg
from ...modeling_layers import GenericForQuestionAnswering, GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
from ...cache_utils import Cache, DynamicCache
from ...proces... |
class Qwen2DecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Qwen2Config, 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 | 27 | 3 | 23 | 2 | 2 | 0.06 | 1 | 10 | 6 | 0 | 2 | 5 | 2 | 12 | 55 | 6 | 47 | 22 | 33 | 3 | 23 | 11 | 20 | 2 | 1 | 1 | 4 |
4,709 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modeling_qwen2.py | transformers.models.qwen2.modeling_qwen2.Qwen2ForCausalLM | from ...generation import GenerationMixin
from typing import Callable, Optional, Union
from ...cache_utils import Cache, DynamicCache
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
from torch import nn
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
import torc... | @auto_docstring
class Qwen2ForCausalLM(Qwen2PreTrainedModel, 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,710 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modeling_qwen2.py | transformers.models.qwen2.modeling_qwen2.Qwen2ForQuestionAnswering | from ...modeling_layers import GenericForQuestionAnswering, GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class Qwen2ForQuestionAnswering(GenericForQuestionAnswering, Qwen2PreTrainedModel):
base_model_prefix = 'transformer' |
class Qwen2ForQuestionAnswering(GenericForQuestionAnswering, Qwen2PreTrainedModel):
pass | 1 | 0 | 18 | 2 | 13 | 3 | 2 | 0.2 | 1 | 5 | 3 | 0 | 4 | 2 | 4 | 5 | 77 | 11 | 55 | 28 | 36 | 11 | 26 | 14 | 21 | 5 | 2 | 1 | 8 |
4,711 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modeling_qwen2.py | transformers.models.qwen2.modeling_qwen2.Qwen2ForSequenceClassification | from ...modeling_layers import GenericForQuestionAnswering, GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class Qwen2ForSequenceClassification(GenericForSequenceClassification, Qwen2PreTrainedModel):
pass |
class Qwen2ForSequenceClassification(GenericForSequenceClassification, Qwen2PreTrainedModel):
pass | 1 | 0 | 21 | 2 | 17 | 2 | 3 | 0.11 | 1 | 7 | 3 | 0 | 4 | 3 | 4 | 5 | 90 | 11 | 71 | 31 | 53 | 8 | 36 | 18 | 31 | 9 | 2 | 1 | 12 |
4,712 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modeling_qwen2.py | transformers.models.qwen2.modeling_qwen2.Qwen2ForTokenClassification | from ...modeling_layers import GenericForQuestionAnswering, GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class Qwen2ForTokenClassification(GenericForTokenClassification, Qwen2PreTrainedModel):
pass |
class Qwen2ForTokenClassification(GenericForTokenClassification, Qwen2PreTrainedModel):
pass | 1 | 0 | 17 | 1 | 14 | 2 | 3 | 0.11 | 1 | 5 | 2 | 0 | 4 | 4 | 4 | 5 | 79 | 8 | 64 | 28 | 41 | 7 | 29 | 15 | 24 | 5 | 2 | 1 | 10 |
4,713 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modeling_qwen2.py | transformers.models.qwen2.modeling_qwen2.Qwen2MLP | from torch import nn
from ...activations import ACT2FN
class Qwen2MLP(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 Qwen2MLP(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,714 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modeling_qwen2.py | transformers.models.qwen2.modeling_qwen2.Qwen2Model | from ...processing_utils import Unpack
from ...utils.generic import check_model_inputs
import torch
from torch import nn
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
from ...cache_utils import Cache, DynamicCach... | @auto_docstring
class Qwen2Model(Qwen2PreTrainedModel):
def __init__(self, config: Qwen2Config):
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,715 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modeling_qwen2.py | transformers.models.qwen2.modeling_qwen2.Qwen2PreTrainedModel | from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_qwen2 import Qwen2Config
@auto_docstring
class Qwen2PreTrainedModel(PreTrainedModel):
config: Qwen2Config
base_model_prefix = 'model'
supports... | @auto_docstring
class Qwen2PreTrainedModel(PreTrainedModel):
pass | 2 | 0 | 10 | 0 | 10 | 0 | 5 | 0 | 1 | 0 | 0 | 5 | 1 | 0 | 1 | 1 | 24 | 1 | 23 | 15 | 21 | 0 | 22 | 15 | 20 | 5 | 1 | 2 | 5 |
4,716 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modeling_qwen2.py | transformers.models.qwen2.modeling_qwen2.Qwen2RMSNorm | from torch import nn
import torch
from ...integrations import use_kernel_forward_from_hub
@use_kernel_forward_from_hub('RMSNorm')
class Qwen2RMSNorm(nn.Module):
def __init__(self, hidden_size, eps: float=1e-06) -> None:
"""
Qwen2RMSNorm is equivalent to T5LayerNorm
"""
super().__in... | @use_kernel_forward_from_hub('RMSNorm')
class Qwen2RMSNorm(nn.Module):
def __init__(self, hidden_size, eps: float=1e-06) -> None:
'''
Qwen2RMSNorm is equivalent to T5LayerNorm
'''
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass
def extra_r... | 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,717 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modeling_qwen2.py | transformers.models.qwen2.modeling_qwen2.Qwen2RotaryEmbedding | from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
import torch
from .configuration_qwen2 import Qwen2Config
from torch import nn
class Qwen2RotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, config: Qwen2Config, device=None):
super().__init__()
if h... |
class Qwen2RotaryEmbedding(nn.Module):
def __init__(self, config: Qwen2Config, 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,718 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modular_qwen2.py | transformers.models.qwen2.modular_qwen2.Qwen2Attention | from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaForQuestionAnswering, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaMLP, LlamaPreTrainedModel, apply_rotary_pos_emb, eager_attention_forward
from typing import Callable, Optional
from ...processing_utils imp... |
class Qwen2Attention(LlamaAttention):
def __init__(self, config: Qwen2Config, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, position_embeddings: tuple[torch.Tensor, torch.Tensor], attention_mask: ... | 4 | 0 | 32 | 4 | 28 | 1 | 4 | 0.04 | 1 | 6 | 3 | 0 | 2 | 7 | 2 | 14 | 65 | 8 | 56 | 27 | 45 | 2 | 30 | 17 | 27 | 6 | 2 | 2 | 7 |
4,719 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modular_qwen2.py | transformers.models.qwen2.modular_qwen2.Qwen2DecoderLayer | from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaForQuestionAnswering, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaMLP, LlamaPreTrainedModel, apply_rotary_pos_emb, eager_attention_forward
from .configuration_qwen2 import Qwen2Config
class Qwen2DecoderLa... |
class Qwen2DecoderLayer(LlamaDecoderLayer):
def __init__(self, config: Qwen2Config, layer_idx: int):
pass | 2 | 0 | 9 | 0 | 9 | 0 | 2 | 0 | 1 | 5 | 3 | 0 | 1 | 2 | 1 | 13 | 10 | 0 | 10 | 4 | 8 | 0 | 7 | 4 | 5 | 2 | 2 | 1 | 2 |
4,720 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modular_qwen2.py | transformers.models.qwen2.modular_qwen2.Qwen2ForCausalLM | from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaForQuestionAnswering, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaMLP, LlamaPreTrainedModel, apply_rotary_pos_emb, eager_attention_forward
class Qwen2ForCausalLM(LlamaForCausalLM):
pass |
class Qwen2ForCausalLM(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,721 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modular_qwen2.py | transformers.models.qwen2.modular_qwen2.Qwen2ForQuestionAnswering | from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaForQuestionAnswering, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaMLP, LlamaPreTrainedModel, apply_rotary_pos_emb, eager_attention_forward
class Qwen2ForQuestionAnswering(LlamaForQuestionAnswering):
p... |
class Qwen2ForQuestionAnswering(LlamaForQuestionAnswering):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
4,722 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modular_qwen2.py | transformers.models.qwen2.modular_qwen2.Qwen2ForSequenceClassification | from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaForQuestionAnswering, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaMLP, LlamaPreTrainedModel, apply_rotary_pos_emb, eager_attention_forward
class Qwen2ForSequenceClassification(LlamaForSequenceClassificati... |
class Qwen2ForSequenceClassification(LlamaForSequenceClassification):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
4,723 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modular_qwen2.py | transformers.models.qwen2.modular_qwen2.Qwen2ForTokenClassification | from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaForQuestionAnswering, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaMLP, LlamaPreTrainedModel, apply_rotary_pos_emb, eager_attention_forward
class Qwen2ForTokenClassification(LlamaForTokenClassification):
... |
class Qwen2ForTokenClassification(LlamaForTokenClassification):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
4,724 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modular_qwen2.py | transformers.models.qwen2.modular_qwen2.Qwen2MLP | from torch import nn
from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaForQuestionAnswering, LlamaForSequenceClassification, LlamaForTokenClassification, LlamaMLP, LlamaPreTrainedModel, apply_rotary_pos_emb, eager_attention_forward
class Qwen2MLP(LlamaMLP):
def __init__(... |
class Qwen2MLP(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,725 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/modular_qwen2.py | transformers.models.qwen2.modular_qwen2.Qwen2Model | import torch
from ...modeling_outputs import BaseModelOutputWithPast
from ...utils import TransformersKwargs, auto_docstring, logging
from ..mistral.modeling_mistral import MistralModel
from ...cache_utils import Cache, DynamicCache
from ...masking_utils import create_causal_mask, create_sliding_window_causal_mask
from... |
class Qwen2Model(MistralModel):
def __init__(self, config: Qwen2Config):
pass
@check_model_inputs
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[... | 5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
4,726 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/tokenization_qwen2.py | transformers.models.qwen2.tokenization_qwen2.Qwen2Tokenizer | from typing import Optional
import os
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
import unicodedata
import regex as re
import json
class Qwen2Tokenizer(PreTrainedTokenizer):
"""
Construct a Qwen2 tokenizer. Based on byte-level Byte-Pair-Encoding.
Same with GPT2Tokenizer, this tokeni... |
class Qwen2Tokenizer(PreTrainedTokenizer):
'''
Construct a Qwen2 tokenizer. Based on byte-level Byte-Pair-Encoding.
Same with GPT2Tokenizer, this tokenizer has been trained to treat spaces like parts of the tokens so a word will
be encoded differently whether it is at the beginning of the sentence (wit... | 13 | 5 | 17 | 1 | 15 | 1 | 3 | 0.38 | 1 | 12 | 0 | 0 | 11 | 8 | 11 | 100 | 257 | 29 | 168 | 62 | 136 | 64 | 104 | 38 | 92 | 9 | 3 | 3 | 32 |
4,727 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2/tokenization_qwen2_fast.py | transformers.models.qwen2.tokenization_qwen2_fast.Qwen2TokenizerFast | from ...tokenization_utils import AddedToken
from typing import Optional
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_qwen2 import Qwen2Tokenizer
class Qwen2TokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" Qwen2 tokenizer (backed by HuggingFace's *tokenizers* ... |
class Qwen2TokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" Qwen2 tokenizer (backed by HuggingFace's *tokenizers* library). Based on byte-level
Byte-Pair-Encoding.
Same with GPT2Tokenizer, this tokenizer has been trained to treat spaces like parts of the tokens so a word will
be encod... | 3 | 1 | 25 | 1 | 22 | 2 | 3 | 0.81 | 1 | 3 | 0 | 0 | 2 | 0 | 2 | 90 | 98 | 11 | 48 | 17 | 35 | 39 | 13 | 7 | 10 | 5 | 3 | 0 | 6 |
4,728 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/configuration_qwen2_5_vl.py | transformers.models.qwen2_5_vl.configuration_qwen2_5_vl.Qwen2_5_VLConfig | from ...configuration_utils import PretrainedConfig, layer_type_validation
class Qwen2_5_VLConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Qwen2_5_VLModel`]. It is used to instantiate a
Qwen2-VL model according to the specified arguments, defining the model a... |
class Qwen2_5_VLConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Qwen2_5_VLModel`]. It is used to instantiate a
Qwen2-VL model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield... | 2 | 1 | 63 | 5 | 52 | 6 | 6 | 1.6 | 1 | 2 | 0 | 0 | 1 | 18 | 1 | 1 | 183 | 14 | 65 | 46 | 41 | 104 | 34 | 24 | 32 | 6 | 1 | 2 | 6 |
4,729 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/configuration_qwen2_5_vl.py | transformers.models.qwen2_5_vl.configuration_qwen2_5_vl.Qwen2_5_VLVisionConfig | from ...configuration_utils import PretrainedConfig, layer_type_validation
class Qwen2_5_VLVisionConfig(PretrainedConfig):
model_type = 'qwen2_5_vl'
base_config_key = 'vision_config'
def __init__(self, depth=32, hidden_size=3584, hidden_act='silu', intermediate_size=3420, num_heads=16, in_channels=3, patc... |
class Qwen2_5_VLVisionConfig(PretrainedConfig):
def __init__(self, depth=32, hidden_size=3584, hidden_act='silu', intermediate_size=3420, num_heads=16, in_channels=3, patch_size=14, spatial_merge_size=2, temporal_patch_size=2, tokens_per_second=4, window_size=112, out_hidden_size=3584, fullatt_block_indexes=[7, 1... | 2 | 0 | 32 | 1 | 31 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 13 | 1 | 1 | 36 | 2 | 34 | 33 | 16 | 0 | 18 | 17 | 16 | 1 | 1 | 0 | 1 |
4,730 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modeling_qwen2_5_vl.Qwen2MLP | import torch.nn as nn
from ...activations import ACT2FN
class Qwen2MLP(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 Qwen2MLP(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,731 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modeling_qwen2_5_vl.Qwen2_5_VLAttention | import torch.nn as nn
import torch
from .configuration_qwen2_5_vl import Qwen2_5_VLConfig, Qwen2_5_VLTextConfig, Qwen2_5_VLVisionConfig
from ...cache_utils import Cache, DynamicCache
from ...processing_utils import Unpack
from ...utils.deprecation import deprecate_kwarg
from typing import Any, Callable, Optional, Union... |
class Qwen2_5_VLAttention(nn.Module):
'''
Multi-headed attention from 'Attention Is All You Need' paper. Modified to use sliding window attention: Longformer
and "Generating Long Sequences with Sparse Transformers".
'''
def __init__(self, config: Qwen2_5_VLTextConfig, layer_idx: Optional[int]=None... | 4 | 1 | 48 | 9 | 38 | 4 | 5 | 0.14 | 1 | 8 | 3 | 2 | 2 | 15 | 2 | 12 | 103 | 19 | 76 | 37 | 63 | 11 | 54 | 27 | 51 | 6 | 1 | 1 | 9 |
4,732 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modeling_qwen2_5_vl.Qwen2_5_VLCausalLMOutputWithPast | from typing import Any, Callable, Optional, Union
import torch.nn.functional as F
from dataclasses import dataclass
import torch.nn as nn
import torch
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, is_torchdynamo_compiling, logging
from ...modeling_outputs import BaseModelOutputWithPast, Mod... | @dataclass
@auto_docstring(custom_intro='\n Base class for Qwen2_5_VL causal language model (or autoregressive) outputs.\n ')
class Qwen2_5_VLCausalLMOutputWithPast(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Language modeling loss ... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.43 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 36 | 5 | 7 | 7 | 6 | 24 | 7 | 7 | 6 | 0 | 1 | 0 | 0 |
4,733 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modeling_qwen2_5_vl.Qwen2_5_VLDecoderLayer | from ...modeling_layers import GradientCheckpointingLayer
import torch
from .configuration_qwen2_5_vl import Qwen2_5_VLConfig, Qwen2_5_VLTextConfig, Qwen2_5_VLVisionConfig
from ...cache_utils import Cache, DynamicCache
import torch.nn as nn
from ...processing_utils import Unpack
from ...utils.deprecation import depreca... |
class Qwen2_5_VLDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Qwen2_5_VLTextConfig, 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... | 4 | 1 | 40 | 5 | 24 | 12 | 3 | 0.5 | 1 | 7 | 3 | 0 | 2 | 5 | 2 | 12 | 82 | 11 | 48 | 22 | 34 | 24 | 25 | 11 | 22 | 3 | 1 | 1 | 5 |
4,734 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modeling_qwen2_5_vl.Qwen2_5_VLForConditionalGeneration | import torch.nn as nn
from typing import Any, Callable, Optional, Union
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, is_torchdynamo_compiling, logging
import torch.nn.functional as F
from ...processing_utils import Unpack
import torch
from ...generation import GenerationMixin
from ...cache... |
class Qwen2_5_VLForConditionalGeneration(Qwen2_5_VLPreTrainedModel, 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):
... | 21 | 2 | 46 | 4 | 32 | 10 | 5 | 0.31 | 2 | 11 | 4 | 0 | 10 | 6 | 10 | 11 | 476 | 53 | 327 | 120 | 273 | 102 | 183 | 77 | 172 | 17 | 2 | 5 | 46 |
4,735 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modeling_qwen2_5_vl.Qwen2_5_VLMLP | import torch.nn as nn
from ...activations import ACT2FN
class Qwen2_5_VLMLP(nn.Module):
def __init__(self, config, bias: bool=False):
super().__init__()
self.hidden_size = config.hidden_size
self.intermediate_size = config.intermediate_size
self.gate_proj = nn.Linear(self.hidden_si... |
class Qwen2_5_VLMLP(nn.Module):
def __init__(self, config, bias: bool=False):
pass
def forward(self, hidden_state):
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 6 | 2 | 12 | 12 | 1 | 11 | 9 | 8 | 0 | 11 | 9 | 8 | 1 | 1 | 0 | 2 |
4,736 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modeling_qwen2_5_vl.Qwen2_5_VLModel | from ...processing_utils import Unpack
from typing import Any, Callable, Optional, Union
import torch.nn.functional as F
import torch.nn as nn
import torch
from .configuration_qwen2_5_vl import Qwen2_5_VLConfig, Qwen2_5_VLTextConfig, Qwen2_5_VLVisionConfig
from ...utils import TransformersKwargs, auto_docstring, can_re... | @auto_docstring
class Qwen2_5_VLModel(Qwen2_5_VLPreTrainedModel):
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
def g... | 13 | 5 | 47 | 5 | 35 | 7 | 8 | 0.2 | 1 | 17 | 10 | 0 | 5 | 9 | 6 | 7 | 290 | 34 | 214 | 71 | 177 | 43 | 107 | 40 | 100 | 25 | 2 | 3 | 45 |
4,737 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modeling_qwen2_5_vl.Qwen2_5_VLPatchMerger | import torch
import torch.nn as nn
from ..qwen2.modeling_qwen2 import Qwen2RMSNorm
import torch.nn.functional as F
class Qwen2_5_VLPatchMerger(nn.Module):
def __init__(self, dim: int, context_dim: int, spatial_merge_size: int=2) -> None:
super().__init__()
self.hidden_size = context_dim * spatial_... |
class Qwen2_5_VLPatchMerger(nn.Module):
def __init__(self, dim: int, context_dim: int, spatial_merge_size: int=2) -> None:
pass
def forward(self, x: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 4 | 1 | 0 | 2 | 3 | 2 | 12 | 14 | 1 | 13 | 6 | 10 | 0 | 9 | 6 | 6 | 1 | 1 | 0 | 2 |
4,738 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modeling_qwen2_5_vl.Qwen2_5_VLPreTrainedModel | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, is_torchdynamo_compiling, logging
from .configuration_qwen2_5_vl import Qwen2_5_VLConfig, Qwen2_5_VLTextConfig, Qwen2_5_VLVisionConfig
@auto_docstring
class Qwen2_5_VLPreTra... | @auto_docstring
class Qwen2_5_VLPreTrainedModel(PreTrainedModel):
pass | 2 | 0 | 10 | 0 | 10 | 0 | 5 | 0.05 | 1 | 0 | 0 | 3 | 1 | 0 | 1 | 1 | 21 | 1 | 20 | 12 | 18 | 1 | 19 | 12 | 17 | 5 | 1 | 2 | 5 |
4,739 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modeling_qwen2_5_vl.Qwen2_5_VLRotaryEmbedding | import torch.nn as nn
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
import torch
from .configuration_qwen2_5_vl import Qwen2_5_VLConfig, Qwen2_5_VLTextConfig, Qwen2_5_VLVisionConfig
import torch.nn.functional as F
class Qwen2_5_VLRotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
... |
class Qwen2_5_VLRotaryEmbedding(nn.Module):
def __init__(self, config: Qwen2_5_VLTextConfig, device=None):
pass
@torch.no_grad()
@dynamic_rope_update
def forward(self, x, position_ids):
pass | 5 | 0 | 18 | 2 | 13 | 5 | 3 | 0.34 | 1 | 4 | 1 | 0 | 3 | 7 | 3 | 13 | 59 | 8 | 41 | 21 | 36 | 14 | 37 | 20 | 33 | 3 | 1 | 1 | 8 |
4,740 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modeling_qwen2_5_vl.Qwen2_5_VLVisionAttention | from typing import Any, Callable, Optional, Union
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
import torch.nn.functional as F
import torch.nn as nn
import torch
from .configuration_qwen2_5_vl import Qwen2_5_VLConfig, Qwen2_5_VLTextConfig, Qwen2_5_VLVisionConfig
class Qwen2_5_VLVisionAttentio... |
class Qwen2_5_VLVisionAttention(nn.Module):
def __init__(self, config: Qwen2_5_VLVisionConfig) -> None:
pass
def forward(self, hidden_states: torch.Tensor, cu_seqlens: torch.Tensor, rotary_pos_emb: Optional[torch.Tensor]=None, position_embeddings: Optional[tuple[torch.Tensor, torch.Tensor]]=None, **k... | 3 | 0 | 16 | 1 | 15 | 0 | 2 | 0 | 1 | 4 | 0 | 0 | 2 | 4 | 2 | 12 | 33 | 3 | 30 | 15 | 25 | 0 | 26 | 13 | 23 | 2 | 1 | 1 | 3 |
4,741 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modeling_qwen2_5_vl.Qwen2_5_VLVisionBlock | import torch.nn as nn
import torch
from ..qwen2.modeling_qwen2 import Qwen2RMSNorm
from ...modeling_layers import GradientCheckpointingLayer
from typing import Any, Callable, Optional, Union
import torch.nn.functional as F
class Qwen2_5_VLVisionBlock(GradientCheckpointingLayer):
def __init__(self, config, attn_im... |
class Qwen2_5_VLVisionBlock(GradientCheckpointingLayer):
def __init__(self, config, attn_implementation: str='sdpa') -> None:
pass
def forward(self, hidden_states: torch.Tensor, cu_seqlens: torch.Tensor, rotary_pos_emb: Optional[torch.Tensor]=None, position_embeddings: Optional[tuple[torch.Tensor, to... | 3 | 0 | 8 | 0 | 8 | 0 | 1 | 0 | 1 | 5 | 2 | 0 | 2 | 4 | 2 | 12 | 18 | 1 | 17 | 7 | 14 | 0 | 11 | 7 | 8 | 1 | 1 | 0 | 2 |
4,742 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modeling_qwen2_5_vl.Qwen2_5_VisionPatchEmbed | import torch
import torch.nn as nn
import torch.nn.functional as F
class Qwen2_5_VisionPatchEmbed(nn.Module):
def __init__(self, patch_size: int=14, temporal_patch_size: int=2, in_channels: int=3, embed_dim: int=1152) -> None:
super().__init__()
self.patch_size = patch_size
self.temporal_p... |
class Qwen2_5_VisionPatchEmbed(nn.Module):
def __init__(self, patch_size: int=14, temporal_patch_size: int=2, in_channels: int=3, embed_dim: int=1152) -> None:
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 11 | 1 | 11 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 2 | 5 | 2 | 12 | 24 | 2 | 22 | 16 | 13 | 0 | 14 | 10 | 11 | 1 | 1 | 0 | 2 |
4,743 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modeling_qwen2_5_vl.Qwen2_5_VisionRotaryEmbedding | import torch.nn as nn
import torch.nn.functional as F
import torch
class Qwen2_5_VisionRotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, dim: int, theta: float=10000.0) -> None:
super().__init__()
inv_freq = 1.0 / theta ** (torch.arange(0, dim, 2, dtype=torch.float) / dim)
... |
class Qwen2_5_VisionRotaryEmbedding(nn.Module):
def __init__(self, dim: int, theta: float=10000.0) -> None:
pass
def forward(self, seqlen: int) -> torch.Tensor:
pass | 3 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 4 | 0 | 0 | 2 | 0 | 2 | 12 | 10 | 1 | 9 | 6 | 6 | 0 | 9 | 6 | 6 | 1 | 1 | 0 | 2 |
4,744 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modeling_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modeling_qwen2_5_vl.Qwen2_5_VisionTransformerPretrainedModel | from .configuration_qwen2_5_vl import Qwen2_5_VLConfig, Qwen2_5_VLTextConfig, Qwen2_5_VLVisionConfig
import torch.nn as nn
import torch.nn.functional as F
import torch
class Qwen2_5_VisionTransformerPretrainedModel(Qwen2_5_VLPreTrainedModel):
config: Qwen2_5_VLVisionConfig
_no_split_modules = ['Qwen2_5_VLVisio... |
class Qwen2_5_VisionTransformerPretrainedModel(Qwen2_5_VLPreTrainedModel):
def __init__(self, config, *inputs, **kwargs) -> None:
pass
def rot_pos_emb(self, grid_thw):
pass
def get_window_index(self, grid_thw):
pass
def forward(self, hidden_states: torch.Tensor, grid_thw: to... | 5 | 1 | 39 | 3 | 33 | 3 | 3 | 0.1 | 1 | 9 | 4 | 0 | 4 | 10 | 4 | 5 | 162 | 16 | 133 | 48 | 128 | 13 | 83 | 47 | 78 | 6 | 2 | 2 | 11 |
4,745 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modular_qwen2_5_vl.Qwen2_5_VLCausalLMOutputWithPast | from transformers.models.qwen2_vl.modeling_qwen2_vl import PatchEmbed, PatchMerger, Qwen2RMSNorm, Qwen2VLCausalLMOutputWithPast, Qwen2VLForConditionalGeneration, Qwen2VLModel, Qwen2VLModelOutputWithPast, Qwen2VLPreTrainedModel, TransformersKwargs, VisionAttention, VisionRotaryEmbedding
class Qwen2_5_VLCausalLMOutputWi... |
class Qwen2_5_VLCausalLMOutputWithPast(Qwen2VLCausalLMOutputWithPast):
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,746 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modular_qwen2_5_vl.Qwen2_5_VLConfig | from transformers.models.qwen2_vl.configuration_qwen2_vl import Qwen2VLConfig, Qwen2VLTextConfig
class Qwen2_5_VLConfig(Qwen2VLConfig):
model_type = 'qwen2_5_vl'
sub_configs = {'vision_config': Qwen2_5_VLVisionConfig, 'text_config': Qwen2_5_VLTextConfig} |
class Qwen2_5_VLConfig(Qwen2VLConfig):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 3 | 0 | 3 | 3 | 2 | 0 | 3 | 3 | 2 | 0 | 2 | 0 | 0 |
4,747 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modular_qwen2_5_vl.Qwen2_5_VLForConditionalGeneration | from typing import Optional, Union
import torch.nn as nn
import torch.nn.functional as F
from ...processing_utils import MultiModalData, ProcessingKwargs, Unpack, VideosKwargs
from transformers.models.qwen2_vl.modeling_qwen2_vl import PatchEmbed, PatchMerger, Qwen2RMSNorm, Qwen2VLCausalLMOutputWithPast, Qwen2VLForCondi... |
class Qwen2_5_VLForConditionalGeneration(Qwen2VLForConditionalGeneration):
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[Cache]=None, inputs_embeds: Optional[torch.FloatTensor]=Non... | 3 | 1 | 110 | 11 | 76 | 25 | 10 | 0.33 | 1 | 10 | 3 | 0 | 4 | 3 | 4 | 15 | 448 | 46 | 307 | 109 | 261 | 100 | 165 | 67 | 160 | 17 | 3 | 5 | 40 |
4,748 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modular_qwen2_5_vl.Qwen2_5_VLMLP | from ...activations import ACT2FN
import torch.nn as nn
class Qwen2_5_VLMLP(nn.Module):
def __init__(self, config, bias: bool=False):
super().__init__()
self.hidden_size = config.hidden_size
self.intermediate_size = config.intermediate_size
self.gate_proj = nn.Linear(self.hidden_si... |
class Qwen2_5_VLMLP(nn.Module):
def __init__(self, config, bias: bool=False):
pass
def forward(self, hidden_state):
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 6 | 2 | 12 | 12 | 1 | 11 | 9 | 8 | 0 | 11 | 9 | 8 | 1 | 1 | 0 | 2 |
4,749 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modular_qwen2_5_vl.Qwen2_5_VLModel | from ...processing_utils import MultiModalData, ProcessingKwargs, Unpack, VideosKwargs
from transformers.models.qwen2_vl.modeling_qwen2_vl import PatchEmbed, PatchMerger, Qwen2RMSNorm, Qwen2VLCausalLMOutputWithPast, Qwen2VLForConditionalGeneration, Qwen2VLModel, Qwen2VLModelOutputWithPast, Qwen2VLPreTrainedModel, Trans... |
class Qwen2_5_VLModel(Qwen2VLModel):
def __init__(self, config):
pass
def get_rope_index(self, input_ids: Optional[torch.LongTensor]=None, image_grid_thw: Optional[torch.LongTensor]=None, video_grid_thw: Optional[torch.LongTensor]=None, second_per_grid_ts: Optional[torch.Tensor]=None, attention_mask:... | 4 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
4,750 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modular_qwen2_5_vl.Qwen2_5_VLPatchMerger | from transformers.models.qwen2_vl.modeling_qwen2_vl import PatchEmbed, PatchMerger, Qwen2RMSNorm, Qwen2VLCausalLMOutputWithPast, Qwen2VLForConditionalGeneration, Qwen2VLModel, Qwen2VLModelOutputWithPast, Qwen2VLPreTrainedModel, TransformersKwargs, VisionAttention, VisionRotaryEmbedding
class Qwen2_5_VLPatchMerger(Patc... |
class Qwen2_5_VLPatchMerger(PatchMerger):
def __init__(self, dim: int, context_dim: int, spatial_merge_size: int=2) -> None:
pass | 2 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 1 | 1 | 1 | 13 | 4 | 0 | 4 | 3 | 2 | 0 | 4 | 3 | 2 | 1 | 2 | 0 | 1 |
4,751 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modular_qwen2_5_vl.Qwen2_5_VLPreTrainedModel | from transformers.models.qwen2_vl.modeling_qwen2_vl import PatchEmbed, PatchMerger, Qwen2RMSNorm, Qwen2VLCausalLMOutputWithPast, Qwen2VLForConditionalGeneration, Qwen2VLModel, Qwen2VLModelOutputWithPast, Qwen2VLPreTrainedModel, TransformersKwargs, VisionAttention, VisionRotaryEmbedding
class Qwen2_5_VLPreTrainedModel(... |
class Qwen2_5_VLPreTrainedModel(Qwen2VLPreTrainedModel):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
4,752 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modular_qwen2_5_vl.Qwen2_5_VLProcessor | from transformers.models.qwen2_vl.processing_qwen2_vl import Qwen2VLImagesKwargs, Qwen2VLProcessor
from ...tokenization_utils_base import PreTokenizedInput, TextInput
import numpy as np
from ...feature_extraction_utils import BatchFeature
from ...processing_utils import MultiModalData, ProcessingKwargs, Unpack, VideosK... |
class Qwen2_5_VLProcessor(Qwen2VLProcessor):
'''
Constructs a Qwen2.5-VL processor which wraps a Qwen2.5-VL image processor and a Qwen2 tokenizer into a single processor.
[`Qwen2_5_VLProcessor`] offers all the functionalities of [`Qwen2VLImageProcessor`] and [`Qwen2TokenizerFast`]. See the
[`~Qwen2_5_V... | 5 | 3 | 107 | 11 | 62 | 34 | 13 | 0.72 | 1 | 7 | 2 | 0 | 1 | 2 | 1 | 24 | 123 | 13 | 64 | 22 | 56 | 46 | 40 | 14 | 38 | 13 | 3 | 3 | 13 |
4,753 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modular_qwen2_5_vl.Qwen2_5_VLProcessorKwargs | from ...processing_utils import MultiModalData, ProcessingKwargs, Unpack, VideosKwargs
class Qwen2_5_VLProcessorKwargs(ProcessingKwargs, total=False):
images_kwargs: Qwen2_5_VLImagesKwargs
videos_kwargs: Qwen2_5_VLVideosProcessorKwargs
_defaults = {'text_kwargs': {'padding': False, 'return_mm_token_type_id... |
class Qwen2_5_VLProcessorKwargs(ProcessingKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 0 | 8 | 2 | 7 | 0 | 3 | 2 | 2 | 0 | 3 | 0 | 0 |
4,754 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modular_qwen2_5_vl.Qwen2_5_VLVideosProcessorKwargs | from typing import Optional, Union
from ...processing_utils import MultiModalData, ProcessingKwargs, Unpack, VideosKwargs
class Qwen2_5_VLVideosProcessorKwargs(VideosKwargs, total=False):
fps: Union[list[float], float] |
class Qwen2_5_VLVideosProcessorKwargs(VideosKwargs, 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,755 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modular_qwen2_5_vl.Qwen2_5_VLVisionAttention | from transformers.models.qwen2_vl.modeling_qwen2_vl import PatchEmbed, PatchMerger, Qwen2RMSNorm, Qwen2VLCausalLMOutputWithPast, Qwen2VLForConditionalGeneration, Qwen2VLModel, Qwen2VLModelOutputWithPast, Qwen2VLPreTrainedModel, TransformersKwargs, VisionAttention, VisionRotaryEmbedding
class Qwen2_5_VLVisionAttention(... |
class Qwen2_5_VLVisionAttention(VisionAttention):
def __init__(self, config: Qwen2_5_VLVisionConfig) -> None:
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
4,756 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modular_qwen2_5_vl.Qwen2_5_VLVisionBlock | from ...modeling_layers import GradientCheckpointingLayer
from typing import Optional, Union
from transformers.models.qwen2_vl.modeling_qwen2_vl import PatchEmbed, PatchMerger, Qwen2RMSNorm, Qwen2VLCausalLMOutputWithPast, Qwen2VLForConditionalGeneration, Qwen2VLModel, Qwen2VLModelOutputWithPast, Qwen2VLPreTrainedModel,... |
class Qwen2_5_VLVisionBlock(GradientCheckpointingLayer):
def __init__(self, config, attn_implementation: str='sdpa') -> None:
pass
def forward(self, hidden_states: torch.Tensor, cu_seqlens: torch.Tensor, rotary_pos_emb: Optional[torch.Tensor]=None, position_embeddings: Optional[tuple[torch.Tensor, to... | 3 | 0 | 8 | 0 | 8 | 0 | 1 | 0 | 1 | 5 | 1 | 0 | 2 | 4 | 2 | 12 | 18 | 1 | 17 | 7 | 14 | 0 | 11 | 7 | 8 | 1 | 1 | 0 | 2 |
4,757 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modular_qwen2_5_vl.Qwen2_5_VLVisionConfig | from ...configuration_utils import PretrainedConfig
class Qwen2_5_VLVisionConfig(PretrainedConfig):
model_type = 'qwen2_5_vl'
base_config_key = 'vision_config'
def __init__(self, depth=32, hidden_size=3584, hidden_act='silu', intermediate_size=3420, num_heads=16, in_channels=3, patch_size=14, spatial_merg... |
class Qwen2_5_VLVisionConfig(PretrainedConfig):
def __init__(self, depth=32, hidden_size=3584, hidden_act='silu', intermediate_size=3420, num_heads=16, in_channels=3, patch_size=14, spatial_merge_size=2, temporal_patch_size=2, tokens_per_second=4, window_size=112, out_hidden_size=3584, fullatt_block_indexes=[7, 1... | 2 | 0 | 32 | 1 | 31 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 13 | 1 | 33 | 36 | 2 | 34 | 33 | 16 | 0 | 18 | 17 | 16 | 1 | 2 | 0 | 1 |
4,758 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modular_qwen2_5_vl.Qwen2_5_VisionPatchEmbed | from transformers.models.qwen2_vl.modeling_qwen2_vl import PatchEmbed, PatchMerger, Qwen2RMSNorm, Qwen2VLCausalLMOutputWithPast, Qwen2VLForConditionalGeneration, Qwen2VLModel, Qwen2VLModelOutputWithPast, Qwen2VLPreTrainedModel, TransformersKwargs, VisionAttention, VisionRotaryEmbedding
class Qwen2_5_VisionPatchEmbed(P... |
class Qwen2_5_VisionPatchEmbed(PatchEmbed):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
4,759 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modular_qwen2_5_vl.Qwen2_5_VisionRotaryEmbedding | from transformers.models.qwen2_vl.modeling_qwen2_vl import PatchEmbed, PatchMerger, Qwen2RMSNorm, Qwen2VLCausalLMOutputWithPast, Qwen2VLForConditionalGeneration, Qwen2VLModel, Qwen2VLModelOutputWithPast, Qwen2VLPreTrainedModel, TransformersKwargs, VisionAttention, VisionRotaryEmbedding
class Qwen2_5_VisionRotaryEmbedd... |
class Qwen2_5_VisionRotaryEmbedding(VisionRotaryEmbedding):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
4,760 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/modular_qwen2_5_vl.py | transformers.models.qwen2_5_vl.modular_qwen2_5_vl.Qwen2_5_VisionTransformerPretrainedModel | import torch.nn as nn
import torch.nn.functional as F
import torch
class Qwen2_5_VisionTransformerPretrainedModel(Qwen2_5_VLPreTrainedModel):
config: Qwen2_5_VLVisionConfig
_no_split_modules = ['Qwen2_5_VLVisionBlock']
def __init__(self, config, *inputs, **kwargs) -> None:
super().__init__(config,... |
class Qwen2_5_VisionTransformerPretrainedModel(Qwen2_5_VLPreTrainedModel):
def __init__(self, config, *inputs, **kwargs) -> None:
pass
def rot_pos_emb(self, grid_thw):
pass
def get_window_index(self, grid_thw):
pass
def forward(self, hidden_states: torch.Tensor, grid_thw: to... | 5 | 1 | 39 | 3 | 33 | 3 | 3 | 0.1 | 1 | 9 | 4 | 0 | 4 | 10 | 4 | 5 | 162 | 16 | 133 | 48 | 128 | 13 | 83 | 47 | 78 | 6 | 3 | 2 | 11 |
4,761 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/processing_qwen2_5_vl.py | transformers.models.qwen2_5_vl.processing_qwen2_5_vl.Qwen2_5_VLProcessor | from ...video_utils import VideoInput
import numpy as np
from typing import Optional, Union
from ...tokenization_utils_base import PreTokenizedInput, TextInput
from ...feature_extraction_utils import BatchFeature
from ...image_utils import ImageInput
from ...processing_utils import ImagesKwargs, MultiModalData, Process... |
class Qwen2_5_VLProcessor(ProcessorMixin):
'''
Constructs a Qwen2.5-VL processor which wraps a Qwen2.5-VL image processor and a Qwen2 tokenizer into a single processor.
[`Qwen2_5_VLProcessor`] offers all the functionalities of [`Qwen2VLImageProcessor`] and [`Qwen2TokenizerFast`]. See the
[`~Qwen2_5_VLP... | 7 | 4 | 24 | 2 | 13 | 9 | 3 | 0.75 | 1 | 9 | 2 | 0 | 6 | 2 | 6 | 23 | 168 | 21 | 84 | 33 | 70 | 63 | 57 | 26 | 50 | 13 | 2 | 3 | 20 |
4,762 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/processing_qwen2_5_vl.py | transformers.models.qwen2_5_vl.processing_qwen2_5_vl.Qwen2_5_VLProcessorKwargs | from ...processing_utils import ImagesKwargs, MultiModalData, ProcessingKwargs, ProcessorMixin, Unpack, VideosKwargs
class Qwen2_5_VLProcessorKwargs(ProcessingKwargs, total=False):
images_kwargs: Qwen2_5_VLImagesKwargs
videos_kwargs: Qwen2_5_VLVideosProcessorKwargs
_defaults = {'text_kwargs': {'padding': F... |
class Qwen2_5_VLProcessorKwargs(ProcessingKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 0 | 8 | 2 | 7 | 0 | 3 | 2 | 2 | 0 | 3 | 0 | 0 |
4,763 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_5_vl/processing_qwen2_5_vl.py | transformers.models.qwen2_5_vl.processing_qwen2_5_vl.Qwen2_5_VLVideosProcessorKwargs | from typing import Optional, Union
from ...processing_utils import ImagesKwargs, MultiModalData, ProcessingKwargs, ProcessorMixin, Unpack, VideosKwargs
class Qwen2_5_VLVideosProcessorKwargs(VideosKwargs, total=False):
fps: Union[list[float], float] |
class Qwen2_5_VLVideosProcessorKwargs(VideosKwargs, 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,764 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_audio/configuration_qwen2_audio.py | transformers.models.qwen2_audio.configuration_qwen2_audio.Qwen2AudioConfig | from ..auto import CONFIG_MAPPING, AutoConfig
from ...configuration_utils import PretrainedConfig
class Qwen2AudioConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Qwen2AudioForConditionalGeneration`]. It is used to instantiate an
Qwen2-Audio model according to... |
class Qwen2AudioConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Qwen2AudioForConditionalGeneration`]. It is used to instantiate an
Qwen2-Audio model according to the specified arguments, defining the model architecture. Instantiating a configuration
with ... | 2 | 1 | 38 | 5 | 33 | 0 | 7 | 0.78 | 1 | 2 | 0 | 0 | 1 | 3 | 1 | 1 | 81 | 17 | 36 | 13 | 28 | 28 | 16 | 7 | 14 | 7 | 1 | 1 | 7 |
4,765 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_audio/configuration_qwen2_audio.py | transformers.models.qwen2_audio.configuration_qwen2_audio.Qwen2AudioEncoderConfig | from ...configuration_utils import PretrainedConfig
class Qwen2AudioEncoderConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Qwen2AudioEncoder`]. It is used to instantiate a
Qwen2-Audio audio encoder according to the specified arguments, defining the model arch... |
class Qwen2AudioEncoderConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Qwen2AudioEncoder`]. It is used to instantiate a
Qwen2-Audio audio encoder according to the specified arguments, defining the model architecture. Instantiating a
configuration with the... | 2 | 1 | 33 | 1 | 32 | 1 | 1 | 1.44 | 1 | 1 | 0 | 0 | 1 | 14 | 1 | 1 | 93 | 11 | 34 | 33 | 16 | 49 | 18 | 17 | 16 | 1 | 1 | 0 | 1 |
4,766 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_audio/modeling_qwen2_audio.py | transformers.models.qwen2_audio.modeling_qwen2_audio.Qwen2AudioAttention | from typing import Callable, Optional, Union
import torch
from .configuration_qwen2_audio import Qwen2AudioConfig, Qwen2AudioEncoderConfig
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from torch import nn
class Qwen2AudioAttention(nn.Module):
"""Multi-headed attention from 'Attention Is A... |
class Qwen2AudioAttention(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, layer_idx: Optional[int]=None, config: Optional[Qwen2AudioConfig]=Non... | 4 | 2 | 40 | 5 | 31 | 4 | 5 | 0.14 | 1 | 8 | 2 | 2 | 3 | 13 | 3 | 13 | 125 | 19 | 94 | 47 | 71 | 13 | 58 | 28 | 54 | 11 | 1 | 2 | 15 |
4,767 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_audio/modeling_qwen2_audio.py | transformers.models.qwen2_audio.modeling_qwen2_audio.Qwen2AudioCausalLMOutputWithPast | from ...modeling_outputs import BaseModelOutput, ModelOutput
from typing import Callable, Optional, Union
from ...cache_utils import Cache
from dataclasses import dataclass
from ...utils import auto_docstring, logging
import torch
@dataclass
@auto_docstring(custom_intro='\n Base class for Qwen2Audio causal language... | @dataclass
@auto_docstring(custom_intro='\n Base class for Qwen2Audio causal language model (or autoregressive) outputs.\n ')
class Qwen2AudioCausalLMOutputWithPast(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Language modeling loss ... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.43 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 36 | 5 | 7 | 7 | 6 | 24 | 7 | 7 | 6 | 0 | 1 | 0 | 0 |
4,768 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_audio/modeling_qwen2_audio.py | transformers.models.qwen2_audio.modeling_qwen2_audio.Qwen2AudioEncoder | from ...modeling_outputs import BaseModelOutput, ModelOutput
import torch
import math
from .configuration_qwen2_audio import Qwen2AudioConfig, Qwen2AudioEncoderConfig
from torch import nn
from ...utils import auto_docstring, logging
@auto_docstring(custom_intro='\n The audio model from Qwen2Audio without any head o... | @auto_docstring(custom_intro='\n The audio model from Qwen2Audio without any head or projection on top.\n ')
class Qwen2AudioEncoder(Qwen2AudioPreTrainedModel):
'''
Transformer encoder consisting of *config.encoder_layers* self attention layers. Each layer is a
[`Qwen2AudioEncoderLayer`].
Args:
... | 8 | 3 | 26 | 4 | 17 | 6 | 4 | 0.41 | 1 | 8 | 3 | 0 | 6 | 14 | 6 | 7 | 177 | 29 | 106 | 45 | 91 | 43 | 77 | 37 | 70 | 19 | 2 | 3 | 26 |
4,769 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_audio/modeling_qwen2_audio.py | transformers.models.qwen2_audio.modeling_qwen2_audio.Qwen2AudioEncoderLayer | from torch import nn
from ...modeling_layers import GradientCheckpointingLayer
from .configuration_qwen2_audio import Qwen2AudioConfig, Qwen2AudioEncoderConfig
from ...activations import ACT2FN
import torch
class Qwen2AudioEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Qwen2AudioConfig):
... |
class Qwen2AudioEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Qwen2AudioConfig):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, layer_head_mask: torch.Tensor, output_attentions: bool=False) -> torch.Tensor:
'''
Args:
... | 3 | 1 | 33 | 3 | 25 | 6 | 2 | 0.22 | 1 | 4 | 1 | 0 | 2 | 9 | 2 | 12 | 68 | 7 | 50 | 22 | 41 | 11 | 32 | 16 | 29 | 3 | 1 | 1 | 4 |
4,770 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_audio/modeling_qwen2_audio.py | transformers.models.qwen2_audio.modeling_qwen2_audio.Qwen2AudioForConditionalGeneration | from ...cache_utils import Cache
from torch import nn
from .configuration_qwen2_audio import Qwen2AudioConfig, Qwen2AudioEncoderConfig
from ...generation import GenerationMixin
import torch
from ...utils import auto_docstring, logging
from ..auto import AutoModel, AutoModelForCausalLM
from typing import Callable, Optio... | @auto_docstring(custom_intro='\n The QWEN2AUDIO model which consists of a audio backbone and a language model.\n ')
class Qwen2AudioForConditionalGeneration(Qwen2AudioPreTrainedModel, GenerationMixin):
def __init__(self, config: Qwen2AudioConfig):
pass
@property
def padding_side(self):
... | 17 | 2 | 36 | 4 | 22 | 10 | 4 | 0.48 | 2 | 14 | 6 | 0 | 14 | 7 | 14 | 15 | 531 | 63 | 318 | 117 | 269 | 152 | 195 | 84 | 180 | 13 | 2 | 4 | 54 |
4,771 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_audio/modeling_qwen2_audio.py | transformers.models.qwen2_audio.modeling_qwen2_audio.Qwen2AudioMultiModalProjector | from .configuration_qwen2_audio import Qwen2AudioConfig, Qwen2AudioEncoderConfig
from torch import nn
class Qwen2AudioMultiModalProjector(nn.Module):
def __init__(self, config: Qwen2AudioConfig):
super().__init__()
self.linear = nn.Linear(config.audio_config.d_model, config.text_config.hidden_size... |
class Qwen2AudioMultiModalProjector(nn.Module):
def __init__(self, config: Qwen2AudioConfig):
pass
def forward(self, audio_features):
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 2 | 1 | 2 | 12 | 8 | 1 | 7 | 5 | 4 | 0 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
4,772 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_audio/modeling_qwen2_audio.py | transformers.models.qwen2_audio.modeling_qwen2_audio.Qwen2AudioPreTrainedModel | from torch import nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...utils import auto_docstring, logging
from .configuration_qwen2_audio import Qwen2AudioConfig, Qwen2AudioEncoderConfig
@auto_docstring
class Qwen2AudioPreTrainedModel(PreTrainedModel):
config: Qwen2AudioConfig
ba... | @auto_docstring
class Qwen2AudioPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 13 | 1 | 10 | 2 | 6 | 0.11 | 1 | 0 | 0 | 2 | 1 | 0 | 1 | 1 | 22 | 2 | 18 | 10 | 16 | 2 | 17 | 10 | 15 | 6 | 1 | 2 | 6 |
4,773 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_audio/processing_qwen2_audio.py | transformers.models.qwen2_audio.processing_qwen2_audio.Qwen2AudioProcessor | from ...tokenization_utils_base import PreTokenizedInput, TextInput
from ...feature_extraction_utils import BatchFeature
from typing import Union
import numpy as np
from ...processing_utils import ProcessingKwargs, ProcessorMixin, Unpack
class Qwen2AudioProcessor(ProcessorMixin):
"""
Constructs a Qwen2Audio pr... |
class Qwen2AudioProcessor(ProcessorMixin):
'''
Constructs a Qwen2Audio processor which wraps a Qwen2Audio feature extractor and a Qwen2Audio tokenizer into a single processor.
[`Qwen2AudioProcessor`] offers all the functionalities of [`WhisperFeatureExtractor`] and [`Qwen2TokenizerFast`]. See the
[`~Qw... | 7 | 3 | 31 | 3 | 18 | 10 | 4 | 0.69 | 1 | 9 | 1 | 0 | 6 | 3 | 6 | 23 | 217 | 27 | 113 | 46 | 89 | 78 | 58 | 29 | 51 | 14 | 2 | 4 | 23 |
4,774 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_moe/configuration_qwen2_moe.py | transformers.models.qwen2_moe.configuration_qwen2_moe.Qwen2MoeConfig | from ...configuration_utils import PretrainedConfig
from ...modeling_rope_utils import rope_config_validation
class Qwen2MoeConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Qwen2MoeModel`]. It is used to instantiate a
Qwen2MoE model according to the specified ... |
class Qwen2MoeConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Qwen2MoeModel`]. It is used to instantiate a
Qwen2MoE model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a s... | 2 | 1 | 70 | 3 | 64 | 3 | 4 | 1.58 | 1 | 1 | 0 | 0 | 1 | 26 | 1 | 1 | 209 | 13 | 76 | 61 | 44 | 120 | 35 | 31 | 33 | 4 | 1 | 1 | 4 |
4,775 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_moe/modeling_qwen2_moe.py | transformers.models.qwen2_moe.modeling_qwen2_moe.Qwen2MoeAttention | import torch
from ...cache_utils import Cache, DynamicCache, StaticCache
from torch import nn
from ...utils.deprecation import deprecate_kwarg
from typing import Optional, Union
from .configuration_qwen2_moe import Qwen2MoeConfig
import torch.nn.functional as F
import math
class Qwen2MoeAttention(nn.Module):
"""
... |
class Qwen2MoeAttention(nn.Module):
'''
Multi-headed attention from 'Attention Is All You Need' paper. Modified to use sliding window attention: Longformer
and "Generating Long Sequences with Sparse Transformers".
'''
def __init__(self, config: Qwen2MoeConfig, layer_idx: Optional[int]=None):
... | 4 | 1 | 45 | 8 | 36 | 3 | 4 | 0.14 | 1 | 8 | 3 | 2 | 2 | 16 | 2 | 12 | 98 | 18 | 73 | 38 | 60 | 10 | 53 | 28 | 50 | 5 | 1 | 1 | 8 |
4,776 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_moe/modeling_qwen2_moe.py | transformers.models.qwen2_moe.modeling_qwen2_moe.Qwen2MoeDecoderLayer | from ...cache_utils import Cache, DynamicCache, StaticCache
from typing import Optional, Union
from ...modeling_layers import GenericForQuestionAnswering, GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
from .configuration_qwen2_moe import Qwen2MoeConfig
import torch
from ...... |
class Qwen2MoeDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Qwen2MoeConfig, 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, positi... | 4 | 1 | 47 | 7 | 27 | 14 | 4 | 0.49 | 1 | 9 | 4 | 0 | 2 | 5 | 2 | 12 | 96 | 15 | 55 | 24 | 40 | 27 | 30 | 12 | 27 | 5 | 1 | 1 | 7 |
4,777 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_moe/modeling_qwen2_moe.py | transformers.models.qwen2_moe.modeling_qwen2_moe.Qwen2MoeFlashAttention2 | from typing import Optional, Union
from ...modeling_flash_attention_utils import flash_attn_supports_top_left_mask, is_flash_attn_available
from ...cache_utils import Cache, DynamicCache, StaticCache
import torch
from ...utils.deprecation import deprecate_kwarg
import torch.nn.functional as F
class Qwen2MoeFlashAttent... |
class Qwen2MoeFlashAttention2(Qwen2MoeAttention):
'''
Qwen2Moe flash attention module, following Qwen2Moe attention module. This module inherits from `Qwen2MoeAttention`
as the weights of the module stays untouched. The only required change would be on the forward pass
where it needs to correctly call ... | 4 | 1 | 49 | 8 | 37 | 6 | 5 | 0.24 | 1 | 4 | 1 | 0 | 2 | 2 | 2 | 14 | 107 | 17 | 74 | 27 | 61 | 18 | 42 | 16 | 39 | 8 | 2 | 2 | 9 |
4,778 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_moe/modeling_qwen2_moe.py | transformers.models.qwen2_moe.modeling_qwen2_moe.Qwen2MoeForCausalLM | from typing import Optional, Union
from ...utils import auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging
import torch
import torch.nn.functional as F
from ...modeling_outputs import MoeCausalLMOutputWithPast, MoeModelOutputWithPast
from torch import nn
from ...generation import GenerationMixin
fr... |
class Qwen2MoeForCausalLM(Qwen2MoePreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past... | 5 | 1 | 17 | 2 | 11 | 4 | 3 | 0.31 | 2 | 7 | 2 | 0 | 8 | 6 | 8 | 9 | 146 | 23 | 95 | 41 | 67 | 29 | 47 | 24 | 38 | 13 | 2 | 2 | 20 |
4,779 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_moe/modeling_qwen2_moe.py | transformers.models.qwen2_moe.modeling_qwen2_moe.Qwen2MoeForQuestionAnswering | from ...modeling_layers import GenericForQuestionAnswering, GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class Qwen2MoeForQuestionAnswering(GenericForQuestionAnswering, Qwen2MoePreTrainedModel):
... |
class Qwen2MoeForQuestionAnswering(GenericForQuestionAnswering, Qwen2MoePreTrainedModel):
pass | 1 | 0 | 18 | 2 | 13 | 3 | 2 | 0.22 | 1 | 5 | 3 | 0 | 4 | 2 | 4 | 5 | 77 | 11 | 55 | 28 | 36 | 12 | 26 | 14 | 21 | 5 | 2 | 1 | 8 |
4,780 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_moe/modeling_qwen2_moe.py | transformers.models.qwen2_moe.modeling_qwen2_moe.Qwen2MoeForSequenceClassification | from ...modeling_layers import GenericForQuestionAnswering, GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class Qwen2MoeForSequenceClassification(GenericForSequenceClassification, Qwen2MoePreTrainedModel):
... |
class Qwen2MoeForSequenceClassification(GenericForSequenceClassification, Qwen2MoePreTrainedModel):
pass | 1 | 0 | 21 | 2 | 17 | 2 | 3 | 0.11 | 1 | 7 | 3 | 0 | 4 | 3 | 4 | 5 | 90 | 11 | 71 | 31 | 53 | 8 | 36 | 18 | 31 | 9 | 2 | 1 | 12 |
4,781 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_moe/modeling_qwen2_moe.py | transformers.models.qwen2_moe.modeling_qwen2_moe.Qwen2MoeForTokenClassification | from ...modeling_layers import GenericForQuestionAnswering, GenericForSequenceClassification, GenericForTokenClassification, GradientCheckpointingLayer
class Qwen2MoeForTokenClassification(GenericForTokenClassification, Qwen2MoePreTrainedModel):
... |
class Qwen2MoeForTokenClassification(GenericForTokenClassification, Qwen2MoePreTrainedModel):
pass | 1 | 0 | 17 | 1 | 14 | 2 | 3 | 0.11 | 1 | 5 | 2 | 0 | 4 | 4 | 4 | 5 | 79 | 8 | 64 | 28 | 41 | 7 | 29 | 15 | 24 | 5 | 2 | 1 | 10 |
4,782 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_moe/modeling_qwen2_moe.py | transformers.models.qwen2_moe.modeling_qwen2_moe.Qwen2MoeMLP | from ...activations import ACT2FN
from torch import nn
class Qwen2MoeMLP(nn.Module):
def __init__(self, config, intermediate_size=None):
super().__init__()
self.config = config
self.hidden_size = config.hidden_size
self.intermediate_size = intermediate_size
self.gate_proj =... |
class Qwen2MoeMLP(nn.Module):
def __init__(self, config, intermediate_size=None):
pass
def forward(self, x):
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 7 | 2 | 12 | 13 | 1 | 12 | 10 | 9 | 0 | 12 | 10 | 9 | 1 | 1 | 0 | 2 |
4,783 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_moe/modeling_qwen2_moe.py | transformers.models.qwen2_moe.modeling_qwen2_moe.Qwen2MoeModel | from .configuration_qwen2_moe import Qwen2MoeConfig
from typing import Optional, Union
import torch
from ...modeling_attn_mask_utils import AttentionMaskConverter
from torch import nn
from ...utils import auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging
import torch.nn.functional as F
from ...cac... | @auto_docstring
class Qwen2MoeModel(Qwen2MoePreTrainedModel):
def __init__(self, config: Qwen2MoeConfig):
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]=No... | 9 | 1 | 51 | 5 | 39 | 7 | 8 | 0.21 | 1 | 17 | 10 | 0 | 5 | 9 | 6 | 7 | 323 | 36 | 239 | 75 | 200 | 50 | 117 | 42 | 110 | 29 | 2 | 3 | 49 |
4,784 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_moe/modeling_qwen2_moe.py | transformers.models.qwen2_moe.modeling_qwen2_moe.Qwen2MoePreTrainedModel | from .configuration_qwen2_moe import Qwen2MoeConfig
from ...modeling_utils import PreTrainedModel
from ...utils import auto_docstring, can_return_tuple, is_torch_flex_attn_available, logging
from torch import nn
@auto_docstring
class Qwen2MoePreTrainedModel(PreTrainedModel):
config: Qwen2MoeConfig
base_model_p... | @auto_docstring
class Qwen2MoePreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 10 | 0 | 10 | 0 | 5 | 0 | 1 | 0 | 0 | 5 | 1 | 0 | 1 | 1 | 20 | 1 | 19 | 11 | 17 | 0 | 18 | 11 | 16 | 5 | 1 | 2 | 5 |
4,785 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_moe/modeling_qwen2_moe.py | transformers.models.qwen2_moe.modeling_qwen2_moe.Qwen2MoeRMSNorm | import torch
from torch import nn
import torch.nn.functional as F
class Qwen2MoeRMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
"""
Qwen2MoeRMSNorm is equivalent to T5LayerNorm
"""
super().__init__()
self.weight = nn.Parameter(torch.ones(hidden_size))
... |
class Qwen2MoeRMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
'''
Qwen2MoeRMSNorm 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,786 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_moe/modeling_qwen2_moe.py | transformers.models.qwen2_moe.modeling_qwen2_moe.Qwen2MoeRotaryEmbedding | from torch import nn
import torch.nn.functional as F
from .configuration_qwen2_moe import Qwen2MoeConfig
import torch
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
class Qwen2MoeRotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, config: Qwen2MoeConfig, device=N... |
class Qwen2MoeRotaryEmbedding(nn.Module):
def __init__(self, config: Qwen2MoeConfig, 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,787 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_moe/modeling_qwen2_moe.py | transformers.models.qwen2_moe.modeling_qwen2_moe.Qwen2MoeSdpaAttention | from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache, StaticCache
import torch
from typing import Optional, Union
import torch.nn.functional as F
class Qwen2MoeSdpaAttention(Qwen2MoeAttention):
"""
Qwen2Moe attention module using torch.nn.functional.scaled_dot_product... |
class Qwen2MoeSdpaAttention(Qwen2MoeAttention):
'''
Qwen2Moe attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
`Qwen2MoeAttention` as the weights of the module stays untouched. The only changes are on the forward pass to adapt to
SDPA API.
'''
@d... | 3 | 1 | 79 | 13 | 60 | 9 | 7 | 0.25 | 1 | 4 | 1 | 0 | 1 | 0 | 1 | 13 | 87 | 14 | 61 | 21 | 49 | 15 | 32 | 11 | 30 | 7 | 2 | 1 | 7 |
4,788 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_moe/modeling_qwen2_moe.py | transformers.models.qwen2_moe.modeling_qwen2_moe.Qwen2MoeSparseMoeBlock | import torch.nn.functional as F
from torch import nn
import torch
class Qwen2MoeSparseMoeBlock(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
... |
class Qwen2MoeSparseMoeBlock(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
''' '''
pass | 3 | 1 | 29 | 6 | 18 | 6 | 2 | 0.33 | 1 | 5 | 1 | 0 | 2 | 7 | 2 | 12 | 60 | 12 | 36 | 23 | 33 | 12 | 32 | 22 | 29 | 3 | 1 | 1 | 4 |
4,789 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/configuration_qwen2_vl.py | transformers.models.qwen2_vl.configuration_qwen2_vl.Qwen2VLConfig | from ...configuration_utils import PretrainedConfig, layer_type_validation
class Qwen2VLConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Qwen2VLModel`]. It is used to instantiate a
Qwen2-VL model according to the specified arguments, defining the model archite... |
class Qwen2VLConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Qwen2VLModel`]. It is used to instantiate a
Qwen2-VL model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a sim... | 2 | 1 | 63 | 5 | 52 | 6 | 6 | 1.6 | 1 | 2 | 0 | 0 | 1 | 18 | 1 | 1 | 183 | 14 | 65 | 46 | 41 | 104 | 34 | 24 | 32 | 6 | 1 | 2 | 6 |
4,790 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/configuration_qwen2_vl.py | transformers.models.qwen2_vl.configuration_qwen2_vl.Qwen2VLVisionConfig | from ...configuration_utils import PretrainedConfig, layer_type_validation
class Qwen2VLVisionConfig(PretrainedConfig):
model_type = 'qwen2_vl'
base_config_key = 'vision_config'
def __init__(self, depth=32, embed_dim=1280, hidden_size=3584, hidden_act='quick_gelu', mlp_ratio=4, num_heads=16, in_channels=3... |
class Qwen2VLVisionConfig(PretrainedConfig):
def __init__(self, depth=32, embed_dim=1280, hidden_size=3584, hidden_act='quick_gelu', mlp_ratio=4, num_heads=16, in_channels=3, patch_size=14, spatial_merge_size=2, temporal_patch_size=2, initializer_range=0.02, **kwargs):
pass | 2 | 0 | 26 | 1 | 25 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 10 | 1 | 1 | 30 | 2 | 28 | 27 | 13 | 0 | 15 | 14 | 13 | 1 | 1 | 0 | 1 |
4,791 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/image_processing_qwen2_vl.py | transformers.models.qwen2_vl.image_processing_qwen2_vl.Qwen2VLImageProcessor | from ...image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD, ChannelDimension, ImageInput, PILImageResampling, get_image_size, infer_channel_dimension_format, is_scaled_image, make_flat_list_of_images, to_numpy_array, valid_images, validate_preprocess_arguments
from ...image_processing_utils import BaseImageProcessor,... |
class Qwen2VLImageProcessor(BaseImageProcessor):
'''
Constructs a Qwen2-VL image processor that dynamically resizes images based on the original images.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions.
size (`dic... | 5 | 4 | 98 | 6 | 64 | 28 | 10 | 0.59 | 1 | 8 | 2 | 0 | 3 | 14 | 3 | 23 | 330 | 22 | 194 | 78 | 145 | 114 | 89 | 33 | 85 | 17 | 3 | 2 | 30 |
4,792 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/image_processing_qwen2_vl_fast.py | transformers.models.qwen2_vl.image_processing_qwen2_vl_fast.Qwen2VLImageProcessorFast | from ...processing_utils import Unpack
import torch
from ...video_utils import VideoInput, make_batched_videos
from .image_processing_qwen2_vl import smart_resize
from ...image_utils import OPENAI_CLIP_MEAN, OPENAI_CLIP_STD, ChannelDimension, ImageInput, PILImageResampling, SizeDict
from ...image_processing_utils_fast ... | @auto_docstring
class Qwen2VLImageProcessorFast(BaseImageProcessorFast):
def __init__(self, **kwargs: Unpack[Qwen2VLFastImageProcessorKwargs]):
pass
def _further_process_kwargs(self, size: Optional[SizeDict]=None, min_pixels: Optional[int]=None, max_pixels: Optional[int]=None, **kwargs) -> dict:
... | 9 | 3 | 90 | 5 | 57 | 29 | 9 | 0.46 | 1 | 11 | 4 | 0 | 3 | 0 | 3 | 37 | 289 | 17 | 186 | 71 | 150 | 86 | 86 | 39 | 82 | 20 | 4 | 2 | 26 |
4,793 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/modeling_qwen2_vl.py | transformers.models.qwen2_vl.modeling_qwen2_vl.PatchEmbed | import torch.nn.functional as F
import torch
import torch.nn as nn
class PatchEmbed(nn.Module):
def __init__(self, patch_size: int=14, temporal_patch_size: int=2, in_channels: int=3, embed_dim: int=1152) -> None:
super().__init__()
self.patch_size = patch_size
self.temporal_patch_size = te... |
class PatchEmbed(nn.Module):
def __init__(self, patch_size: int=14, temporal_patch_size: int=2, in_channels: int=3, embed_dim: int=1152) -> None:
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 11 | 1 | 11 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 2 | 5 | 2 | 12 | 24 | 2 | 22 | 16 | 13 | 0 | 14 | 10 | 11 | 1 | 1 | 0 | 2 |
4,794 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/modeling_qwen2_vl.py | transformers.models.qwen2_vl.modeling_qwen2_vl.PatchMerger | import torch.nn.functional as F
from torch.nn import LayerNorm
import torch
import torch.nn as nn
class PatchMerger(nn.Module):
def __init__(self, dim: int, context_dim: int, spatial_merge_size: int=2) -> None:
super().__init__()
self.hidden_size = context_dim * spatial_merge_size ** 2
sel... |
class PatchMerger(nn.Module):
def __init__(self, dim: int, context_dim: int, spatial_merge_size: int=2) -> None:
pass
def forward(self, x: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 12 | 14 | 1 | 13 | 6 | 10 | 0 | 9 | 6 | 6 | 1 | 1 | 0 | 2 |
4,795 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/modeling_qwen2_vl.py | transformers.models.qwen2_vl.modeling_qwen2_vl.Qwen2MLP | from ...activations import ACT2FN
import torch.nn as nn
class Qwen2MLP(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 Qwen2MLP(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,796 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/modeling_qwen2_vl.py | transformers.models.qwen2_vl.modeling_qwen2_vl.Qwen2VLAttention | from ...utils.deprecation import deprecate_kwarg
from ...modeling_flash_attention_utils import FlashAttentionKwargs
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from typing import Any, Callable, Optional, Union
import torch.nn.functional as F
import torch.nn as nn
from .configuration_qwen2_vl ... |
class Qwen2VLAttention(nn.Module):
'''
Multi-headed attention from 'Attention Is All You Need' paper. Modified to use sliding window attention: Longformer
and "Generating Long Sequences with Sparse Transformers".
'''
def __init__(self, config: Qwen2VLTextConfig, layer_idx: Optional[int]=None):
... | 4 | 1 | 48 | 9 | 38 | 4 | 5 | 0.14 | 1 | 8 | 3 | 2 | 2 | 15 | 2 | 12 | 103 | 19 | 76 | 37 | 63 | 11 | 54 | 27 | 51 | 6 | 1 | 1 | 9 |
4,797 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/modeling_qwen2_vl.py | transformers.models.qwen2_vl.modeling_qwen2_vl.Qwen2VLCausalLMOutputWithPast | from typing import Any, Callable, Optional, Union
import torch.nn.functional as F
from dataclasses import dataclass
import torch.nn as nn
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, is_torchdynamo_compiling, logging
from ...modeling_outputs import BaseModelOutputWithPast, ModelOutput
impo... | @dataclass
@auto_docstring(custom_intro='\n Base class for Qwen2VL causal language model (or autoregressive) outputs.\n ')
class Qwen2VLCausalLMOutputWithPast(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Language modeling loss (for n... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.43 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 36 | 5 | 7 | 7 | 6 | 24 | 7 | 7 | 6 | 0 | 1 | 0 | 0 |
4,798 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/modeling_qwen2_vl.py | transformers.models.qwen2_vl.modeling_qwen2_vl.Qwen2VLDecoderLayer | from ...modeling_layers import GradientCheckpointingLayer
from ...utils.deprecation import deprecate_kwarg
from ...modeling_flash_attention_utils import FlashAttentionKwargs
from typing import Any, Callable, Optional, Union
import torch.nn.functional as F
from ..qwen2.modeling_qwen2 import Qwen2RMSNorm
import torch.nn ... |
class Qwen2VLDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Qwen2VLTextConfig, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, posi... | 4 | 1 | 40 | 5 | 24 | 12 | 3 | 0.5 | 1 | 7 | 3 | 0 | 2 | 5 | 2 | 12 | 82 | 11 | 48 | 22 | 34 | 24 | 25 | 11 | 22 | 3 | 1 | 1 | 5 |
4,799 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/modeling_qwen2_vl.py | transformers.models.qwen2_vl.modeling_qwen2_vl.Qwen2VLForConditionalGeneration | from typing import Any, Callable, Optional, Union
import torch.nn.functional as F
from ...generation import GenerationMixin
import torch.nn as nn
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, is_torchdynamo_compiling, logging
import torch
from ...cache_utils import Cache, DynamicCache
from ... |
class Qwen2VLForConditionalGeneration(Qwen2VLPreTrainedModel, 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):
... | 21 | 2 | 42 | 4 | 30 | 9 | 5 | 0.31 | 2 | 11 | 4 | 0 | 10 | 6 | 10 | 11 | 435 | 45 | 303 | 107 | 252 | 93 | 166 | 67 | 155 | 17 | 2 | 4 | 45 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.