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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,300 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraEmbeddings | from typing import Callable, Optional, Union
import torch
from torch import nn
class ElectraEmbeddings(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
super().__init__()
self.word_embeddings = nn.Embedding(config.vocab_size,... |
class ElectraEmbeddings(nn.Module):
'''Construct the embeddings from word, position and token_type embeddings.'''
def __init__(self, config):
pass
def forward(self, input_ids: Optional[torch.LongTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids: Optional[torch.LongTensor... | 3 | 1 | 30 | 4 | 23 | 3 | 4 | 0.17 | 1 | 3 | 0 | 0 | 2 | 6 | 2 | 12 | 64 | 9 | 47 | 23 | 37 | 8 | 34 | 16 | 31 | 7 | 1 | 2 | 8 |
2,301 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraEncoder | import torch
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...utils import ModelOutput, Transf... |
class ElectraEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.FloatTensor]=None, encoder_attention_mask: Optional[tor... | 3 | 0 | 45 | 4 | 41 | 0 | 9 | 0 | 1 | 8 | 2 | 0 | 2 | 3 | 2 | 12 | 91 | 8 | 83 | 26 | 68 | 0 | 35 | 14 | 32 | 17 | 1 | 3 | 18 |
2,302 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraForCausalLM | from ...processing_utils import Unpack
import torch
from ...cache_utils import Cache, EncoderDecoderCache
from torch import nn
from ...generation import GenerationMixin
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, Maske... | @auto_docstring(custom_intro='\n ELECTRA Model with a `language modeling` head on top for CLM fine-tuning.\n ')
class ElectraForCausalLM(ElectraPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, n... | 8 | 1 | 25 | 3 | 15 | 7 | 2 | 0.44 | 2 | 7 | 3 | 0 | 5 | 3 | 5 | 6 | 137 | 22 | 80 | 35 | 55 | 35 | 33 | 17 | 27 | 6 | 2 | 1 | 12 |
2,303 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraForMaskedLM | from ...utils.generic import can_return_tuple, check_model_inputs
from typing import Callable, Optional, Union
from ...processing_utils import Unpack
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from torch import nn
from ...modeling_outputs import BaseModel... | @auto_docstring(custom_intro='\n Electra model with a language modeling head on top.\n\n Even though both the discriminator and generator may be loaded into this model, the generator is the only model of\n the two to have been trained for the masked language modeling task.\n ')
class ElectraForMaskedLM(Elec... | 8 | 1 | 17 | 2 | 13 | 2 | 2 | 0.15 | 1 | 6 | 3 | 0 | 4 | 3 | 4 | 5 | 81 | 11 | 62 | 28 | 36 | 9 | 26 | 15 | 21 | 5 | 2 | 1 | 8 |
2,304 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraForMultipleChoice | import torch
from ...processing_utils import Unpack
from torch import nn
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...utils.generic import can_return_tuple, check_model_inputs
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, BaseModelOutputWithPastAndCrossAttentions, Caus... | @auto_docstring
class ElectraForMultipleChoice(ElectraPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, position... | 6 | 1 | 37 | 5 | 29 | 4 | 6 | 0.11 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 82 | 10 | 65 | 28 | 44 | 7 | 28 | 15 | 25 | 11 | 2 | 1 | 12 |
2,305 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraForPreTraining | import torch
from torch import nn
from ...utils.generic import can_return_tuple, check_model_inputs
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from typing import Callable, Optional, Union
from ...processing_utils import Unpack
@auto_docstring(custom_intr... | @auto_docstring(custom_intro='\n Electra model with a binary classification head on top as used during pretraining for identifying generated tokens.\n\n It is recommended to load the discriminator checkpoint into that model.\n ')
class ElectraForPreTraining(ElectraPreTrainedModel):
def __init__(self, conf... | 6 | 1 | 46 | 8 | 26 | 13 | 4 | 0.46 | 1 | 6 | 3 | 0 | 2 | 2 | 2 | 3 | 95 | 16 | 54 | 27 | 37 | 25 | 24 | 14 | 21 | 6 | 2 | 2 | 7 |
2,306 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraForPreTrainingOutput | from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
import torch
from typing import Callable, Optional, Union
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro='\n Output type of [`ElectraForPreTraining`].\n ')
class ElectraForPreTra... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`ElectraForPreTraining`].\n ')
class ElectraForPreTrainingOutput(ModelOutput):
'''
loss (*optional*, returned when `labels` is provided, `torch.FloatTensor` of shape `(1,)`):
Total loss of the ELECTRA objective.
logits (`torch.FloatTe... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 26 | 4 | 5 | 5 | 4 | 17 | 5 | 5 | 4 | 0 | 1 | 0 | 0 |
2,307 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraForQuestionAnswering | from ...utils.generic import can_return_tuple, check_model_inputs
from typing import Callable, Optional, Union
from .configuration_electra import ElectraConfig
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from torch.nn import BCEWithLogitsLoss, CrossEntropy... | @auto_docstring
class ElectraForQuestionAnswering(ElectraPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, posit... | 6 | 0 | 42 | 5 | 31 | 7 | 4 | 0.17 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 99 | 11 | 75 | 32 | 49 | 13 | 34 | 18 | 31 | 7 | 2 | 2 | 8 |
2,308 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraForSequenceClassification | from ...processing_utils import Unpack
import torch
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
f... | @auto_docstring(custom_intro='\n ELECTRA Model transformer with a sequence classification/regression head on top (a linear layer on top of the\n pooled output) e.g. for GLUE tasks.\n ')
class ElectraForSequenceClassification(ElectraPreTrainedModel):
def __init__(self, config):
pass
@can_return... | 6 | 1 | 39 | 4 | 32 | 4 | 7 | 0.1 | 1 | 7 | 3 | 0 | 2 | 4 | 2 | 3 | 88 | 8 | 73 | 26 | 50 | 7 | 33 | 13 | 30 | 12 | 2 | 3 | 13 |
2,309 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraForTokenClassification | from ...utils.generic import can_return_tuple, check_model_inputs
from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringMod... | @auto_docstring(custom_intro='\n Electra model with a token classification head on top.\n\n Both the discriminator and generator may be loaded into this model.\n ')
class ElectraForTokenClassification(ElectraPreTrainedModel):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstri... | 6 | 1 | 31 | 3 | 26 | 3 | 4 | 0.08 | 1 | 5 | 2 | 0 | 2 | 4 | 2 | 3 | 72 | 7 | 60 | 27 | 37 | 5 | 23 | 14 | 20 | 5 | 2 | 1 | 7 |
2,310 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraGeneratorPredictions | from torch import nn
from ...activations import ACT2FN, get_activation
class ElectraGeneratorPredictions(nn.Module):
"""Prediction module for the generator, made up of two dense layers."""
def __init__(self, config):
super().__init__()
self.activation = get_activation('gelu')
self.Laye... |
class ElectraGeneratorPredictions(nn.Module):
'''Prediction module for the generator, made up of two dense layers.'''
def __init__(self, config):
pass
def forward(self, generator_hidden_states):
pass | 3 | 1 | 6 | 1 | 5 | 0 | 1 | 0.09 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 16 | 4 | 11 | 7 | 8 | 1 | 11 | 7 | 8 | 1 | 1 | 0 | 2 |
2,311 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraIntermediate | import torch
from torch import nn
from ...activations import ACT2FN, get_activation
class ElectraIntermediate(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isinstance(config.hidden_act, str):
s... |
class ElectraIntermediate(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 12 | 5 | 9 | 0 | 11 | 5 | 8 | 2 | 1 | 1 | 3 |
2,312 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraLayer | from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from typing import Callable, Optional, Union
from ...modeling_layers import GradientCheckpointingLayer
from ...processing_utils import Unpack
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable... |
class ElectraLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_idx=None):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[torch.FloatTensor]=None, encod... | 4 | 0 | 27 | 2 | 23 | 2 | 4 | 0.1 | 1 | 7 | 3 | 0 | 3 | 8 | 3 | 13 | 84 | 9 | 70 | 32 | 57 | 7 | 41 | 23 | 37 | 7 | 1 | 2 | 11 |
2,313 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraModel | import torch
from ...cache_utils import Cache, EncoderDecoderCache
from ...utils.generic import can_return_tuple, check_model_inputs
from ...modeling_outputs import BaseModelOutputWithCrossAttentions, BaseModelOutputWithPastAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput... | @auto_docstring
class ElectraModel(ElectraPreTrainedModel):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
def _prune_heads(self, heads_to_prune):
'''
Prunes heads of the model. heads_to_prune:... | 12 | 1 | 22 | 3 | 18 | 2 | 4 | 0.08 | 1 | 7 | 3 | 0 | 5 | 4 | 5 | 6 | 121 | 17 | 96 | 38 | 69 | 8 | 51 | 22 | 45 | 15 | 2 | 2 | 21 |
2,314 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraOutput | from torch import nn
import torch
class ElectraOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.intermediate_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropo... |
class ElectraOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
2,315 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraPreTrainedModel | from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_electra import ElectraConfig
from torch import nn
@auto_docstring
class ElectraPreTrainedModel(PreTrainedModel):
con... | @auto_docstring
class ElectraPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.47 | 1 | 0 | 0 | 8 | 1 | 0 | 1 | 1 | 27 | 2 | 17 | 6 | 15 | 8 | 15 | 6 | 13 | 6 | 1 | 2 | 6 |
2,316 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraSelfAttention | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
import torch
from ...cache_utils import Cache, EncoderDecoderCache
from torch import nn
from ...utils import ModelOutput, TransformersKwargs, auto_docstring, is_torch_flex_attn_available, logging
from typing import Callable, Optional, Union
from ...... |
class ElectraSelfAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, is_causal=False, layer_idx=None):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, past_key_value: Optional... | 3 | 0 | 43 | 7 | 31 | 6 | 6 | 0.19 | 1 | 5 | 0 | 0 | 3 | 11 | 3 | 13 | 132 | 22 | 93 | 44 | 80 | 18 | 72 | 35 | 68 | 13 | 1 | 2 | 17 |
2,317 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/modeling_electra.py | transformers.models.electra.modeling_electra.ElectraSelfOutput | from torch import nn
import torch
class ElectraSelfOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
self.dropout = nn.Dropout... |
class ElectraSelfOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, input_tensor: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 5 | 0 | 5 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 12 | 1 | 11 | 6 | 8 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
2,318 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/tokenization_electra.py | transformers.models.electra.tokenization_electra.ElectraTokenizer | from ...tokenization_utils import PreTrainedTokenizer, _is_control, _is_punctuation, _is_whitespace
import os
import collections
from typing import Optional
class ElectraTokenizer(PreTrainedTokenizer):
"""
Construct a Electra tokenizer. Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokenize... |
class ElectraTokenizer(PreTrainedTokenizer):
'''
Construct a Electra tokenizer. Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.
Args:
vocab_f... | 14 | 6 | 15 | 1 | 10 | 4 | 2 | 0.72 | 1 | 9 | 2 | 0 | 12 | 5 | 12 | 101 | 236 | 29 | 121 | 53 | 85 | 87 | 65 | 29 | 52 | 6 | 3 | 3 | 27 |
2,319 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/electra/tokenization_electra_fast.py | transformers.models.electra.tokenization_electra_fast.ElectraTokenizerFast | from tokenizers import normalizers
from ...tokenization_utils_fast import PreTrainedTokenizerFast
import json
from typing import Optional
from .tokenization_electra import ElectraTokenizer
class ElectraTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" ELECTRA tokenizer (backed by HuggingFace's *to... |
class ElectraTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" ELECTRA tokenizer (backed by HuggingFace's *tokenizers* library). Based on WordPiece.
This tokenizer inherits from [`PreTrainedTokenizerFast`] which contains most of the main methods. Users should
refer to this superclass for m... | 4 | 2 | 24 | 3 | 14 | 7 | 2 | 1.12 | 1 | 4 | 0 | 0 | 4 | 1 | 4 | 92 | 141 | 18 | 58 | 29 | 38 | 65 | 27 | 14 | 22 | 2 | 3 | 1 | 7 |
2,320 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/configuration_emu3.py | transformers.models.emu3.configuration_emu3.Emu3Config | from typing import Any, Optional, Union
from ...configuration_utils import PretrainedConfig
class Emu3Config(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Emu3Model`]. It is used to instantiate a
emu3 model according to the specified arguments, defining the model ... |
class Emu3Config(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Emu3Model`]. It is used to instantiate a
emu3 model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a similar confi... | 2 | 1 | 22 | 3 | 19 | 0 | 5 | 0.65 | 1 | 5 | 2 | 0 | 1 | 3 | 1 | 1 | 46 | 8 | 23 | 14 | 15 | 15 | 15 | 8 | 13 | 5 | 1 | 1 | 5 |
2,321 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/configuration_emu3.py | transformers.models.emu3.configuration_emu3.Emu3TextConfig | from typing import Any, Optional, Union
from ...configuration_utils import PretrainedConfig
from ...modeling_rope_utils import rope_config_validation
class Emu3TextConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Emu3TextModel`]. It is used to instantiate a
em... |
class Emu3TextConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Emu3TextModel`]. It is used to instantiate a
emu3 model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults will yield a simil... | 2 | 1 | 50 | 2 | 48 | 0 | 1 | 1.92 | 1 | 5 | 0 | 0 | 1 | 16 | 1 | 1 | 164 | 12 | 52 | 44 | 27 | 100 | 23 | 21 | 21 | 1 | 1 | 0 | 1 |
2,322 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/configuration_emu3.py | transformers.models.emu3.configuration_emu3.Emu3VQVAEConfig | from ...configuration_utils import PretrainedConfig
class Emu3VQVAEConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`Emu3VQVAE`]. It is used to instantiate an VQ-VAE
model according to the specified arguments, defining the model architecture. Instantiating a co... |
class Emu3VQVAEConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`Emu3VQVAE`]. It is used to instantiate an VQ-VAE
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a confi... | 2 | 1 | 34 | 1 | 33 | 0 | 1 | 1.22 | 1 | 4 | 0 | 0 | 1 | 14 | 1 | 1 | 88 | 8 | 36 | 35 | 17 | 44 | 19 | 18 | 17 | 1 | 1 | 0 | 1 |
2,323 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/image_processing_emu3.py | transformers.models.emu3.image_processing_emu3.Emu3ImageProcessor | 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, make_nested_list_of_images, to_numpy_array, valid_images, validate_preprocess_arguments
from typing import Optional, ... |
class Emu3ImageProcessor(BaseImageProcessor):
'''
Constructs a Emu3 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.
resample (`PILIma... | 7 | 6 | 68 | 5 | 38 | 25 | 8 | 0.77 | 1 | 10 | 2 | 0 | 6 | 12 | 6 | 26 | 447 | 37 | 231 | 99 | 158 | 179 | 109 | 33 | 102 | 15 | 3 | 2 | 46 |
2,324 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3Attention | import torch.nn.functional as F
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...utils.deprecation import deprecate_kwarg
from .configuration_emu3 import Emu3Config, Emu3TextConfig, Emu3VQVAEConfig
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
import torch.nn as... |
class Emu3Attention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: Emu3Config, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, positio... | 4 | 1 | 35 | 4 | 31 | 1 | 3 | 0.03 | 1 | 6 | 3 | 0 | 2 | 11 | 2 | 12 | 74 | 9 | 63 | 31 | 52 | 2 | 34 | 23 | 31 | 5 | 1 | 2 | 6 |
2,325 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3DecoderLayer | import torch.nn.functional as F
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
import torch.nn as nn
from ...processing_utils import Unpack
import torch
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache
from .configuration_emu3 import Emu3Config, ... |
class Emu3DecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Emu3Config, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, position_ids: ... | 4 | 0 | 36 | 4 | 21 | 11 | 2 | 0.49 | 1 | 9 | 5 | 0 | 2 | 6 | 2 | 12 | 73 | 9 | 43 | 23 | 29 | 21 | 22 | 12 | 19 | 2 | 1 | 1 | 3 |
2,326 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3ForCausalLM | import torch.nn.functional as F
import torch.nn as nn
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
from ...generation import GenerationMixin
import torch
from ...processing_utils import Unpack
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from ...cache_util... | @auto_docstring
class Emu3ForCausalLM(Emu3PreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
@can_return_tuple
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=Non... | 6 | 1 | 14 | 2 | 9 | 4 | 2 | 0.37 | 2 | 9 | 4 | 0 | 8 | 3 | 8 | 9 | 124 | 21 | 75 | 37 | 48 | 28 | 37 | 21 | 28 | 8 | 2 | 1 | 15 |
2,327 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3ForConditionalGeneration | import torch.nn.functional as F
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
import torch.nn as nn
from ...generation import GenerationMixin
import torch
from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
from ...cache_utils import Cache, DynamicCache
from typin... |
class Emu3ForConditionalGeneration(Emu3PreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
def get_output_embeddings(self) -> nn.Module:
pass
def set_decoder(self, d... | 18 | 1 | 25 | 3 | 12 | 11 | 2 | 0.88 | 2 | 10 | 5 | 0 | 6 | 3 | 6 | 7 | 163 | 23 | 75 | 38 | 49 | 66 | 38 | 20 | 31 | 7 | 2 | 1 | 12 |
2,328 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3ImageVocabularyMapping | import torch
from functools import cached_property
import torch.nn as nn
import torch.nn.functional as F
class Emu3ImageVocabularyMapping:
"""
A class for mapping discrete image tokens from VQGAN to BPE tokens.
"""
def __init__(self, vocab_map):
self.vocab_map = vocab_map
self.eol_toke... |
class Emu3ImageVocabularyMapping:
'''
A class for mapping discrete image tokens from VQGAN to BPE tokens.
'''
def __init__(self, vocab_map):
pass
@cached_property
def image_tokens(self):
pass
@cached_property
def image_tokens_str(self):
pass
@cached_prop... | 16 | 1 | 4 | 0 | 4 | 0 | 1 | 0.1 | 0 | 2 | 0 | 0 | 9 | 3 | 9 | 9 | 52 | 9 | 40 | 30 | 24 | 4 | 34 | 22 | 24 | 2 | 0 | 1 | 11 |
2,329 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3MLP | import torch.nn as nn
from ...activations import ACT2FN
class Emu3MLP(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 Emu3MLP(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 |
2,330 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3PreTrainedModel | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
from .configuration_emu3 import Emu3Config, Emu3TextConfig, Emu3VQVAEConfig
@auto_docstring
class Emu3PreTrainedModel(PreTrainedModel):
config: Emu3Config
base_model_... | @auto_docstring
class Emu3PreTrainedModel(PreTrainedModel):
pass | 2 | 0 | 12 | 0 | 12 | 0 | 6 | 0 | 1 | 1 | 1 | 3 | 1 | 0 | 1 | 1 | 28 | 1 | 27 | 15 | 25 | 0 | 23 | 15 | 21 | 6 | 1 | 2 | 6 |
2,331 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3RMSNorm | from ...integrations import use_kernel_forward_from_hub
import torch.nn as nn
import torch.nn.functional as F
import torch
@use_kernel_forward_from_hub('RMSNorm')
class Emu3RMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
"""
Emu3RMSNorm is equivalent to T5LayerNorm
"""
... | @use_kernel_forward_from_hub('RMSNorm')
class Emu3RMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
'''
Emu3RMSNorm is equivalent to T5LayerNorm
'''
pass
def forward(self, hidden_states):
pass
def extra_repr(self):
pass | 5 | 1 | 5 | 0 | 4 | 1 | 1 | 0.23 | 1 | 2 | 0 | 0 | 3 | 2 | 3 | 13 | 18 | 2 | 13 | 8 | 9 | 3 | 13 | 8 | 9 | 1 | 1 | 0 | 3 |
2,332 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3RotaryEmbedding | import torch.nn as nn
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
import torch
from .configuration_emu3 import Emu3Config, Emu3TextConfig, Emu3VQVAEConfig
import torch.nn.functional as F
class Emu3RotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, config: Emu... |
class Emu3RotaryEmbedding(nn.Module):
def __init__(self, config: Emu3Config, 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 |
2,333 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3TextModel | from ...cache_utils import Cache, DynamicCache
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
from typing import Callable, Optional, Union
from ...processing_utils import Unpack
from .configuration_emu3 import Emu3Config, Emu3TextConfig, Emu3VQVAEConfig
from ...masking_utils import create_cau... | @auto_docstring
class Emu3TextModel(Emu3PreTrainedModel):
def __init__(self, config: Emu3Config):
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, pa... | 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 |
2,334 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3VQVAE | from .configuration_emu3 import Emu3Config, Emu3TextConfig, Emu3VQVAEConfig
import torch.nn.functional as F
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
import math
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
import torch.nn as nn
import torch
@auto_docstring(cus... | @auto_docstring(custom_intro='\n The VQ-VAE model used in Emu3 for encoding/decoding images into discrete tokens.\n This model follows the "Make-a-scene: Scene-based text-to-image generation with human priors" paper from\n [ Oran Gafni, Adam Polyak, Oron Ashual, Shelly Sheynin, Devi Parikh, and Yaniv\n Taig... | 6 | 0 | 21 | 4 | 17 | 1 | 3 | 0.04 | 1 | 9 | 5 | 0 | 4 | 8 | 4 | 4 | 97 | 18 | 77 | 31 | 72 | 3 | 56 | 31 | 51 | 6 | 1 | 2 | 13 |
2,335 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3VQVAEAttentionBlock | import torch.nn.functional as F
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_emu3 import Emu3Config, Emu3TextConfig, Emu3VQVAEConfig
import torch.nn as nn
import torch
from typing import Callable, Optional, Union
class Emu3VQVAEAttentionBlock(nn.Module):
"""Multi-heade... |
class Emu3VQVAEAttentionBlock(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: Emu3VQVAEConfig):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, **kwargs) -> tuple[torch.Tensor, Optional[tor... | 3 | 2 | 35 | 6 | 28 | 1 | 4 | 0.05 | 1 | 4 | 0 | 0 | 2 | 10 | 2 | 12 | 73 | 14 | 56 | 25 | 48 | 3 | 40 | 20 | 37 | 5 | 1 | 2 | 7 |
2,336 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3VQVAEConv3d | import torch.nn as nn
import torch.nn.functional as F
import torch
class Emu3VQVAEConv3d(nn.Module):
def __init__(self, in_channel: int, out_channel: int, kernel_size: tuple[int], stride: tuple[int]):
super().__init__()
padding_sizes = [one_kernel - one_stride for one_kernel, one_stride in zip(ker... |
class Emu3VQVAEConv3d(nn.Module):
def __init__(self, in_channel: int, out_channel: int, kernel_size: tuple[int], stride: tuple[int]):
pass
def forward(self, hidden_states: torch.Tensor):
pass | 3 | 0 | 13 | 1 | 12 | 0 | 2 | 0 | 1 | 4 | 0 | 0 | 2 | 2 | 2 | 12 | 27 | 3 | 24 | 13 | 15 | 0 | 13 | 7 | 10 | 2 | 1 | 1 | 3 |
2,337 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3VQVAEDecoder | import torch
from .configuration_emu3 import Emu3Config, Emu3TextConfig, Emu3VQVAEConfig
import torch.nn.functional as F
import math
import torch.nn as nn
class Emu3VQVAEDecoder(nn.Module):
def __init__(self, config: Emu3VQVAEConfig):
super().__init__()
quant_channels = config.embed_dim
bl... |
class Emu3VQVAEDecoder(nn.Module):
def __init__(self, config: Emu3VQVAEConfig):
pass
def forward(self, hidden_states: torch.Tensor, quant_states: torch.Tensor):
pass | 3 | 0 | 33 | 6 | 26 | 1 | 3 | 0.04 | 1 | 10 | 6 | 0 | 2 | 7 | 2 | 12 | 68 | 13 | 53 | 19 | 50 | 2 | 39 | 19 | 36 | 3 | 1 | 1 | 6 |
2,338 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3VQVAEDownBlock | import torch.nn as nn
import torch.nn.functional as F
import torch
class Emu3VQVAEDownBlock(nn.Module):
def __init__(self, config):
super().__init__()
self.num_resolutions = len(config.channel_multiplier)
self.num_res_blocks = config.num_res_blocks
base_channels = config.base_chann... |
class Emu3VQVAEDownBlock(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.FloatTensor):
pass | 3 | 0 | 28 | 4 | 24 | 0 | 5 | 0 | 1 | 7 | 3 | 0 | 2 | 4 | 2 | 12 | 57 | 8 | 49 | 22 | 46 | 0 | 44 | 22 | 41 | 5 | 1 | 3 | 10 |
2,339 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3VQVAEEncoder | import math
import torch.nn as nn
import torch
import torch.nn.functional as F
class Emu3VQVAEEncoder(nn.Module):
def __init__(self, config):
super().__init__()
base_channels = config.base_channels
in_channels = config.in_channels
double_latent = config.double_latent
latent... |
class Emu3VQVAEEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, pixel_values: torch.LongTensor):
pass | 3 | 0 | 33 | 7 | 25 | 2 | 4 | 0.06 | 1 | 7 | 4 | 0 | 2 | 7 | 2 | 12 | 68 | 14 | 51 | 26 | 48 | 3 | 42 | 26 | 39 | 4 | 1 | 1 | 7 |
2,340 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3VQVAEEncoderConvDownsample | import torch.nn as nn
import torch.nn.functional as F
class Emu3VQVAEEncoderConvDownsample(nn.Module):
def __init__(self, in_channels):
super().__init__()
self.conv = nn.Conv2d(in_channels, in_channels, kernel_size=3, stride=2, padding=0)
def forward(self, hidden_states):
hidden_state... |
class Emu3VQVAEEncoderConvDownsample(nn.Module):
def __init__(self, in_channels):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 4 | 0 | 4 | 1 | 1 | 0.13 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 10 | 1 | 8 | 4 | 5 | 1 | 8 | 4 | 5 | 1 | 1 | 0 | 2 |
2,341 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3VQVAEEncoderConvUpsample | import torch.nn as nn
import torch.nn.functional as F
class Emu3VQVAEEncoderConvUpsample(nn.Module):
def __init__(self, in_channels):
super().__init__()
self.conv = nn.Conv2d(in_channels, in_channels, kernel_size=3, stride=1, padding=1)
def forward(self, hidden_states):
hidden_states ... |
class Emu3VQVAEEncoderConvUpsample(nn.Module):
def __init__(self, in_channels):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 9 | 1 | 8 | 4 | 5 | 0 | 8 | 4 | 5 | 1 | 1 | 0 | 2 |
2,342 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3VQVAEGroupNorm | import torch.nn as nn
import torch.nn.functional as F
class Emu3VQVAEGroupNorm(nn.GroupNorm):
"""
Same as the torch GroupNorm with the only difference that this ones accepts
an optional kwarg `quant_states` which is not used. This class makes it easier to
use SpatialNorm or GroupNorm without conditiona... |
class Emu3VQVAEGroupNorm(nn.GroupNorm):
'''
Same as the torch GroupNorm with the only difference that this ones accepts
an optional kwarg `quant_states` which is not used. This class makes it easier to
use SpatialNorm or GroupNorm without conditionals
'''
def __init__(self, **kwargs):
... | 3 | 1 | 2 | 0 | 2 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 2 | 0 | 2 | 2 | 12 | 2 | 5 | 3 | 2 | 5 | 5 | 3 | 2 | 1 | 1 | 0 | 2 |
2,343 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3VQVAEMiddleBlock | import torch.nn as nn
import torch.nn.functional as F
from typing import Callable, Optional, Union
import torch
class Emu3VQVAEMiddleBlock(nn.Module):
def __init__(self, config, in_channels, quant_channels=None):
super().__init__()
self.block_1 = Emu3VQVAEResnetBlock(in_channels=in_channels, out_c... |
class Emu3VQVAEMiddleBlock(nn.Module):
def __init__(self, config, in_channels, quant_channels=None):
pass
def forward(self, hidden_states: torch.FloatTensor, quant_states: Optional[torch.FloatTensor]=None):
pass | 3 | 0 | 15 | 1 | 14 | 0 | 2 | 0 | 1 | 5 | 4 | 0 | 2 | 4 | 2 | 12 | 32 | 3 | 29 | 9 | 26 | 0 | 20 | 9 | 17 | 2 | 1 | 1 | 3 |
2,344 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3VQVAEResnetBlock | import torch
import torch.nn as nn
from typing import Callable, Optional, Union
import torch.nn.functional as F
class Emu3VQVAEResnetBlock(nn.Module):
def __init__(self, in_channels: int, out_channels: Optional[int]=None, quant_channels: Optional[int]=None):
super().__init__()
self.in_channels = i... |
class Emu3VQVAEResnetBlock(nn.Module):
def __init__(self, in_channels: int, out_channels: Optional[int]=None, quant_channels: Optional[int]=None):
pass
def forward(self, hidden_states: torch.Tensor, quant_channels: Optional[torch.Tensor]=None):
pass | 3 | 0 | 30 | 4 | 26 | 0 | 4 | 0 | 1 | 4 | 1 | 0 | 2 | 8 | 2 | 12 | 61 | 9 | 52 | 18 | 44 | 0 | 28 | 13 | 25 | 4 | 1 | 1 | 7 |
2,345 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3VQVAESpatialNorm | import torch
import torch.nn as nn
import torch.nn.functional as F
class Emu3VQVAESpatialNorm(nn.Module):
def __init__(self, in_channels: int, out_channels: int):
super().__init__()
self.norm_layer = nn.GroupNorm(num_channels=out_channels, num_groups=32, eps=1e-06, affine=True)
self.conv_y... |
class Emu3VQVAESpatialNorm(nn.Module):
def __init__(self, in_channels: int, out_channels: int):
pass
def forward(self, hidden_states: torch.Tensor, quant_states: torch.Tensor):
pass | 3 | 0 | 16 | 1 | 16 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 12 | 34 | 2 | 32 | 10 | 25 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
2,346 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3VQVAETemporalDownsample | import torch
import torch.nn as nn
import torch.nn.functional as F
class Emu3VQVAETemporalDownsample(nn.Module):
def __init__(self, in_channel: int, out_channel: int):
super().__init__()
self.conv = Emu3VQVAEConv3d(in_channel, out_channel, kernel_size=(4, 3, 3), stride=(2, 1, 1))
def forward(... |
class Emu3VQVAETemporalDownsample(nn.Module):
def __init__(self, in_channel: int, out_channel: int):
pass
def forward(self, hidden_states: torch.Tensor):
pass | 3 | 0 | 8 | 0 | 8 | 0 | 1 | 0 | 1 | 4 | 1 | 0 | 2 | 1 | 2 | 12 | 17 | 1 | 16 | 8 | 9 | 0 | 7 | 4 | 4 | 1 | 1 | 0 | 2 |
2,347 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3VQVAETemporalResnetBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
class Emu3VQVAETemporalResnetBlock(nn.Module):
def __init__(self, in_channels, out_channels=None):
super().__init__()
self.in_channels = in_channels
self.out_channels = in_channels if out_channels is None else out_channels
... |
class Emu3VQVAETemporalResnetBlock(nn.Module):
def __init__(self, in_channels, out_channels=None):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 23 | 2 | 21 | 0 | 3 | 0 | 1 | 2 | 1 | 0 | 2 | 7 | 2 | 12 | 47 | 5 | 42 | 15 | 35 | 0 | 22 | 11 | 19 | 3 | 1 | 1 | 5 |
2,348 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3VQVAETemporalUpsample | import torch.nn as nn
import torch.nn.functional as F
import torch
class Emu3VQVAETemporalUpsample(nn.Module):
def __init__(self, in_channel: int, out_channel: int):
super().__init__()
self.conv = Emu3VQVAEConv3d(in_channel, out_channel, kernel_size=(3, 3, 3), stride=(1, 1, 1))
def forward(se... |
class Emu3VQVAETemporalUpsample(nn.Module):
def __init__(self, in_channel: int, out_channel: int):
pass
def forward(self, hidden_states: torch.Tensor):
pass | 3 | 0 | 10 | 0 | 10 | 0 | 1 | 0 | 1 | 4 | 1 | 0 | 2 | 1 | 2 | 12 | 21 | 1 | 20 | 9 | 13 | 0 | 11 | 5 | 8 | 1 | 1 | 0 | 2 |
2,349 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3VQVAEUpBlock | import torch
import torch.nn as nn
import torch.nn.functional as F
class Emu3VQVAEUpBlock(nn.Module):
def __init__(self, config):
super().__init__()
self.num_resolutions = len(config.channel_multiplier)
self.num_res_blocks = config.num_res_blocks
quant_channels = config.embed_dim
... |
class Emu3VQVAEUpBlock(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.FloatTensor, quant_states: torch.FloatTensor):
pass | 3 | 0 | 27 | 4 | 23 | 0 | 5 | 0 | 1 | 8 | 4 | 0 | 2 | 3 | 2 | 12 | 56 | 9 | 47 | 19 | 44 | 0 | 41 | 19 | 38 | 5 | 1 | 3 | 10 |
2,350 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modeling_emu3.py | transformers.models.emu3.modeling_emu3.Emu3VQVAEVectorQuantizer | import torch.nn as nn
import torch.nn.functional as F
from .configuration_emu3 import Emu3Config, Emu3TextConfig, Emu3VQVAEConfig
import torch
class Emu3VQVAEVectorQuantizer(nn.Module):
"""
A module for vector quantization using learned embedding vectors.
This module implements the quantization process si... |
class Emu3VQVAEVectorQuantizer(nn.Module):
'''
A module for vector quantization using learned embedding vectors.
This module implements the quantization process similar to te one described in
the VQ-VAE (Vector Quantized Variational AutoEncoder) paper. It quantizes continuous
input vectors into dis... | 3 | 1 | 10 | 2 | 8 | 1 | 1 | 0.63 | 1 | 3 | 1 | 0 | 2 | 1 | 2 | 12 | 32 | 6 | 16 | 10 | 13 | 10 | 16 | 10 | 13 | 1 | 1 | 0 | 2 |
2,351 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3DecoderLayer | from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaModel, TransformersKwargs
import torch
from .configuration_emu3 import Emu3Config, Emu3TextConfig, Emu3VQVAEConfig
from ...processing_utils import Unpack
import torch.nn.functional as F
from ...cache_utils import Cache
from typ... |
class Emu3DecoderLayer(LlamaDecoderLayer):
def __init__(self, config: Emu3Config, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[... | 4 | 0 | 32 | 3 | 19 | 11 | 2 | 0.55 | 1 | 6 | 2 | 0 | 2 | 1 | 2 | 14 | 66 | 7 | 38 | 18 | 24 | 21 | 17 | 7 | 14 | 2 | 2 | 1 | 3 |
2,352 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3ForCausalLM | from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaModel, TransformersKwargs
from ...generation import GenerationMixin
from .configuration_emu3 import Emu3Config, Emu3TextConfig, Emu3VQVAEConfig
class Emu3ForCausalLM(LlamaForCausalLM, Emu3PreTrainedModel, GenerationMixin):
... |
class Emu3ForCausalLM(LlamaForCausalLM, Emu3PreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def forward(**super_kwargs):
'''
Example:
```python
>>> from transformers import Emu3Processor, Emu3ForConditionalGeneration
>>> import torch
... | 3 | 1 | 19 | 4 | 3 | 13 | 1 | 2.5 | 3 | 2 | 1 | 0 | 2 | 1 | 2 | 146 | 44 | 9 | 10 | 6 | 4 | 25 | 7 | 5 | 4 | 1 | 4 | 0 | 2 |
2,353 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3ForConditionalGeneration | import torch.nn.functional as F
from ...processing_utils import Unpack
from typing import Optional, Union
from ...utils import auto_docstring, can_return_tuple, logging
from ...cache_utils import Cache
from ...generation import GenerationMixin
from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaF... |
class Emu3ForConditionalGeneration(Emu3PreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
def get_output_embeddings(self) -> nn.Module:
pass
def set_decoder(self, d... | 18 | 1 | 25 | 3 | 12 | 11 | 2 | 0.88 | 2 | 9 | 4 | 0 | 6 | 3 | 6 | 141 | 163 | 23 | 75 | 38 | 49 | 66 | 38 | 20 | 31 | 7 | 4 | 1 | 12 |
2,354 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3ImageVocabularyMapping | import torch.nn.functional as F
from functools import cached_property
import torch
import torch.nn as nn
class Emu3ImageVocabularyMapping:
"""
A class for mapping discrete image tokens from VQGAN to BPE tokens.
"""
def __init__(self, vocab_map):
self.vocab_map = vocab_map
self.eol_toke... |
class Emu3ImageVocabularyMapping:
'''
A class for mapping discrete image tokens from VQGAN to BPE tokens.
'''
def __init__(self, vocab_map):
pass
@cached_property
def image_tokens(self):
pass
@cached_property
def image_tokens_str(self):
pass
@cached_prop... | 16 | 1 | 4 | 0 | 4 | 0 | 1 | 0.1 | 0 | 2 | 0 | 0 | 9 | 3 | 9 | 9 | 52 | 9 | 40 | 30 | 24 | 4 | 34 | 22 | 24 | 2 | 0 | 1 | 11 |
2,355 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3PreTrainedModel | from ..chameleon.modeling_chameleon import ChameleonPreTrainedModel, ChameleonVQVAEEncoderConvDownsample
class Emu3PreTrainedModel(ChameleonPreTrainedModel, Emu3VQVAE):
_no_split_modules = ['Emu3DecoderLayer']
_supports_flex_attn = True
_supports_attention_backend = True |
class Emu3PreTrainedModel(ChameleonPreTrainedModel, Emu3VQVAE):
pass | 1 | 0 | 12 | 0 | 12 | 0 | 6 | 0 | 2 | 0 | 0 | 3 | 1 | 0 | 1 | 135 | 18 | 1 | 17 | 5 | 15 | 0 | 13 | 5 | 11 | 6 | 3 | 2 | 6 |
2,356 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3TextModel | from .configuration_emu3 import Emu3Config, Emu3TextConfig, Emu3VQVAEConfig
from ..llama.modeling_llama import LlamaAttention, LlamaDecoderLayer, LlamaForCausalLM, LlamaModel, TransformersKwargs
import torch.nn as nn
class Emu3TextModel(LlamaModel, Emu3PreTrainedModel):
_can_record_outputs = {'hidden_states': Emu3... |
class Emu3TextModel(LlamaModel, Emu3PreTrainedModel):
def __init__(self, config: Emu3Config):
pass | 2 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 2 | 4 | 2 | 0 | 2 | 1 | 2 | 144 | 10 | 1 | 9 | 5 | 5 | 0 | 6 | 4 | 3 | 1 | 4 | 0 | 2 |
2,357 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3VQVAE | import math
from ...utils import auto_docstring, can_return_tuple, logging
from ...modeling_utils import PreTrainedModel
import torch
import torch.nn as nn
import torch.nn.functional as F
from .configuration_emu3 import Emu3Config, Emu3TextConfig, Emu3VQVAEConfig
@auto_docstring(custom_intro='\n The VQ-VAE model us... | @auto_docstring(custom_intro='\n The VQ-VAE model used in Emu3 for encoding/decoding images into discrete tokens.\n This model follows the "Make-a-scene: Scene-based text-to-image generation with human priors" paper from\n [ Oran Gafni, Adam Polyak, Oron Ashual, Shelly Sheynin, Devi Parikh, and Yaniv\n Taig... | 6 | 0 | 21 | 4 | 17 | 1 | 3 | 0.04 | 1 | 9 | 5 | 1 | 4 | 8 | 4 | 133 | 97 | 18 | 77 | 31 | 72 | 3 | 56 | 31 | 51 | 6 | 2 | 2 | 13 |
2,358 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3VQVAEAttentionBlock | from .configuration_emu3 import Emu3Config, Emu3TextConfig, Emu3VQVAEConfig
from ..siglip.modeling_siglip import SiglipAttention
class Emu3VQVAEAttentionBlock(SiglipAttention):
def __init__(self, config: Emu3VQVAEConfig):
super().__init__(config)
self.num_key_value_groups = 1 |
class Emu3VQVAEAttentionBlock(SiglipAttention):
def __init__(self, config: Emu3VQVAEConfig):
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 |
2,359 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3VQVAEConv3d | import torch.nn.functional as F
import torch.nn as nn
import torch
class Emu3VQVAEConv3d(nn.Module):
def __init__(self, in_channel: int, out_channel: int, kernel_size: tuple[int], stride: tuple[int]):
super().__init__()
padding_sizes = [one_kernel - one_stride for one_kernel, one_stride in zip(ker... |
class Emu3VQVAEConv3d(nn.Module):
def __init__(self, in_channel: int, out_channel: int, kernel_size: tuple[int], stride: tuple[int]):
pass
def forward(self, hidden_states: torch.Tensor):
pass | 3 | 0 | 13 | 1 | 12 | 0 | 2 | 0 | 1 | 4 | 0 | 0 | 2 | 2 | 2 | 12 | 27 | 3 | 24 | 13 | 15 | 0 | 13 | 7 | 10 | 2 | 1 | 1 | 3 |
2,360 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3VQVAEDecoder | import torch.nn as nn
import torch.nn.functional as F
import math
import torch
from .configuration_emu3 import Emu3Config, Emu3TextConfig, Emu3VQVAEConfig
class Emu3VQVAEDecoder(nn.Module):
def __init__(self, config: Emu3VQVAEConfig):
super().__init__()
quant_channels = config.embed_dim
bl... |
class Emu3VQVAEDecoder(nn.Module):
def __init__(self, config: Emu3VQVAEConfig):
pass
def forward(self, hidden_states: torch.Tensor, quant_states: torch.Tensor):
pass | 3 | 0 | 33 | 6 | 26 | 1 | 3 | 0.04 | 1 | 10 | 6 | 0 | 2 | 7 | 2 | 12 | 68 | 13 | 53 | 19 | 50 | 2 | 39 | 19 | 36 | 3 | 1 | 1 | 6 |
2,361 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3VQVAEDownBlock | import torch.nn.functional as F
import torch.nn as nn
import torch
class Emu3VQVAEDownBlock(nn.Module):
def __init__(self, config):
super().__init__()
self.num_resolutions = len(config.channel_multiplier)
self.num_res_blocks = config.num_res_blocks
base_channels = config.base_chann... |
class Emu3VQVAEDownBlock(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.FloatTensor):
pass | 3 | 0 | 28 | 4 | 24 | 0 | 5 | 0 | 1 | 7 | 3 | 0 | 2 | 4 | 2 | 12 | 57 | 8 | 49 | 22 | 46 | 0 | 44 | 22 | 41 | 5 | 1 | 3 | 10 |
2,362 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3VQVAEEncoder | import torch.nn as nn
import torch
import math
import torch.nn.functional as F
class Emu3VQVAEEncoder(nn.Module):
def __init__(self, config):
super().__init__()
base_channels = config.base_channels
in_channels = config.in_channels
double_latent = config.double_latent
latent... |
class Emu3VQVAEEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, pixel_values: torch.LongTensor):
pass | 3 | 0 | 33 | 7 | 25 | 2 | 4 | 0.06 | 1 | 7 | 4 | 0 | 2 | 7 | 2 | 12 | 68 | 14 | 51 | 26 | 48 | 3 | 42 | 26 | 39 | 4 | 1 | 1 | 7 |
2,363 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3VQVAEEncoderConvDownsample | from ..chameleon.modeling_chameleon import ChameleonPreTrainedModel, ChameleonVQVAEEncoderConvDownsample
class Emu3VQVAEEncoderConvDownsample(ChameleonVQVAEEncoderConvDownsample):
pass |
class Emu3VQVAEEncoderConvDownsample(ChameleonVQVAEEncoderConvDownsample):
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 |
2,364 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3VQVAEEncoderConvUpsample | import torch.nn.functional as F
import torch.nn as nn
class Emu3VQVAEEncoderConvUpsample(nn.Module):
def __init__(self, in_channels):
super().__init__()
self.conv = nn.Conv2d(in_channels, in_channels, kernel_size=3, stride=1, padding=1)
def forward(self, hidden_states):
hidden_states ... |
class Emu3VQVAEEncoderConvUpsample(nn.Module):
def __init__(self, in_channels):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 9 | 1 | 8 | 4 | 5 | 0 | 8 | 4 | 5 | 1 | 1 | 0 | 2 |
2,365 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3VQVAEGroupNorm | import torch.nn.functional as F
import torch.nn as nn
class Emu3VQVAEGroupNorm(nn.GroupNorm):
"""
Same as the torch GroupNorm with the only difference that this ones accepts
an optional kwarg `quant_states` which is not used. This class makes it easier to
use SpatialNorm or GroupNorm without conditiona... |
class Emu3VQVAEGroupNorm(nn.GroupNorm):
'''
Same as the torch GroupNorm with the only difference that this ones accepts
an optional kwarg `quant_states` which is not used. This class makes it easier to
use SpatialNorm or GroupNorm without conditionals
'''
def __init__(self, **kwargs):
... | 3 | 1 | 2 | 0 | 2 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 2 | 0 | 2 | 2 | 12 | 2 | 5 | 3 | 2 | 5 | 5 | 3 | 2 | 1 | 1 | 0 | 2 |
2,366 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3VQVAEMiddleBlock | import torch.nn.functional as F
from typing import Optional, Union
import torch
import torch.nn as nn
class Emu3VQVAEMiddleBlock(nn.Module):
def __init__(self, config, in_channels, quant_channels=None):
super().__init__()
self.block_1 = Emu3VQVAEResnetBlock(in_channels=in_channels, out_channels=in... |
class Emu3VQVAEMiddleBlock(nn.Module):
def __init__(self, config, in_channels, quant_channels=None):
pass
def forward(self, hidden_states: torch.FloatTensor, quant_states: Optional[torch.FloatTensor]=None):
pass | 3 | 0 | 15 | 1 | 14 | 0 | 2 | 0 | 1 | 5 | 4 | 0 | 2 | 4 | 2 | 12 | 32 | 3 | 29 | 9 | 26 | 0 | 20 | 9 | 17 | 2 | 1 | 1 | 3 |
2,367 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3VQVAEResnetBlock | import torch
import torch.nn as nn
from typing import Optional, Union
import torch.nn.functional as F
class Emu3VQVAEResnetBlock(nn.Module):
def __init__(self, in_channels: int, out_channels: Optional[int]=None, quant_channels: Optional[int]=None):
super().__init__()
self.in_channels = in_channels... |
class Emu3VQVAEResnetBlock(nn.Module):
def __init__(self, in_channels: int, out_channels: Optional[int]=None, quant_channels: Optional[int]=None):
pass
def forward(self, hidden_states: torch.Tensor, quant_channels: Optional[torch.Tensor]=None):
pass | 3 | 0 | 30 | 4 | 26 | 0 | 4 | 0 | 1 | 4 | 1 | 0 | 2 | 8 | 2 | 12 | 61 | 9 | 52 | 18 | 44 | 0 | 28 | 13 | 25 | 4 | 1 | 1 | 7 |
2,368 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3VQVAESpatialNorm | import torch.nn.functional as F
import torch.nn as nn
import torch
class Emu3VQVAESpatialNorm(nn.Module):
def __init__(self, in_channels: int, out_channels: int):
super().__init__()
self.norm_layer = nn.GroupNorm(num_channels=out_channels, num_groups=32, eps=1e-06, affine=True)
self.conv_y... |
class Emu3VQVAESpatialNorm(nn.Module):
def __init__(self, in_channels: int, out_channels: int):
pass
def forward(self, hidden_states: torch.Tensor, quant_states: torch.Tensor):
pass | 3 | 0 | 16 | 1 | 16 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 12 | 34 | 2 | 32 | 10 | 25 | 0 | 11 | 6 | 8 | 1 | 1 | 0 | 2 |
2,369 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3VQVAETemporalDownsample | import torch.nn.functional as F
import torch
import torch.nn as nn
class Emu3VQVAETemporalDownsample(nn.Module):
def __init__(self, in_channel: int, out_channel: int):
super().__init__()
self.conv = Emu3VQVAEConv3d(in_channel, out_channel, kernel_size=(4, 3, 3), stride=(2, 1, 1))
def forward(... |
class Emu3VQVAETemporalDownsample(nn.Module):
def __init__(self, in_channel: int, out_channel: int):
pass
def forward(self, hidden_states: torch.Tensor):
pass | 3 | 0 | 8 | 0 | 8 | 0 | 1 | 0 | 1 | 4 | 1 | 0 | 2 | 1 | 2 | 12 | 17 | 1 | 16 | 8 | 9 | 0 | 7 | 4 | 4 | 1 | 1 | 0 | 2 |
2,370 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3VQVAETemporalResnetBlock | import torch.nn as nn
import torch.nn.functional as F
import torch
class Emu3VQVAETemporalResnetBlock(nn.Module):
def __init__(self, in_channels, out_channels=None):
super().__init__()
self.in_channels = in_channels
self.out_channels = in_channels if out_channels is None else out_channels
... |
class Emu3VQVAETemporalResnetBlock(nn.Module):
def __init__(self, in_channels, out_channels=None):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 23 | 2 | 21 | 0 | 3 | 0 | 1 | 2 | 1 | 0 | 2 | 7 | 2 | 12 | 47 | 5 | 42 | 15 | 35 | 0 | 22 | 11 | 19 | 3 | 1 | 1 | 5 |
2,371 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3VQVAETemporalUpsample | import torch.nn as nn
import torch
import torch.nn.functional as F
class Emu3VQVAETemporalUpsample(nn.Module):
def __init__(self, in_channel: int, out_channel: int):
super().__init__()
self.conv = Emu3VQVAEConv3d(in_channel, out_channel, kernel_size=(3, 3, 3), stride=(1, 1, 1))
def forward(se... |
class Emu3VQVAETemporalUpsample(nn.Module):
def __init__(self, in_channel: int, out_channel: int):
pass
def forward(self, hidden_states: torch.Tensor):
pass | 3 | 0 | 10 | 0 | 10 | 0 | 1 | 0 | 1 | 4 | 1 | 0 | 2 | 1 | 2 | 12 | 21 | 1 | 20 | 9 | 13 | 0 | 11 | 5 | 8 | 1 | 1 | 0 | 2 |
2,372 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3VQVAEUpBlock | import torch.nn as nn
import torch
import torch.nn.functional as F
class Emu3VQVAEUpBlock(nn.Module):
def __init__(self, config):
super().__init__()
self.num_resolutions = len(config.channel_multiplier)
self.num_res_blocks = config.num_res_blocks
quant_channels = config.embed_dim
... |
class Emu3VQVAEUpBlock(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.FloatTensor, quant_states: torch.FloatTensor):
pass | 3 | 0 | 27 | 4 | 23 | 0 | 5 | 0 | 1 | 8 | 4 | 0 | 2 | 3 | 2 | 12 | 56 | 9 | 47 | 19 | 44 | 0 | 41 | 19 | 38 | 5 | 1 | 3 | 10 |
2,373 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/modular_emu3.py | transformers.models.emu3.modular_emu3.Emu3VQVAEVectorQuantizer | from .configuration_emu3 import Emu3Config, Emu3TextConfig, Emu3VQVAEConfig
import torch.nn.functional as F
import torch
import torch.nn as nn
class Emu3VQVAEVectorQuantizer(nn.Module):
"""
A module for vector quantization using learned embedding vectors.
This module implements the quantization process si... |
class Emu3VQVAEVectorQuantizer(nn.Module):
'''
A module for vector quantization using learned embedding vectors.
This module implements the quantization process similar to te one described in
the VQ-VAE (Vector Quantized Variational AutoEncoder) paper. It quantizes continuous
input vectors into dis... | 3 | 1 | 10 | 2 | 8 | 1 | 1 | 0.63 | 1 | 3 | 1 | 0 | 2 | 1 | 2 | 12 | 32 | 6 | 16 | 10 | 13 | 10 | 16 | 10 | 13 | 1 | 1 | 0 | 2 |
2,374 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/processing_emu3.py | transformers.models.emu3.processing_emu3.Emu3ImagesKwargs | from ...processing_utils import ImagesKwargs, MultiModalData, ProcessingKwargs, ProcessorMixin, TextKwargs, Unpack
class Emu3ImagesKwargs(ImagesKwargs, total=False):
ratio: str
image_area: int |
class Emu3ImagesKwargs(ImagesKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 3 | 1 | 2 | 0 | 3 | 1 | 2 | 0 | 2 | 0 | 0 |
2,375 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/processing_emu3.py | transformers.models.emu3.processing_emu3.Emu3Processor | from ...processing_utils import ImagesKwargs, MultiModalData, ProcessingKwargs, ProcessorMixin, TextKwargs, Unpack
import numpy as np
from ...tokenization_utils_base import PreTokenizedInput, TextInput
from ...image_utils import ImageInput
from typing import Optional, Union
from ...image_processing_utils import BatchFe... |
class Emu3Processor(ProcessorMixin):
'''
Constructs a Emu3 processor which wraps a Emu3 image processor and a GPT2 tokenizer into a single
processor.
[`Emu3Processor`] offers all the functionalities of [`Emu3ImageProcessor`] and [`GPT2TokenizerFast`].
See the [`~Emu3Processor.__call__`] and [`~Emu3... | 6 | 3 | 20 | 2 | 12 | 7 | 2 | 0.68 | 1 | 10 | 2 | 0 | 7 | 7 | 7 | 24 | 167 | 26 | 88 | 55 | 66 | 60 | 68 | 41 | 60 | 9 | 2 | 3 | 15 |
2,376 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/processing_emu3.py | transformers.models.emu3.processing_emu3.Emu3ProcessorKwargs | from ...processing_utils import ImagesKwargs, MultiModalData, ProcessingKwargs, ProcessorMixin, TextKwargs, Unpack
class Emu3ProcessorKwargs(ProcessingKwargs, total=False):
text_kwargs: Emu3TextKwargs
images_kwargs: Emu3ImagesKwargs
_defaults = {'text_kwargs': {'return_for_image_generation': False, 'return... |
class Emu3ProcessorKwargs(ProcessingKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 12 | 0 | 12 | 2 | 11 | 0 | 4 | 2 | 3 | 0 | 3 | 0 | 0 |
2,377 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/emu3/processing_emu3.py | transformers.models.emu3.processing_emu3.Emu3TextKwargs | from ...processing_utils import ImagesKwargs, MultiModalData, ProcessingKwargs, ProcessorMixin, TextKwargs, Unpack
class Emu3TextKwargs(TextKwargs, total=False):
return_for_image_generation: bool |
class Emu3TextKwargs(TextKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
2,378 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/encodec/configuration_encodec.py | transformers.models.encodec.configuration_encodec.EncodecConfig | from typing import Optional
from ...configuration_utils import PretrainedConfig
import numpy as np
import math
class EncodecConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of an [`EncodecModel`]. It is used to instantiate a
Encodec model according to the specified a... |
class EncodecConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of an [`EncodecModel`]. It is used to instantiate a
Encodec model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a sim... | 14 | 1 | 14 | 0 | 14 | 0 | 2 | 0.92 | 1 | 3 | 0 | 0 | 5 | 23 | 5 | 5 | 161 | 15 | 76 | 61 | 40 | 70 | 42 | 31 | 36 | 3 | 1 | 1 | 9 |
2,379 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/encodec/feature_extraction_encodec.py | transformers.models.encodec.feature_extraction_encodec.EncodecFeatureExtractor | from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...utils import PaddingStrategy, TensorType, logging
from typing import Optional, Union
import numpy as np
from ...feature_extraction_utils import BatchFeature
class EncodecFeatureExtractor(SequenceFeatureExtractor):
"""
Constructs ... |
class EncodecFeatureExtractor(SequenceFeatureExtractor):
'''
Constructs an EnCodec feature extractor.
This feature extractor inherits from [`~feature_extraction_sequence_utils.SequenceFeatureExtractor`] which contains
most of the main methods. Users should refer to this superclass for more information ... | 7 | 2 | 36 | 3 | 25 | 9 | 7 | 0.54 | 1 | 10 | 1 | 0 | 4 | 2 | 4 | 21 | 178 | 21 | 102 | 31 | 79 | 55 | 61 | 13 | 56 | 21 | 3 | 2 | 26 |
2,380 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/encodec/modeling_encodec.py | transformers.models.encodec.modeling_encodec.EncodecConv1d | import torch
from torch import nn
class EncodecConv1d(nn.Module):
"""Conv1d with asymmetric or causal padding and normalization."""
def __init__(self, config, in_channels: int, out_channels: int, kernel_size: int, stride: int=1, dilation: int=1):
super().__init__()
self.causal = config.use_cau... |
class EncodecConv1d(nn.Module):
'''Conv1d with asymmetric or causal padding and normalization.'''
def __init__(self, config, in_channels: int, out_channels: int, kernel_size: int, stride: int=1, dilation: int=1):
pass
def _get_extra_padding_for_conv1d(self, hidden_states: torch.Tensor) -> torch.T... | 6 | 3 | 22 | 3 | 17 | 2 | 3 | 0.13 | 1 | 6 | 0 | 0 | 3 | 6 | 4 | 14 | 95 | 17 | 69 | 30 | 58 | 9 | 54 | 23 | 49 | 6 | 1 | 1 | 13 |
2,381 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/encodec/modeling_encodec.py | transformers.models.encodec.modeling_encodec.EncodecConvTranspose1d | from torch import nn
import math
class EncodecConvTranspose1d(nn.Module):
"""ConvTranspose1d with asymmetric or causal padding and normalization."""
def __init__(self, config, in_channels: int, out_channels: int, kernel_size: int, stride: int=1):
super().__init__()
self.causal = config.use_cau... |
class EncodecConvTranspose1d(nn.Module):
'''ConvTranspose1d with asymmetric or causal padding and normalization.'''
def __init__(self, config, in_channels: int, out_channels: int, kernel_size: int, stride: int=1):
pass
def forward(self, hidden_states):
pass | 3 | 1 | 26 | 5 | 17 | 4 | 5 | 0.26 | 1 | 3 | 0 | 0 | 2 | 5 | 2 | 12 | 55 | 11 | 35 | 15 | 32 | 9 | 31 | 15 | 28 | 6 | 1 | 1 | 9 |
2,382 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/encodec/modeling_encodec.py | transformers.models.encodec.modeling_encodec.EncodecDecoder | from torch import nn
from .configuration_encodec import EncodecConfig
class EncodecDecoder(nn.Module):
"""SEANet decoder as used by EnCodec."""
def __init__(self, config: EncodecConfig):
super().__init__()
scaling = int(2 ** len(config.upsampling_ratios))
model = [EncodecConv1d(config,... |
class EncodecDecoder(nn.Module):
'''SEANet decoder as used by EnCodec.'''
def __init__(self, config: EncodecConfig):
pass
def forward(self, hidden_states):
pass | 3 | 1 | 14 | 2 | 11 | 2 | 3 | 0.23 | 1 | 8 | 5 | 0 | 2 | 1 | 2 | 12 | 32 | 5 | 22 | 10 | 19 | 5 | 20 | 10 | 17 | 3 | 1 | 2 | 5 |
2,383 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/encodec/modeling_encodec.py | transformers.models.encodec.modeling_encodec.EncodecDecoderOutput | from typing import Optional, Union
from dataclasses import dataclass
import torch
from ...utils import ModelOutput, auto_docstring, logging
@dataclass
@auto_docstring
class EncodecDecoderOutput(ModelOutput):
"""
audio_values (`torch.FloatTensor` of shape `(batch_size, segment_length)`, *optional*):
De... | @dataclass
@auto_docstring
class EncodecDecoderOutput(ModelOutput):
'''
audio_values (`torch.FloatTensor` of shape `(batch_size, segment_length)`, *optional*):
Decoded audio values, obtained using the decoder part of Encodec.
'''
pass | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 1 | 2 | 2 | 1 | 5 | 2 | 2 | 1 | 0 | 1 | 0 | 0 |
2,384 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/encodec/modeling_encodec.py | transformers.models.encodec.modeling_encodec.EncodecEncoder | from torch import nn
from .configuration_encodec import EncodecConfig
class EncodecEncoder(nn.Module):
"""SEANet encoder as used by EnCodec."""
def __init__(self, config: EncodecConfig):
super().__init__()
model = [EncodecConv1d(config, config.audio_channels, config.num_filters, config.kernel_... |
class EncodecEncoder(nn.Module):
'''SEANet encoder as used by EnCodec.'''
def __init__(self, config: EncodecConfig):
pass
def forward(self, hidden_states):
pass | 3 | 1 | 13 | 2 | 10 | 2 | 3 | 0.2 | 1 | 7 | 4 | 0 | 2 | 1 | 2 | 12 | 29 | 5 | 20 | 10 | 17 | 4 | 20 | 10 | 17 | 3 | 1 | 2 | 5 |
2,385 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/encodec/modeling_encodec.py | transformers.models.encodec.modeling_encodec.EncodecEncoderOutput | from dataclasses import dataclass
from typing import Optional, Union
import torch
from ...utils import ModelOutput, auto_docstring, logging
@dataclass
@auto_docstring
class EncodecEncoderOutput(ModelOutput):
"""
audio_codes (`torch.LongTensor` of shape `(nb_frames, batch_size, nb_quantizers, frame_len)`, *opt... | @dataclass
@auto_docstring
class EncodecEncoderOutput(ModelOutput):
'''
audio_codes (`torch.LongTensor` of shape `(nb_frames, batch_size, nb_quantizers, frame_len)`, *optional*):
Discrete code embeddings computed using `model.encode`.
audio_scales (list of length `nb_frames` of `torch.Tensor` of sh... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 1 | 3 | 3 | 2 | 7 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
2,386 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/encodec/modeling_encodec.py | transformers.models.encodec.modeling_encodec.EncodecEuclideanCodebook | import torch
from .configuration_encodec import EncodecConfig
from torch import nn
class EncodecEuclideanCodebook(nn.Module):
"""Codebook with Euclidean distance."""
def __init__(self, config: EncodecConfig):
super().__init__()
embed = torch.zeros(config.codebook_size, config.codebook_dim)
... |
class EncodecEuclideanCodebook(nn.Module):
'''Codebook with Euclidean distance.'''
def __init__(self, config: EncodecConfig):
pass
def quantize(self, hidden_states):
pass
def encode(self, hidden_states):
pass
def decode(self, embed_ind):
pass | 5 | 1 | 7 | 1 | 6 | 1 | 1 | 0.17 | 1 | 3 | 1 | 0 | 4 | 1 | 4 | 14 | 34 | 6 | 24 | 14 | 19 | 4 | 24 | 14 | 19 | 1 | 1 | 0 | 4 |
2,387 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/encodec/modeling_encodec.py | transformers.models.encodec.modeling_encodec.EncodecLSTM | from torch import nn
from .configuration_encodec import EncodecConfig
class EncodecLSTM(nn.Module):
"""
LSTM without worrying about the hidden state, nor the layout of the data. Expects input as convolutional layout.
"""
def __init__(self, config: EncodecConfig, dimension: int):
super().__init... |
class EncodecLSTM(nn.Module):
'''
LSTM without worrying about the hidden state, nor the layout of the data. Expects input as convolutional layout.
'''
def __init__(self, config: EncodecConfig, dimension: int):
pass
def forward(self, hidden_states):
pass | 3 | 1 | 4 | 0 | 4 | 0 | 1 | 0.33 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 14 | 2 | 9 | 4 | 6 | 3 | 9 | 4 | 6 | 1 | 1 | 0 | 2 |
2,388 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/encodec/modeling_encodec.py | transformers.models.encodec.modeling_encodec.EncodecModel | from .configuration_encodec import EncodecConfig
import math
import torch
from torch import nn
from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
@auto_docstring(custom_intro='\n The EnCodec neural audio codec model.\n ')
class EncodecModel(EncodecPreTrainedModel):
... | @auto_docstring(custom_intro='\n The EnCodec neural audio codec model.\n ')
class EncodecModel(EncodecPreTrainedModel):
def __init__(self, config: EncodecConfig):
pass
def get_encoder(self):
pass
def _encode_frame(self, input_values: torch.Tensor, bandwidth: float) -> tuple[torch.Te... | 12 | 4 | 29 | 5 | 16 | 8 | 4 | 0.47 | 1 | 16 | 7 | 0 | 8 | 5 | 9 | 10 | 277 | 54 | 152 | 74 | 117 | 71 | 120 | 50 | 110 | 10 | 2 | 2 | 37 |
2,389 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/encodec/modeling_encodec.py | transformers.models.encodec.modeling_encodec.EncodecOutput | from typing import Optional, Union
from ...utils import ModelOutput, auto_docstring, logging
import torch
from dataclasses import dataclass
@dataclass
@auto_docstring
class EncodecOutput(ModelOutput):
"""
audio_codes (`torch.LongTensor` of shape `(nb_frames, batch_size, nb_quantizers, frame_len)`, *optional*)... | @dataclass
@auto_docstring
class EncodecOutput(ModelOutput):
'''
audio_codes (`torch.LongTensor` of shape `(nb_frames, batch_size, nb_quantizers, frame_len)`, *optional*):
Discrete code embeddings computed using `model.encode`.
audio_values (`torch.FloatTensor` of shape `(batch_size, segment_lengt... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 2.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 1 | 3 | 3 | 2 | 7 | 3 | 3 | 2 | 0 | 1 | 0 | 0 |
2,390 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/encodec/modeling_encodec.py | transformers.models.encodec.modeling_encodec.EncodecPreTrainedModel | from ...utils import ModelOutput, auto_docstring, logging
from .configuration_encodec import EncodecConfig
from torch import nn
import math
from ...modeling_utils import PreTrainedAudioTokenizerBase
@auto_docstring
class EncodecPreTrainedModel(PreTrainedAudioTokenizerBase):
config: EncodecConfig
base_model_pre... | @auto_docstring
class EncodecPreTrainedModel(PreTrainedAudioTokenizerBase):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 24 | 0 | 23 | 1 | 12 | 0.19 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 34 | 2 | 27 | 7 | 25 | 5 | 22 | 7 | 20 | 12 | 1 | 3 | 12 |
2,391 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/encodec/modeling_encodec.py | transformers.models.encodec.modeling_encodec.EncodecResidualVectorQuantizer | from .configuration_encodec import EncodecConfig
import torch
import math
from torch import nn
from typing import Optional, Union
class EncodecResidualVectorQuantizer(nn.Module):
"""Residual Vector Quantizer."""
def __init__(self, config: EncodecConfig):
super().__init__()
self.codebook_size =... |
class EncodecResidualVectorQuantizer(nn.Module):
'''Residual Vector Quantizer.'''
def __init__(self, config: EncodecConfig):
pass
def get_num_quantizers_for_bandwidth(self, bandwidth: Optional[float]=None) -> int:
'''Return num_quantizers based on specified target bandwidth.'''
pa... | 5 | 4 | 9 | 0 | 8 | 2 | 2 | 0.23 | 1 | 8 | 2 | 0 | 4 | 4 | 4 | 14 | 42 | 4 | 31 | 22 | 26 | 7 | 31 | 22 | 26 | 2 | 1 | 1 | 7 |
2,392 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/encodec/modeling_encodec.py | transformers.models.encodec.modeling_encodec.EncodecResnetBlock | from torch import nn
from .configuration_encodec import EncodecConfig
class EncodecResnetBlock(nn.Module):
"""
Residual block from SEANet model as used by EnCodec.
"""
def __init__(self, config: EncodecConfig, dim: int, dilations: list[int]):
super().__init__()
kernel_sizes = (config.r... |
class EncodecResnetBlock(nn.Module):
'''
Residual block from SEANet model as used by EnCodec.
'''
def __init__(self, config: EncodecConfig, dim: int, dilations: list[int]):
pass
def forward(self, hidden_states):
pass | 3 | 1 | 13 | 2 | 11 | 0 | 4 | 0.13 | 1 | 7 | 2 | 0 | 2 | 2 | 2 | 12 | 31 | 5 | 23 | 13 | 20 | 3 | 22 | 13 | 19 | 6 | 1 | 1 | 8 |
2,393 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/encodec/modeling_encodec.py | transformers.models.encodec.modeling_encodec.EncodecVectorQuantization | from .configuration_encodec import EncodecConfig
from torch import nn
class EncodecVectorQuantization(nn.Module):
"""
Vector quantization implementation. Currently supports only euclidean distance.
"""
def __init__(self, config: EncodecConfig):
super().__init__()
self.codebook = Encode... |
class EncodecVectorQuantization(nn.Module):
'''
Vector quantization implementation. Currently supports only euclidean distance.
'''
def __init__(self, config: EncodecConfig):
pass
def encode(self, hidden_states):
pass
def decode(self, embed_ind):
pass | 4 | 1 | 4 | 0 | 4 | 0 | 1 | 0.25 | 1 | 3 | 2 | 0 | 3 | 1 | 3 | 13 | 18 | 3 | 12 | 7 | 8 | 3 | 12 | 7 | 8 | 1 | 1 | 0 | 3 |
2,394 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/encoder_decoder/configuration_encoder_decoder.py | transformers.models.encoder_decoder.configuration_encoder_decoder.EncoderDecoderConfig | from ..auto import AutoConfig
from ...configuration_utils import PretrainedConfig
class EncoderDecoderConfig(PretrainedConfig):
"""
[`EncoderDecoderConfig`] is the configuration class to store the configuration of a [`EncoderDecoderModel`]. It is
used to instantiate an Encoder Decoder model according to th... |
class EncoderDecoderConfig(PretrainedConfig):
'''
[`EncoderDecoderConfig`] is the configuration class to store the configuration of a [`EncoderDecoderModel`]. It is
used to instantiate an Encoder Decoder model according to the specified arguments, defining the encoder and decoder
configs.
Configura... | 4 | 2 | 15 | 2 | 11 | 3 | 2 | 1.54 | 1 | 3 | 1 | 0 | 1 | 3 | 2 | 2 | 83 | 17 | 26 | 16 | 20 | 40 | 20 | 13 | 17 | 2 | 1 | 1 | 3 |
2,395 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/encoder_decoder/modeling_encoder_decoder.py | transformers.models.encoder_decoder.modeling_encoder_decoder.EncoderDecoderModel | from .configuration_encoder_decoder import EncoderDecoderConfig
from ...cache_utils import Cache
from ...utils.generic import can_return_tuple
import torch
from ...modeling_outputs import BaseModelOutput, Seq2SeqLMOutput
from ..auto.modeling_auto import AutoModel, AutoModelForCausalLM
from ...modeling_utils import PreT... | @auto_docstring
class EncoderDecoderModel(PreTrainedModel, GenerationMixin):
'''
[`EncoderDecoderModel`] is a generic model class that will be instantiated as a transformer architecture with one
of the base model classes of the library as encoder and another one as decoder when created with the
:meth*~t... | 16 | 4 | 37 | 6 | 23 | 8 | 4 | 0.37 | 2 | 17 | 6 | 0 | 11 | 4 | 13 | 13 | 515 | 90 | 310 | 94 | 262 | 115 | 177 | 63 | 160 | 13 | 1 | 3 | 58 |
2,396 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/configuration_ernie.py | transformers.models.ernie.configuration_ernie.ErnieConfig | from ...configuration_utils import PretrainedConfig
class ErnieConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`ErnieModel`] or a [`TFErnieModel`]. It is used to
instantiate a ERNIE model according to the specified arguments, defining the model architecture. I... |
class ErnieConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`ErnieModel`] or a [`TFErnieModel`]. It is used to
instantiate a ERNIE model according to the specified arguments, defining the model architecture. Instantiating a
configuration with the defaults w... | 2 | 1 | 41 | 1 | 40 | 0 | 1 | 1.48 | 1 | 1 | 0 | 0 | 1 | 17 | 1 | 1 | 115 | 11 | 42 | 41 | 19 | 62 | 21 | 20 | 19 | 1 | 1 | 0 | 1 |
2,397 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/configuration_ernie.py | transformers.models.ernie.configuration_ernie.ErnieOnnxConfig | from collections import OrderedDict
from collections.abc import Mapping
from ...onnx import OnnxConfig
class ErnieOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
if self.task == 'multiple-choice':
dynamic_axis = {0: 'batch', 1: 'choice', 2: 'sequence'... |
class ErnieOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass | 3 | 0 | 13 | 0 | 13 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 1 | 15 | 0 | 15 | 4 | 12 | 0 | 6 | 3 | 4 | 2 | 1 | 1 | 2 |
2,398 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py | transformers.models.ernie.modeling_ernie.ErnieAttention | from ...cache_utils import Cache, EncoderDecoderCache
import torch
import torch.nn as nn
from ...processing_utils import Unpack
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from typing import Callable, Optional, Union
from ...utils import ModelOutput, Tran... |
class ErnieAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, is_causal=False, layer_idx=None, is_cross_attention=False):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, h... | 4 | 0 | 15 | 1 | 14 | 1 | 1 | 0.07 | 1 | 5 | 1 | 0 | 3 | 3 | 3 | 13 | 49 | 4 | 43 | 20 | 30 | 3 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
2,399 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/ernie/modeling_ernie.py | transformers.models.ernie.modeling_ernie.ErnieEmbeddings | import torch.nn as nn
from typing import Callable, Optional, Union
import torch
class ErnieEmbeddings(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
super().__init__()
self.word_embeddings = nn.Embedding(config.vocab_size, ... |
class ErnieEmbeddings(nn.Module):
'''Construct the embeddings from word, position and token_type embeddings.'''
def __init__(self, config):
pass
def forward(self, input_ids: Optional[torch.LongTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, task_type_ids: Optional[torch.LongTensor]... | 3 | 1 | 35 | 4 | 28 | 4 | 6 | 0.14 | 1 | 3 | 0 | 0 | 2 | 8 | 2 | 12 | 74 | 10 | 56 | 27 | 45 | 8 | 42 | 19 | 39 | 9 | 1 | 2 | 11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.