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,800 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/modeling_qwen2_vl.py | transformers.models.qwen2_vl.modeling_qwen2_vl.Qwen2VLModel | from typing import Any, Callable, Optional, Union
import torch.nn.functional as F
import torch.nn as nn
from .configuration_qwen2_vl import Qwen2VLConfig, Qwen2VLTextConfig, Qwen2VLVisionConfig
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, is_torchdynamo_compiling, logging
import torch
from... | @auto_docstring
class Qwen2VLModel(Qwen2VLPreTrainedModel):
def __init__(self, config: Qwen2VLConfig):
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
... | 13 | 5 | 47 | 5 | 35 | 7 | 8 | 0.21 | 1 | 17 | 10 | 0 | 5 | 9 | 6 | 7 | 292 | 34 | 214 | 71 | 177 | 45 | 107 | 40 | 100 | 25 | 2 | 3 | 45 |
4,801 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/modeling_qwen2_vl.py | transformers.models.qwen2_vl.modeling_qwen2_vl.Qwen2VLPreTrainedModel | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, is_torchdynamo_compiling, logging
from .configuration_qwen2_vl import Qwen2VLConfig, Qwen2VLTextConfig, Qwen2VLVisionConfig
@auto_docstring
class Qwen2VLPreTrainedModel(PreT... | @auto_docstring
class Qwen2VLPreTrainedModel(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,802 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/modeling_qwen2_vl.py | transformers.models.qwen2_vl.modeling_qwen2_vl.Qwen2VLRotaryEmbedding | import torch.nn.functional as F
from .configuration_qwen2_vl import Qwen2VLConfig, Qwen2VLTextConfig, Qwen2VLVisionConfig
import torch.nn as nn
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
import torch
class Qwen2VLRotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(... |
class Qwen2VLRotaryEmbedding(nn.Module):
def __init__(self, config: Qwen2VLTextConfig, 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,803 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/modeling_qwen2_vl.py | transformers.models.qwen2_vl.modeling_qwen2_vl.Qwen2VLVisionBlock | from ...modeling_layers import GradientCheckpointingLayer
from torch.nn import LayerNorm
from typing import Any, Callable, Optional, Union
import torch.nn.functional as F
import torch.nn as nn
import torch
class Qwen2VLVisionBlock(GradientCheckpointingLayer):
def __init__(self, config, attn_implementation: str='s... |
class Qwen2VLVisionBlock(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, torch... | 3 | 0 | 8 | 1 | 8 | 0 | 1 | 0 | 1 | 5 | 1 | 0 | 2 | 4 | 2 | 12 | 18 | 2 | 16 | 8 | 13 | 0 | 12 | 8 | 9 | 1 | 1 | 0 | 2 |
4,804 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/modeling_qwen2_vl.py | transformers.models.qwen2_vl.modeling_qwen2_vl.Qwen2VisionTransformerPretrainedModel | import torch.nn.functional as F
import torch.nn as nn
from .configuration_qwen2_vl import Qwen2VLConfig, Qwen2VLTextConfig, Qwen2VLVisionConfig
from ...utils import TransformersKwargs, auto_docstring, can_return_tuple, is_torchdynamo_compiling, logging
import torch
@auto_docstring
class Qwen2VisionTransformerPretraine... | @auto_docstring
class Qwen2VisionTransformerPretrainedModel(Qwen2VLPreTrainedModel):
def __init__(self, config) -> None:
pass
def get_dtype(self) -> torch.dtype:
pass
def get_device(self) -> torch.device:
pass
def rot_pos_emb(self, grid_thw):
pass
@auto_docstring
... | 8 | 1 | 15 | 1 | 13 | 1 | 2 | 0.06 | 1 | 7 | 4 | 0 | 5 | 6 | 5 | 6 | 84 | 12 | 68 | 26 | 62 | 4 | 43 | 25 | 37 | 4 | 2 | 2 | 9 |
4,805 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/modeling_qwen2_vl.py | transformers.models.qwen2_vl.modeling_qwen2_vl.VisionAttention | 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 import Qwen2VLConfig, Qwen2VLTextConfig, Qwen2VLVisionConfig
import torch
class VisionAttention(nn.Module):
de... |
class VisionAttention(nn.Module):
def __init__(self, config: Qwen2VLVisionConfig) -> 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, **kwargs) -> tor... | 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,806 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/modeling_qwen2_vl.py | transformers.models.qwen2_vl.modeling_qwen2_vl.VisionMlp | import torch.nn.functional as F
from ...activations import ACT2FN
import torch
import torch.nn as nn
class VisionMlp(nn.Module):
def __init__(self, dim: int, hidden_dim: int, hidden_act: str) -> None:
super().__init__()
self.fc1 = nn.Linear(dim, hidden_dim)
self.act = ACT2FN[hidden_act]
... |
class VisionMlp(nn.Module):
def __init__(self, dim: int, hidden_dim: int, hidden_act: str) -> None:
pass
def forward(self, x) -> torch.Tensor:
pass | 3 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 4 | 0 | 0 | 2 | 3 | 2 | 12 | 9 | 1 | 8 | 6 | 5 | 0 | 8 | 6 | 5 | 1 | 1 | 0 | 2 |
4,807 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/modeling_qwen2_vl.py | transformers.models.qwen2_vl.modeling_qwen2_vl.VisionRotaryEmbedding | import torch.nn.functional as F
import torch
import torch.nn as nn
class 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 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,808 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/processing_qwen2_vl.py | transformers.models.qwen2_vl.processing_qwen2_vl.Qwen2VLProcessor | from ...video_utils import VideoInput
from typing import Optional, Union
from ...feature_extraction_utils import BatchFeature
from ...tokenization_utils_base import PreTokenizedInput, TextInput
from ...image_utils import ImageInput
import numpy as np
from ...processing_utils import ImagesKwargs, MultiModalData, Process... |
class Qwen2VLProcessor(ProcessorMixin):
'''
Constructs a Qwen2-VL processor which wraps a Qwen2-VL image processor and a Qwen2 tokenizer into a single processor.
[`Qwen2VLProcessor`] offers all the functionalities of [`Qwen2VLImageProcessor`] and [`Qwen2TokenizerFast`]. See the
[`~Qwen2VLProcessor.__ca... | 5 | 4 | 21 | 2 | 11 | 8 | 3 | 0.89 | 1 | 6 | 2 | 0 | 6 | 2 | 6 | 23 | 150 | 18 | 70 | 31 | 56 | 62 | 51 | 24 | 44 | 10 | 2 | 3 | 17 |
4,809 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/qwen2_vl/processing_qwen2_vl.py | transformers.models.qwen2_vl.processing_qwen2_vl.Qwen2VLProcessorKwargs | from ...processing_utils import ImagesKwargs, MultiModalData, ProcessingKwargs, ProcessorMixin, Unpack
class Qwen2VLProcessorKwargs(ProcessingKwargs, total=False):
images_kwargs: Qwen2VLImagesKwargs
_defaults = {'text_kwargs': {'padding': False, 'return_mm_token_type_ids': False}} |
class Qwen2VLProcessorKwargs(ProcessingKwargs, total=False):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 0 | 6 | 2 | 5 | 0 | 2 | 2 | 1 | 0 | 3 | 0 | 0 |
4,810 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rag/configuration_rag.py | transformers.models.rag.configuration_rag.RagConfig | from ...utils import add_start_docstrings
from ...configuration_utils import PretrainedConfig
@add_start_docstrings(RAG_CONFIG_DOC)
class RagConfig(PretrainedConfig):
model_type = 'rag'
has_no_defaults_at_init = True
def __init__(self, vocab_size=None, is_encoder_decoder=True, prefix=None, bos_token_id=No... | null | 5 | 1 | 49 | 6 | 41 | 3 | 2 | 0.07 | 1 | 3 | 1 | 0 | 1 | 23 | 2 | 2 | 104 | 13 | 85 | 67 | 47 | 6 | 38 | 33 | 34 | 3 | 1 | 1 | 4 |
4,811 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rag/modeling_rag.py | transformers.models.rag.modeling_rag.RagModel | from typing import Callable, Optional, Union
from .configuration_rag import RagConfig
import torch
from ...utils import auto_docstring, logging
from ...modeling_utils import PreTrainedModel
from ...cache_utils import Cache, EncoderDecoderCache
from ...configuration_utils import PretrainedConfig
from .retrieval_rag impo... | @auto_docstring
class RagModel(RagPreTrainedModel):
def __init__(self, config: Optional[PretrainedConfig]=None, question_encoder: Optional[PreTrainedModel]=None, generator: Optional[PreTrainedModel]=None, retriever: Optional[RagRetriever]=None, **kwargs):
'''
question_encoder (`PreTrainedModel`, *o... | 5 | 2 | 117 | 14 | 93 | 13 | 9 | 0.13 | 1 | 10 | 5 | 0 | 2 | 5 | 2 | 4 | 238 | 28 | 188 | 45 | 158 | 25 | 71 | 18 | 66 | 13 | 2 | 3 | 18 |
4,812 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rag/modeling_rag.py | transformers.models.rag.modeling_rag.RagPreTrainedModel | from .retrieval_rag import RagRetriever
from ...utils import auto_docstring, logging
from typing import Callable, Optional, Union
from ...modeling_utils import PreTrainedModel
from .configuration_rag import RagConfig
@auto_docstring(custom_intro='\n RAG models were released with the paper [Retrieval-Augmented Gener... | @auto_docstring(custom_intro='\n RAG models were released with the paper [Retrieval-Augmented Generation for Knowledge-Intensive NLP\n Tasks](https://huggingface.co/papers/2005.11401) by Patrick Lewis, Ethan Perez, Aleksandra Piktus et al.\n\n RAG is a retriever augmented model and encapsulate three components... | 5 | 1 | 72 | 13 | 32 | 28 | 5 | 0.86 | 1 | 7 | 5 | 3 | 0 | 0 | 2 | 2 | 162 | 30 | 71 | 27 | 56 | 61 | 37 | 19 | 30 | 8 | 1 | 2 | 9 |
4,813 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rag/modeling_rag.py | transformers.models.rag.modeling_rag.RagSequenceForGeneration | import torch
from typing import Callable, Optional, Union
from .configuration_rag import RagConfig
from torch import nn
from ...utils import auto_docstring, logging
from .retrieval_rag import RagRetriever
from ...configuration_utils import PretrainedConfig
from ...cache_utils import Cache, EncoderDecoderCache
from ...m... | null | 19 | 3 | 34 | 4 | 21 | 10 | 3 | 0.47 | 1 | 11 | 4 | 0 | 9 | 1 | 10 | 12 | 390 | 56 | 236 | 93 | 176 | 112 | 107 | 46 | 95 | 10 | 2 | 2 | 32 |
4,814 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rag/modeling_rag.py | transformers.models.rag.modeling_rag.RagTokenForGeneration | from ...cache_utils import Cache, EncoderDecoderCache
from torch import nn
from ...generation import GenerationConfig, GenerationMixin, LogitsProcessorList, StoppingCriteriaList
from ...utils import auto_docstring, logging
from typing import Callable, Optional, Union
from ...modeling_utils import PreTrainedModel
from .... | null | 28 | 5 | 27 | 3 | 17 | 7 | 2 | 0.41 | 1 | 11 | 5 | 0 | 15 | 2 | 16 | 18 | 510 | 66 | 318 | 110 | 241 | 130 | 139 | 53 | 119 | 8 | 2 | 2 | 41 |
4,815 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rag/modeling_rag.py | transformers.models.rag.modeling_rag.RetrievAugLMMarginOutput | from ...cache_utils import Cache, EncoderDecoderCache
from typing import Callable, Optional, Union
from dataclasses import dataclass
import torch
from ...utils import auto_docstring, logging
from ...modeling_outputs import ModelOutput
@dataclass
@auto_docstring(custom_intro='\n Base class for retriever augmented ma... | @dataclass
@auto_docstring(custom_intro='\n Base class for retriever augmented marginalized models outputs.\n ')
class RetrievAugLMMarginOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Language modeling loss.
logits (`torch.F... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.56 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 92 | 10 | 18 | 18 | 17 | 64 | 18 | 18 | 17 | 0 | 1 | 0 | 0 |
4,816 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rag/modeling_rag.py | transformers.models.rag.modeling_rag.RetrievAugLMOutput | from ...modeling_outputs import ModelOutput
from ...cache_utils import Cache, EncoderDecoderCache
from dataclasses import dataclass
from ...utils import auto_docstring, logging
import torch
from typing import Callable, Optional, Union
@dataclass
@auto_docstring
class RetrievAugLMOutput(ModelOutput):
"""
logits... | @dataclass
@auto_docstring
class RetrievAugLMOutput(ModelOutput):
'''
logits (`torch.FloatTensor` of shape `(batch_size, sequence_length, config.vocab_size)`):
Prediction scores of the language modeling head. The score is possibly marginalized over all documents for
each vocabulary token.
do... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.59 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 87 | 9 | 17 | 17 | 16 | 61 | 17 | 17 | 16 | 0 | 1 | 0 | 0 |
4,817 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rag/retrieval_rag.py | transformers.models.rag.retrieval_rag.CanonicalHFIndex | from ...utils import cached_file, is_datasets_available, is_faiss_available, logging, requires_backends, strtobool
from typing import Optional
class CanonicalHFIndex(HFIndexBase):
"""
A wrapper around an instance of [`~datasets.Datasets`]. If `index_path` is set to `None`, we load the pre-computed
index av... |
class CanonicalHFIndex(HFIndexBase):
'''
A wrapper around an instance of [`~datasets.Datasets`]. If `index_path` is set to `None`, we load the pre-computed
index available with the [`~datasets.arrow_dataset.Dataset`], otherwise, we load the index from the indicated path
on disk.
Args:
vecto... | 3 | 1 | 22 | 0 | 22 | 0 | 2 | 0.42 | 1 | 4 | 0 | 0 | 2 | 8 | 2 | 12 | 67 | 3 | 45 | 21 | 33 | 19 | 21 | 12 | 18 | 2 | 2 | 1 | 4 |
4,818 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rag/retrieval_rag.py | transformers.models.rag.retrieval_rag.CustomHFIndex | from ...utils import cached_file, is_datasets_available, is_faiss_available, logging, requires_backends, strtobool
class CustomHFIndex(HFIndexBase):
"""
A wrapper around an instance of [`~datasets.Datasets`]. The dataset and the index are both loaded from the
indicated paths on disk.
Args:
vec... |
class CustomHFIndex(HFIndexBase):
'''
A wrapper around an instance of [`~datasets.Datasets`]. The dataset and the index are both loaded from the
indicated paths on disk.
Args:
vector_size (`int`): the dimension of the passages embeddings used by the index
dataset_path (`str`):
... | 5 | 1 | 6 | 0 | 6 | 0 | 2 | 0.58 | 1 | 3 | 0 | 0 | 2 | 2 | 3 | 13 | 34 | 4 | 19 | 8 | 14 | 11 | 15 | 7 | 11 | 2 | 2 | 1 | 5 |
4,819 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rag/retrieval_rag.py | transformers.models.rag.retrieval_rag.HFIndexBase | from ...utils import cached_file, is_datasets_available, is_faiss_available, logging, requires_backends, strtobool
import numpy as np
class HFIndexBase(Index):
def __init__(self, vector_size, dataset, index_initialized=False):
requires_backends(self, ['faiss'])
self.vector_size = vector_size
... |
class HFIndexBase(Index):
def __init__(self, vector_size, dataset, index_initialized=False):
pass
def _check_dataset_format(self, with_index: bool):
pass
def init_index(self):
pass
def is_initialized(self):
pass
def get_doc_dicts(self, doc_ids: np.ndarray) -> li... | 7 | 0 | 6 | 0 | 6 | 0 | 2 | 0.03 | 1 | 9 | 0 | 2 | 6 | 3 | 6 | 10 | 40 | 5 | 35 | 13 | 28 | 1 | 28 | 13 | 21 | 4 | 1 | 2 | 11 |
4,820 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rag/retrieval_rag.py | transformers.models.rag.retrieval_rag.Index | import numpy as np
class Index:
"""
A base class for the Indices encapsulated by the [`RagRetriever`].
"""
def get_doc_dicts(self, doc_ids: np.ndarray) -> list[dict]:
"""
Returns a list of dictionaries, containing titles and text of the retrieved documents.
Args:
d... |
class Index:
'''
A base class for the Indices encapsulated by the [`RagRetriever`].
'''
def get_doc_dicts(self, doc_ids: np.ndarray) -> list[dict]:
'''
Returns a list of dictionaries, containing titles and text of the retrieved documents.
Args:
doc_ids (`np.ndar... | 5 | 5 | 9 | 1 | 2 | 6 | 1 | 3.11 | 0 | 2 | 0 | 2 | 4 | 0 | 4 | 4 | 44 | 7 | 9 | 5 | 4 | 28 | 9 | 5 | 4 | 1 | 0 | 0 | 4 |
4,821 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rag/retrieval_rag.py | transformers.models.rag.retrieval_rag.LegacyIndex | import pickle
import os
import numpy as np
from ...utils import cached_file, is_datasets_available, is_faiss_available, logging, requires_backends, strtobool
class LegacyIndex(Index):
"""
An index which can be deserialized from the files built using https://github.com/facebookresearch/DPR. We use
default f... | null | 9 | 1 | 10 | 0 | 10 | 0 | 2 | 0.12 | 1 | 3 | 0 | 0 | 8 | 6 | 8 | 12 | 105 | 10 | 85 | 38 | 76 | 10 | 68 | 36 | 59 | 3 | 1 | 1 | 14 |
4,822 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rag/retrieval_rag.py | transformers.models.rag.retrieval_rag.RagRetriever | import numpy as np
from ...tokenization_utils_base import BatchEncoding
from .tokenization_rag import RagTokenizer
from ...utils import cached_file, is_datasets_available, is_faiss_available, logging, requires_backends, strtobool
from .configuration_rag import RagConfig
from collections.abc import Iterable
from ...toke... |
class RagRetriever:
'''
Retriever used to get documents from vector queries. It retrieves the documents embeddings as well as the documents
contents, and it formats them to be used with a RagModel.
Args:
config ([`RagConfig`]):
The configuration of the RAG model this Retriever is us... | 15 | 5 | 23 | 2 | 16 | 5 | 2 | 0.56 | 0 | 11 | 7 | 0 | 9 | 9 | 11 | 11 | 331 | 50 | 181 | 57 | 159 | 101 | 97 | 48 | 84 | 6 | 0 | 3 | 28 |
4,823 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rag/tokenization_rag.py | transformers.models.rag.tokenization_rag.RagTokenizer | from .configuration_rag import RagConfig
from typing import Optional
import warnings
from ...tokenization_utils_base import BatchEncoding
import os
class RagTokenizer:
def __init__(self, question_encoder, generator):
self.question_encoder = question_encoder
self.generator = generator
self.... |
class RagTokenizer:
def __init__(self, question_encoder, generator):
pass
def save_pretrained(self, save_directory):
pass
@classmethod
def from_pretrained(cls, pretrained_model_name_or_path, **kwargs):
pass
def __call__(self, *args, **kwargs):
pass
def batch_... | 11 | 0 | 9 | 0 | 9 | 0 | 2 | 0.03 | 0 | 8 | 3 | 0 | 8 | 3 | 9 | 9 | 93 | 11 | 80 | 32 | 58 | 2 | 43 | 21 | 32 | 4 | 0 | 1 | 14 |
4,824 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/recurrent_gemma/configuration_recurrent_gemma.py | transformers.models.recurrent_gemma.configuration_recurrent_gemma.RecurrentGemmaConfig | from ...configuration_utils import PretrainedConfig
class RecurrentGemmaConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`RecurrentGemmaModel`]. It is used to instantiate a RecurrentGemma
model according to the specified arguments, defining the model architectu... |
class RecurrentGemmaConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`RecurrentGemmaModel`]. It is used to instantiate a RecurrentGemma
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defau... | 4 | 1 | 29 | 0 | 29 | 0 | 3 | 1.08 | 1 | 3 | 0 | 0 | 2 | 21 | 2 | 2 | 135 | 10 | 60 | 51 | 31 | 65 | 29 | 25 | 26 | 4 | 1 | 1 | 5 |
4,825 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/recurrent_gemma/modeling_recurrent_gemma.py | transformers.models.recurrent_gemma.modeling_recurrent_gemma.RecurrentGemmaDecoderLayer | from typing import Optional, Union
import torch
from ...modeling_layers import GradientCheckpointingLayer
class RecurrentGemmaDecoderLayer(GradientCheckpointingLayer):
"""Griffin and Hawk's residual block."""
def __init__(self, config, layer_idx):
super().__init__()
self.temporal_pre_norm = Re... |
class RecurrentGemmaDecoderLayer(GradientCheckpointingLayer):
'''Griffin and Hawk's residual block.'''
def __init__(self, config, layer_idx):
pass
def forward(self, activations: torch.Tensor, position_ids: torch.Tensor, attention_mask: torch.Tensor, cache_position: Optional[torch.Tensor]=None, us... | 3 | 1 | 14 | 2 | 12 | 1 | 1 | 0.08 | 1 | 6 | 2 | 0 | 2 | 4 | 2 | 12 | 32 | 6 | 25 | 18 | 15 | 2 | 16 | 11 | 13 | 1 | 1 | 0 | 2 |
4,826 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/recurrent_gemma/modeling_recurrent_gemma.py | transformers.models.recurrent_gemma.modeling_recurrent_gemma.RecurrentGemmaForCausalLM | from typing import Optional, Union
from ...modeling_outputs import BaseModelOutputWithNoAttention, CausalLMOutput
import torch
from torch import nn
from ...generation import GenerationMixin
from ...utils import auto_docstring, logging
@auto_docstring
class RecurrentGemmaForCausalLM(RecurrentGemmaPreTrainedModel, Gener... | @auto_docstring
class RecurrentGemmaForCausalLM(RecurrentGemmaPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, position_ids: Optional[torch.LongTensor]=None, cache_position: Optional[torch.LongTensor]=N... | 5 | 1 | 12 | 1 | 8 | 3 | 2 | 0.32 | 2 | 5 | 2 | 0 | 9 | 3 | 9 | 12 | 125 | 21 | 79 | 36 | 55 | 25 | 45 | 23 | 35 | 6 | 2 | 2 | 16 |
4,827 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/recurrent_gemma/modeling_recurrent_gemma.py | transformers.models.recurrent_gemma.modeling_recurrent_gemma.RecurrentGemmaMlp | from torch import nn
from ...activations import ACT2FN
class RecurrentGemmaMlp(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.hidden_size = config.hidden_size
self.intermediate_size = config.intermediate_size // 2
self.gate_proj = nn.Li... |
class RecurrentGemmaMlp(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
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,828 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/recurrent_gemma/modeling_recurrent_gemma.py | transformers.models.recurrent_gemma.modeling_recurrent_gemma.RecurrentGemmaModel | from ...modeling_attn_mask_utils import AttentionMaskConverter
from .configuration_recurrent_gemma import RecurrentGemmaConfig
from torch import nn
import torch
from ...modeling_outputs import BaseModelOutputWithNoAttention, CausalLMOutput
from ...utils import auto_docstring, logging
from typing import Optional, Union
... | @auto_docstring
class RecurrentGemmaModel(RecurrentGemmaPreTrainedModel):
def __init__(self, config: RecurrentGemmaConfig):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, position_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Tensor]=None, ... | 6 | 0 | 23 | 4 | 18 | 1 | 5 | 0.16 | 1 | 12 | 5 | 0 | 5 | 6 | 5 | 8 | 131 | 25 | 93 | 35 | 76 | 15 | 68 | 24 | 62 | 16 | 2 | 2 | 24 |
4,829 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/recurrent_gemma/modeling_recurrent_gemma.py | transformers.models.recurrent_gemma.modeling_recurrent_gemma.RecurrentGemmaPreTrainedModel | import math
from torch import nn
from ...utils import auto_docstring, logging
import torch
from ...modeling_utils import PreTrainedModel
from .configuration_recurrent_gemma import RecurrentGemmaConfig
@auto_docstring
class RecurrentGemmaPreTrainedModel(PreTrainedModel):
config: RecurrentGemmaConfig
base_model_... | @auto_docstring
class RecurrentGemmaPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass
def _setup_cache(self, config, batch, device, dtype):
pass
def reset_cache(self, batch, device, dtype):
pass | 5 | 0 | 15 | 1 | 13 | 0 | 3 | 0.02 | 1 | 3 | 3 | 2 | 3 | 0 | 3 | 3 | 57 | 7 | 50 | 16 | 46 | 1 | 44 | 16 | 40 | 7 | 1 | 2 | 10 |
4,830 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/recurrent_gemma/modeling_recurrent_gemma.py | transformers.models.recurrent_gemma.modeling_recurrent_gemma.RecurrentGemmaRMSNorm | import torch
from torch import nn
class RecurrentGemmaRMSNorm(nn.Module):
def __init__(self, dim: int, eps: float=1e-06):
super().__init__()
self.eps = eps
self.weight = nn.Parameter(torch.zeros(dim))
def _norm(self, x):
return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) +... |
class RecurrentGemmaRMSNorm(nn.Module):
def __init__(self, dim: int, eps: float=1e-06):
pass
def _norm(self, x):
pass
def forward(self, x):
pass
def extra_repr(self):
pass | 5 | 0 | 4 | 0 | 3 | 1 | 1 | 0.15 | 1 | 4 | 0 | 0 | 4 | 2 | 4 | 14 | 18 | 3 | 13 | 8 | 8 | 2 | 13 | 8 | 8 | 1 | 1 | 0 | 4 |
4,831 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/recurrent_gemma/modeling_recurrent_gemma.py | transformers.models.recurrent_gemma.modeling_recurrent_gemma.RecurrentGemmaRecurrentBlock | import torch
from ...activations import ACT2FN
from torch import nn
class RecurrentGemmaRecurrentBlock(nn.Module):
"""Griffin and Hawk's recurrent block."""
def __init__(self, config):
super().__init__()
self.lru_width = config.lru_width
self.hidden_size = config.hidden_size
se... |
class RecurrentGemmaRecurrentBlock(nn.Module):
'''Griffin and Hawk's recurrent block.'''
def __init__(self, config):
pass
def forward(self, input_states: torch.Tensor, position_ids: torch.Tensor, attention_mask: torch.Tensor, cache_position: torch.Tensor, use_cache: bool=True) -> tuple[torch.Tens... | 4 | 1 | 19 | 2 | 16 | 1 | 2 | 0.08 | 1 | 5 | 1 | 0 | 3 | 10 | 3 | 13 | 61 | 9 | 50 | 26 | 39 | 4 | 35 | 19 | 31 | 3 | 1 | 2 | 5 |
4,832 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/recurrent_gemma/modeling_recurrent_gemma.py | transformers.models.recurrent_gemma.modeling_recurrent_gemma.RecurrentGemmaRglru | import torch
from torch import nn
from ...utils.import_utils import is_torchdynamo_compiling
from typing import Optional, Union
class RecurrentGemmaRglru(nn.Module):
"""A Real-Gated Linear Recurrent Unit (RG-LRU) layer."""
def __init__(self, config):
super().__init__()
self.num_attention_heads... |
class RecurrentGemmaRglru(nn.Module):
'''A Real-Gated Linear Recurrent Unit (RG-LRU) layer.'''
def __init__(self, config):
pass
def forward(self, activations: torch.Tensor, position_ids: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]:
pass
def _rnn_scan(self, hidden_states: torch... | 4 | 2 | 35 | 5 | 24 | 6 | 3 | 0.29 | 1 | 5 | 1 | 0 | 3 | 8 | 3 | 13 | 112 | 19 | 73 | 38 | 58 | 21 | 49 | 27 | 45 | 5 | 1 | 2 | 8 |
4,833 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/recurrent_gemma/modeling_recurrent_gemma.py | transformers.models.recurrent_gemma.modeling_recurrent_gemma.RecurrentGemmaRotaryEmbedding | import torch
from torch import nn
class RecurrentGemmaRotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, dim, base=10000, device=None):
super().__init__()
self.dim = dim
self.base = base
inv_freq = 1.0 / self.base ** (torch.arange(0, self.dim, 2, dtype=torch.... |
class RecurrentGemmaRotaryEmbedding(nn.Module):
def __init__(self, dim, base=10000, device=None):
pass
@torch.no_grad()
def forward(self, x, position_ids, seq_len=None):
pass | 4 | 0 | 11 | 0 | 9 | 2 | 2 | 0.15 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 24 | 1 | 20 | 14 | 16 | 3 | 19 | 13 | 16 | 2 | 1 | 1 | 3 |
4,834 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/recurrent_gemma/modeling_recurrent_gemma.py | transformers.models.recurrent_gemma.modeling_recurrent_gemma.RecurrentGemmaSdpaAttention | from torch import nn
from typing import Optional, Union
import torch
from .configuration_recurrent_gemma import RecurrentGemmaConfig
class RecurrentGemmaSdpaAttention(nn.Module):
"""Multi-headed attention from 'Attention Is All You Need' paper"""
def __init__(self, config: RecurrentGemmaConfig):
super... |
class RecurrentGemmaSdpaAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: RecurrentGemmaConfig):
pass
def forward(self, hidden_states: torch.Tensor, position_ids: Optional[torch.LongTensor]=None, attention_mask: Optional[torch.Ten... | 6 | 2 | 28 | 4 | 21 | 4 | 3 | 0.17 | 1 | 6 | 2 | 0 | 4 | 15 | 4 | 14 | 120 | 19 | 87 | 45 | 74 | 15 | 66 | 37 | 61 | 4 | 1 | 1 | 10 |
4,835 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/recurrent_gemma/modeling_recurrent_gemma.py | transformers.models.recurrent_gemma.modeling_recurrent_gemma.SqrtBoundDerivative | import torch
class SqrtBoundDerivative(torch.autograd.Function):
"""Computes a square root with a gradient clipped at `_MAX_SQRT_GRADIENT`."""
@staticmethod
def forward(ctx, x: torch.Tensor) -> torch.Tensor:
"""The forward pass, which is a normal `sqrt`."""
ctx.save_for_backward(x)
... | null | 5 | 3 | 5 | 0 | 4 | 1 | 1 | 0.3 | 1 | 1 | 0 | 0 | 0 | 0 | 2 | 32 | 15 | 2 | 10 | 7 | 5 | 3 | 8 | 5 | 5 | 1 | 5 | 0 | 2 |
4,836 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/configuration_reformer.py | transformers.models.reformer.configuration_reformer.ReformerConfig | from ...configuration_utils import PretrainedConfig
class ReformerConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`ReformerModel`]. It is used to instantiate a
Reformer model according to the specified arguments, defining the model architecture. Instantiating ... |
class ReformerConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`ReformerModel`]. It is used to instantiate a
Reformer model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a s... | 2 | 1 | 74 | 0 | 74 | 0 | 2 | 1.5 | 1 | 3 | 0 | 0 | 1 | 30 | 1 | 1 | 208 | 13 | 78 | 71 | 40 | 117 | 36 | 35 | 34 | 2 | 1 | 0 | 2 |
4,837 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.AxialPositionEmbeddings | from functools import reduce
from operator import mul
from torch import nn
import torch
class AxialPositionEmbeddings(nn.Module):
"""
Constructs axial position embeddings. Useful for very long input sequences to save memory and time.
"""
def __init__(self, config):
super().__init__()
s... |
class AxialPositionEmbeddings(nn.Module):
'''
Constructs axial position embeddings. Useful for very long input sequences to save memory and time.
'''
def __init__(self, config):
pass
def forward(self, position_ids):
pass | 3 | 1 | 44 | 7 | 33 | 5 | 4 | 0.18 | 1 | 5 | 0 | 0 | 2 | 5 | 2 | 12 | 94 | 16 | 66 | 20 | 63 | 12 | 37 | 20 | 34 | 5 | 1 | 2 | 8 |
4,838 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ChunkReformerFeedForward | from ...pytorch_utils import apply_chunking_to_forward
from torch import nn
class ChunkReformerFeedForward(nn.Module):
def __init__(self, config):
super().__init__()
self.chunk_size_feed_forward = config.chunk_size_feed_forward
self.seq_len_dim = 1
self.layer_norm = nn.LayerNorm(co... |
class ChunkReformerFeedForward(nn.Module):
def __init__(self, config):
pass
def forward(self, attention_output):
pass
def forward_chunk(self, hidden_states):
pass | 4 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 3 | 2 | 0 | 3 | 5 | 3 | 13 | 22 | 3 | 19 | 9 | 15 | 0 | 14 | 9 | 10 | 1 | 1 | 0 | 3 |
4,839 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.EfficientAttentionMixin | import torch
class EfficientAttentionMixin:
"""
A few utilities for nn.Modules in Reformer, to be used as a mixin.
"""
def _look_adjacent(self, vectors, num_chunks_before, num_chunks_after):
"""
Used to implement attention between consecutive chunks.
Args:
vectors:... |
class EfficientAttentionMixin:
'''
A few utilities for nn.Modules in Reformer, to be used as a mixin.
'''
def _look_adjacent(self, vectors, num_chunks_before, num_chunks_after):
'''
Used to implement attention between consecutive chunks.
Args:
vectors: array of shap... | 5 | 5 | 12 | 1 | 7 | 5 | 2 | 0.78 | 0 | 2 | 0 | 2 | 4 | 0 | 4 | 4 | 56 | 8 | 27 | 10 | 22 | 21 | 24 | 10 | 19 | 4 | 0 | 2 | 9 |
4,840 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.LSHSelfAttention | from functools import reduce
import torch
import numpy as np
from operator import mul
from torch import nn
class LSHSelfAttention(nn.Module, EfficientAttentionMixin):
def __init__(self, config, layer_idx=None):
super().__init__()
self.config = config
self.chunk_length = config.lsh_attn_chu... |
class LSHSelfAttention(nn.Module, EfficientAttentionMixin):
def __init__(self, config, layer_idx=None):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, num_hashes=None, buckets=None, past_buckets_states=None, use_cache=False, output_attentions=False, cache_position=None, **... | 15 | 3 | 47 | 7 | 32 | 8 | 4 | 0.26 | 2 | 5 | 1 | 0 | 14 | 16 | 14 | 28 | 666 | 111 | 442 | 126 | 402 | 113 | 256 | 101 | 241 | 17 | 1 | 3 | 53 |
4,841 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.LocalSelfAttention | import numpy as np
import torch
from torch import nn
class LocalSelfAttention(nn.Module, EfficientAttentionMixin):
def __init__(self, config, layer_idx=None):
super().__init__()
self.num_attention_heads = config.num_attention_heads
self.chunk_length = config.local_attn_chunk_length
... |
class LocalSelfAttention(nn.Module, EfficientAttentionMixin):
def __init__(self, config, layer_idx=None):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, past_buckets_states=None, use_cache=False, output_attentions=False, **kwargs):
pass
def _compute_attn_mask(... | 6 | 0 | 54 | 10 | 37 | 8 | 4 | 0.21 | 2 | 2 | 0 | 0 | 3 | 13 | 4 | 18 | 222 | 41 | 150 | 48 | 133 | 31 | 93 | 36 | 88 | 9 | 1 | 2 | 16 |
4,842 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.PositionEmbeddings | from torch import nn
class PositionEmbeddings(nn.Module):
"""Constructs conventional position embeddings of shape `[max_pos_embeddings, hidden_size]`."""
def __init__(self, config):
super().__init__()
self.dropout = config.hidden_dropout_prob
self.embedding = nn.Embedding(config.max_po... |
class PositionEmbeddings(nn.Module):
'''Constructs conventional position embeddings of shape `[max_pos_embeddings, hidden_size]`.'''
def __init__(self, config):
pass
def forward(self, position_ids):
pass | 3 | 1 | 4 | 0 | 4 | 0 | 1 | 0.11 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 12 | 2 | 9 | 6 | 6 | 1 | 9 | 6 | 6 | 1 | 1 | 0 | 2 |
4,843 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ReformerAttention | from torch import nn
class ReformerAttention(nn.Module):
def __init__(self, config, layer_id=0):
super().__init__()
self.layer_id = layer_id
self.attn_layers = config.attn_layers
self.layer_norm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
if len(set(self.a... |
class ReformerAttention(nn.Module):
def __init__(self, config, layer_id=0):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, num_hashes=None, past_buckets_states=None, use_cache=False, orig_sequence_length=None, output_attentions=False, buckets=None, cache_position=None):
... | 3 | 0 | 44 | 5 | 36 | 4 | 6 | 0.11 | 1 | 6 | 3 | 0 | 2 | 5 | 2 | 12 | 90 | 10 | 72 | 24 | 58 | 8 | 33 | 13 | 30 | 7 | 1 | 2 | 12 |
4,844 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ReformerClassificationHead | import torch
from torch import nn
class ReformerClassificationHead(nn.Module):
"""Head for sentence-level classification tasks."""
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(2 * config.hidden_size, config.hidden_size)
classifier_dropout = config.classifier_dr... |
class ReformerClassificationHead(nn.Module):
'''Head for sentence-level classification tasks.'''
def __init__(self, config):
pass
def forward(self, hidden_states, **kwargs):
pass | 3 | 1 | 8 | 0 | 8 | 1 | 2 | 0.12 | 1 | 1 | 0 | 0 | 2 | 3 | 2 | 12 | 20 | 2 | 17 | 7 | 14 | 2 | 15 | 7 | 12 | 2 | 1 | 0 | 3 |
4,845 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ReformerEmbeddings | import torch
from torch import nn
class ReformerEmbeddings(nn.Module):
"""Construct the embeddings from word, position and token_type embeddings."""
def __init__(self, config):
super().__init__()
self.max_position_embeddings = config.max_position_embeddings
self.dropout = config.hidden... |
class ReformerEmbeddings(nn.Module):
'''Construct the embeddings from word, position and token_type embeddings.'''
def __init__(self, config):
pass
def forward(self, input_ids=None, position_ids=None, inputs_embeds=None, start_idx_pos_encodings=0):
pass | 3 | 1 | 20 | 3 | 16 | 1 | 4 | 0.09 | 1 | 4 | 2 | 0 | 2 | 4 | 2 | 12 | 44 | 8 | 33 | 12 | 30 | 3 | 25 | 12 | 22 | 5 | 1 | 1 | 7 |
4,846 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ReformerEncoder | import torch
from torch import nn
class ReformerEncoder(nn.Module):
def __init__(self, config):
super().__init__()
self.dropout = config.hidden_dropout_prob
self.layers = nn.ModuleList([ReformerLayer(config, i) for i in range(config.num_hidden_layers)])
self.layer_norm = nn.LayerNo... |
class ReformerEncoder(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states, attention_mask=None, head_mask=None, num_hashes=None, past_buckets_states=None, use_cache=False, orig_sequence_length=None, output_hidden_states=False, output_attentions=False):
pass | 3 | 0 | 29 | 3 | 22 | 4 | 2 | 0.16 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 12 | 59 | 7 | 45 | 20 | 31 | 7 | 16 | 8 | 13 | 2 | 1 | 1 | 3 |
4,847 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ReformerFeedForwardDense | from ...activations import ACT2FN
from torch import nn
class ReformerFeedForwardDense(nn.Module):
def __init__(self, config):
super().__init__()
self.dropout = config.hidden_dropout_prob
if isinstance(config.hidden_act, str):
self.act_fn = ACT2FN[config.hidden_act]
else... |
class ReformerFeedForwardDense(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 8 | 1 | 7 | 0 | 2 | 0 | 1 | 2 | 0 | 0 | 2 | 3 | 2 | 12 | 17 | 3 | 14 | 6 | 11 | 0 | 13 | 6 | 10 | 2 | 1 | 1 | 3 |
4,848 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ReformerFeedForwardOutput | from torch import nn
class ReformerFeedForwardOutput(nn.Module):
def __init__(self, config):
super().__init__()
self.dropout = config.hidden_dropout_prob
self.dense = nn.Linear(config.feed_forward_size, config.hidden_size)
def forward(self, hidden_states):
hidden_states = self... |
class ReformerFeedForwardOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 5 | 1 | 4 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 11 | 2 | 9 | 5 | 6 | 0 | 9 | 5 | 6 | 1 | 1 | 0 | 2 |
4,849 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ReformerForMaskedLM | import torch
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Any, Optional, Union
from ...modeling_outputs import CausalLMOutput, MaskedLMOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput
from ...utils import DUMMY_INPUTS, DUMMY_MASK, ModelOutput, auto_docstring, loggin... | @auto_docstring
class ReformerForMaskedLM(ReformerPreTrainedModel):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, new_embeddings):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, positi... | 7 | 1 | 29 | 5 | 14 | 10 | 2 | 0.69 | 1 | 7 | 3 | 0 | 4 | 2 | 4 | 6 | 122 | 24 | 59 | 27 | 40 | 41 | 26 | 14 | 21 | 5 | 2 | 1 | 8 |
4,850 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ReformerForQuestionAnswering | import torch
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Any, Optional, Union
from ...modeling_outputs import CausalLMOutput, MaskedLMOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput
from torch import nn
from ...utils import DUMMY_INPUTS, DUMMY_MASK, ModelOutput, a... | @auto_docstring
class ReformerForQuestionAnswering(ReformerPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.Tensor]=None, position_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, head_mask: Optional[torch.T... | 5 | 1 | 42 | 5 | 31 | 8 | 4 | 0.22 | 1 | 6 | 2 | 0 | 2 | 3 | 2 | 4 | 92 | 10 | 68 | 30 | 46 | 15 | 32 | 16 | 29 | 7 | 2 | 2 | 8 |
4,851 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ReformerForSequenceClassification | import torch
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Any, Optional, Union
from ...modeling_outputs import CausalLMOutput, MaskedLMOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput
from ...utils import DUMMY_INPUTS, DUMMY_MASK, ModelOutput, auto_docstring, loggin... | @auto_docstring(custom_intro='\n Reformer 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 ReformerForSequenceClassification(ReformerPreTrainedModel):
def __init__(self, config):
pass
@auto_do... | 5 | 1 | 56 | 9 | 33 | 15 | 7 | 0.42 | 1 | 7 | 3 | 0 | 2 | 4 | 2 | 4 | 116 | 18 | 69 | 26 | 52 | 29 | 35 | 13 | 32 | 12 | 2 | 3 | 14 |
4,852 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ReformerLayer | import sys
import torch
from torch import nn
class ReformerLayer(nn.Module):
def __init__(self, config, layer_id=0):
super().__init__()
self.attention = ReformerAttention(config, layer_id)
self.attention_seed = None
self.feed_forward_seed = None
self.feed_forward = ChunkRef... |
class ReformerLayer(nn.Module):
def __init__(self, config, layer_id=0):
pass
def _init_attention_seed(self):
'''
This function sets a new seed for the attention layer to make dropout deterministic for both forward calls: 1
normal forward call and 1 forward call in backward to ... | 6 | 2 | 32 | 4 | 21 | 8 | 2 | 0.38 | 1 | 4 | 2 | 0 | 5 | 4 | 5 | 15 | 166 | 23 | 104 | 37 | 78 | 39 | 55 | 17 | 49 | 3 | 1 | 2 | 9 |
4,853 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ReformerModel | import torch
from typing import Any, Optional, Union
from ...utils import DUMMY_INPUTS, DUMMY_MASK, ModelOutput, auto_docstring, logging
@auto_docstring
class ReformerModel(ReformerPreTrainedModel):
def __init__(self, config):
super().__init__(config)
self.config = config
assert self.confi... | @auto_docstring
class ReformerModel(ReformerPreTrainedModel):
def __init__(self, config):
pass
def get_input_embeddings(self):
pass
def set_input_embeddings(self, value):
pass
def _prune_heads(self, heads_to_prune):
'''
Prunes heads of the model. heads_to_prun... | 9 | 2 | 33 | 4 | 26 | 3 | 5 | 0.1 | 1 | 9 | 3 | 0 | 6 | 3 | 6 | 8 | 209 | 29 | 165 | 52 | 129 | 17 | 74 | 28 | 67 | 17 | 2 | 2 | 27 |
4,854 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ReformerModelOutput | import torch
from typing import Any, Optional, Union
from ...utils import DUMMY_INPUTS, DUMMY_MASK, ModelOutput, auto_docstring, logging
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro='\n Output type of [`ReformerModel`].\n ')
class ReformerModelOutput(ModelOutput):
"""
last_hi... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`ReformerModel`].\n ')
class ReformerModelOutput(ModelOutput):
'''
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, num_predict, hidden_size)`):
Sequence of hidden-states at the last layer of the model.
`num_predict` ... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 4.6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 34 | 6 | 5 | 4 | 4 | 23 | 5 | 4 | 4 | 0 | 1 | 0 | 0 |
4,855 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ReformerModelWithLMHead | import torch
from typing import Any, Optional, Union
from ...modeling_outputs import CausalLMOutput, MaskedLMOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput
from ...utils import DUMMY_INPUTS, DUMMY_MASK, ModelOutput, auto_docstring, logging
from ...generation import GenerationMixin
@auto_docstring(custo... | @auto_docstring(custom_intro='\n Reformer Model with a `language modeling` head on top.\n ')
class ReformerModelWithLMHead(ReformerPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, new_embeddings... | 9 | 1 | 19 | 2 | 15 | 2 | 2 | 0.11 | 2 | 8 | 4 | 0 | 6 | 2 | 6 | 8 | 127 | 17 | 99 | 38 | 69 | 11 | 41 | 20 | 34 | 5 | 2 | 2 | 13 |
4,856 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ReformerModelWithLMHeadOutput | import torch
from typing import Any, Optional, Union
from ...utils import DUMMY_INPUTS, DUMMY_MASK, ModelOutput, auto_docstring, logging
from dataclasses import dataclass
@dataclass
@auto_docstring(custom_intro='\n Output type of [`ReformerModelWithLMHead`].\n ')
class ReformerModelWithLMHeadOutput(ModelOutput):... | @dataclass
@auto_docstring(custom_intro='\n Output type of [`ReformerModelWithLMHead`].\n ')
class ReformerModelWithLMHeadOutput(ModelOutput):
'''
loss (`torch.FloatTensor` of shape *(1,)*, *optional*, returned when `labels` is provided):
Language modeling loss (for next-token prediction).
log... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 4.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 37 | 6 | 6 | 6 | 5 | 25 | 6 | 6 | 5 | 0 | 1 | 0 | 0 |
4,857 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ReformerOnlyLMHead | import torch
from ...pytorch_utils import apply_chunking_to_forward
from torch import nn
class ReformerOnlyLMHead(nn.Module):
def __init__(self, config):
super().__init__()
self.seq_len_dim = 1
self.chunk_size_lm_head = config.chunk_size_lm_head
self.decoder = nn.Linear(2 * config.... |
class ReformerOnlyLMHead(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass
def forward_chunk(self, hidden_states):
pass
def _tie_weights(self) -> None:
pass | 5 | 0 | 5 | 0 | 4 | 1 | 1 | 0.22 | 1 | 1 | 0 | 0 | 4 | 4 | 4 | 14 | 25 | 3 | 18 | 9 | 13 | 4 | 17 | 9 | 12 | 2 | 1 | 1 | 5 |
4,858 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ReformerPreTrainedModel | import torch
from .configuration_reformer import ReformerConfig
from ...modeling_utils import PreTrainedModel
from torch import nn
from ...utils import DUMMY_INPUTS, DUMMY_MASK, ModelOutput, auto_docstring, logging
@auto_docstring
class ReformerPreTrainedModel(PreTrainedModel):
config: ReformerConfig
base_mode... | @auto_docstring
class ReformerPreTrainedModel(PreTrainedModel):
@property
def dummy_inputs(self):
pass
def _init_weights(self, module):
'''Initialize the weights'''
pass | 5 | 1 | 13 | 0 | 12 | 2 | 5 | 0.26 | 1 | 1 | 1 | 5 | 2 | 0 | 2 | 2 | 37 | 3 | 27 | 10 | 23 | 7 | 20 | 9 | 17 | 8 | 1 | 2 | 9 |
4,859 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ReformerSelfOutput | from torch import nn
class ReformerSelfOutput(nn.Module):
def __init__(self, config):
super().__init__()
all_head_size = config.num_attention_heads * config.attention_head_size
self.dropout = config.hidden_dropout_prob
self.dense = nn.Linear(all_head_size, config.hidden_size, bias=... |
class ReformerSelfOutput(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states):
pass | 3 | 0 | 5 | 1 | 5 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 2 | 2 | 12 | 12 | 2 | 10 | 6 | 7 | 0 | 10 | 6 | 7 | 1 | 1 | 0 | 2 |
4,860 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer.ReverseSort | import torch
from torch.autograd.function import Function
class ReverseSort(Function):
"""
After chunked attention is applied which sorted clusters, original ordering has to be restored. Since customized
backward function is used for Reformer, the gradients of the output vectors have to be explicitly sorte... |
class ReverseSort(Function):
'''
After chunked attention is applied which sorted clusters, original ordering has to be restored. Since customized
backward function is used for Reformer, the gradients of the output vectors have to be explicitly sorted here.
'''
@staticmethod
def forward(ctx, out... | 5 | 1 | 11 | 2 | 7 | 3 | 1 | 0.56 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 32 | 30 | 5 | 16 | 8 | 11 | 9 | 14 | 6 | 11 | 1 | 5 | 1 | 2 |
4,861 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/modeling_reformer.py | transformers.models.reformer.modeling_reformer._ReversibleFunction | import torch
from torch.autograd.function import Function
class _ReversibleFunction(Function):
"""
To prevent PyTorch from performing the usual backpropagation, a customized backward function is implemented here.
This way it is made sure that no memory expensive activations are saved during the forward pas... |
class _ReversibleFunction(Function):
'''
To prevent PyTorch from performing the usual backpropagation, a customized backward function is implemented here.
This way it is made sure that no memory expensive activations are saved during the forward pass. This function is
heavily inspired by https://github... | 5 | 1 | 50 | 8 | 37 | 6 | 4 | 0.21 | 1 | 2 | 0 | 0 | 0 | 0 | 2 | 32 | 110 | 18 | 76 | 32 | 57 | 16 | 37 | 16 | 34 | 5 | 5 | 2 | 7 |
4,862 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/tokenization_reformer.py | transformers.models.reformer.tokenization_reformer.ReformerTokenizer | from ...tokenization_utils import PreTrainedTokenizer
from shutil import copyfile
import sentencepiece as spm
from ...utils.import_utils import requires
import os
from typing import Any, Optional
@requires(backends=('sentencepiece',))
class ReformerTokenizer(PreTrainedTokenizer):
"""
Construct a Reformer token... | @requires(backends=('sentencepiece',))
class ReformerTokenizer(PreTrainedTokenizer):
'''
Construct a Reformer tokenizer. Based on [SentencePiece](https://github.com/google/sentencepiece) .
This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
... | 13 | 5 | 8 | 1 | 7 | 1 | 2 | 0.52 | 1 | 5 | 0 | 0 | 10 | 4 | 10 | 99 | 137 | 26 | 73 | 35 | 53 | 38 | 54 | 25 | 43 | 5 | 3 | 2 | 19 |
4,863 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/reformer/tokenization_reformer_fast.py | transformers.models.reformer.tokenization_reformer_fast.ReformerTokenizerFast | from typing import Optional
import os
from shutil import copyfile
from ...tokenization_utils_fast import PreTrainedTokenizerFast
class ReformerTokenizerFast(PreTrainedTokenizerFast):
"""
Construct a "fast" Reformer tokenizer (backed by HuggingFace's *tokenizers* library). Based on
[Unigram](https://hugging... |
class ReformerTokenizerFast(PreTrainedTokenizerFast):
'''
Construct a "fast" Reformer tokenizer (backed by HuggingFace's *tokenizers* library). Based on
[Unigram](https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=unigram#models).
This tokenizer inherits from [`PreTrainedTok... | 3 | 1 | 13 | 1 | 12 | 0 | 3 | 0.57 | 1 | 4 | 0 | 0 | 3 | 1 | 3 | 91 | 77 | 14 | 40 | 18 | 27 | 23 | 19 | 9 | 15 | 5 | 3 | 1 | 8 |
4,864 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/configuration_regnet.py | transformers.models.regnet.configuration_regnet.RegNetConfig | from ...configuration_utils import PretrainedConfig
class RegNetConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`RegNetModel`]. It is used to instantiate a RegNet
model according to the specified arguments, defining the model architecture. Instantiating a conf... |
class RegNetConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`RegNetModel`]. It is used to instantiate a RegNet
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar... | 2 | 1 | 23 | 0 | 22 | 1 | 2 | 1.48 | 1 | 2 | 0 | 0 | 1 | 8 | 1 | 1 | 68 | 6 | 25 | 22 | 13 | 37 | 15 | 12 | 13 | 2 | 1 | 1 | 2 |
4,865 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/convert_regnet_seer_10b_to_pytorch.py | transformers.models.regnet.convert_regnet_seer_10b_to_pytorch.FakeRegNetParams | from classy_vision.models.regnet import RegNet, RegNetParams
class FakeRegNetParams(RegNetParams):
"""
Used to instantiace a RegNet model from classy vision with the same depth as the 10B one but with super small
parameters, so we can trace it in memory.
"""
def get_expanded_params(self):
... |
class FakeRegNetParams(RegNetParams):
'''
Used to instantiace a RegNet model from classy vision with the same depth as the 10B one but with super small
parameters, so we can trace it in memory.
'''
def get_expanded_params(self):
pass | 2 | 1 | 2 | 0 | 2 | 0 | 1 | 1.33 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 8 | 1 | 3 | 2 | 1 | 4 | 3 | 2 | 1 | 1 | 1 | 0 | 1 |
4,866 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/convert_regnet_seer_10b_to_pytorch.py | transformers.models.regnet.convert_regnet_seer_10b_to_pytorch.FakeRegNetVisslWrapper | import torch.nn as nn
from vissl.models.model_helpers import get_trunk_forward_outputs
from torch import Tensor
class FakeRegNetVisslWrapper(nn.Module):
"""
Fake wrapper for RegNet that mimics what vissl does without the need to pass a config file.
"""
def __init__(self, model: nn.Module):
sup... |
class FakeRegNetVisslWrapper(nn.Module):
'''
Fake wrapper for RegNet that mimics what vissl does without the need to pass a config file.
'''
def __init__(self, model: nn.Module):
pass
def forward(self, x: Tensor):
pass | 3 | 1 | 10 | 1 | 8 | 1 | 2 | 0.31 | 1 | 3 | 0 | 0 | 2 | 1 | 2 | 12 | 25 | 4 | 16 | 7 | 13 | 5 | 12 | 7 | 9 | 2 | 1 | 1 | 3 |
4,867 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/convert_regnet_seer_10b_to_pytorch.py | transformers.models.regnet.convert_regnet_seer_10b_to_pytorch.Tracker | import torch.nn as nn
from collections import OrderedDict
from torch import Tensor
from functools import partial
from dataclasses import dataclass, field
@dataclass
class Tracker:
module: nn.Module
traced: list[nn.Module] = field(default_factory=list)
handles: list = field(default_factory=list)
name2mo... | @dataclass
class Tracker:
def _forward_hook(self, m, inputs: Tensor, outputs: Tensor, name: str):
pass
def __call__(self, x: Tensor):
pass
@property
def parametrized(self):
pass | 6 | 0 | 5 | 0 | 4 | 0 | 2 | 0.05 | 0 | 4 | 0 | 0 | 3 | 0 | 3 | 3 | 23 | 3 | 19 | 10 | 14 | 1 | 18 | 9 | 14 | 2 | 0 | 1 | 5 |
4,868 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/convert_regnet_to_pytorch.py | transformers.models.regnet.convert_regnet_to_pytorch.FakeRegNetVisslWrapper | from vissl.models.model_helpers import get_trunk_forward_outputs
from torch import Tensor
import torch.nn as nn
class FakeRegNetVisslWrapper(nn.Module):
"""
Fake wrapper for RegNet that mimics what vissl does without the need to pass a config file.
"""
def __init__(self, model: nn.Module):
sup... |
class FakeRegNetVisslWrapper(nn.Module):
'''
Fake wrapper for RegNet that mimics what vissl does without the need to pass a config file.
'''
def __init__(self, model: nn.Module):
pass
def forward(self, x: Tensor):
pass | 3 | 1 | 10 | 1 | 8 | 1 | 2 | 0.31 | 1 | 3 | 0 | 0 | 2 | 1 | 2 | 12 | 25 | 4 | 16 | 7 | 13 | 5 | 12 | 7 | 9 | 2 | 1 | 1 | 3 |
4,869 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/convert_regnet_to_pytorch.py | transformers.models.regnet.convert_regnet_to_pytorch.ModuleTransfer | import torch.nn as nn
from torch import Tensor
from dataclasses import dataclass, field
@dataclass
class ModuleTransfer:
src: nn.Module
dest: nn.Module
verbose: int = 1
src_skip: list = field(default_factory=list)
dest_skip: list = field(default_factory=list)
raise_if_mismatch: bool = True
... | @dataclass
class ModuleTransfer:
def __call__(self, x: Tensor):
'''
Transfer the weights of `self.src` to `self.dest` by performing a forward pass using `x` as input. Under the
hood we tracked all the operations in both modules.
'''
pass | 3 | 1 | 21 | 3 | 14 | 4 | 4 | 0.19 | 0 | 7 | 1 | 0 | 1 | 0 | 1 | 1 | 29 | 4 | 21 | 9 | 19 | 4 | 18 | 9 | 16 | 4 | 0 | 2 | 4 |
4,870 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/convert_regnet_to_pytorch.py | transformers.models.regnet.convert_regnet_to_pytorch.NameToFromModelFuncMap | from functools import partial
import torch.nn as nn
from typing import Callable, Optional
import timm
class NameToFromModelFuncMap(dict):
"""
A Dictionary with some additional logic to return a function that creates the correct original model.
"""
def convert_name_to_timm(self, x: str) -> str:
... |
class NameToFromModelFuncMap(dict):
'''
A Dictionary with some additional logic to return a function that creates the correct original model.
'''
def convert_name_to_timm(self, x: str) -> str:
pass
def __getitem__(self, x: str) -> Callable[[], tuple[nn.Module, dict]]:
pass | 3 | 1 | 7 | 1 | 5 | 1 | 2 | 0.36 | 1 | 3 | 0 | 0 | 2 | 0 | 2 | 29 | 19 | 4 | 11 | 5 | 8 | 4 | 10 | 5 | 7 | 2 | 2 | 1 | 3 |
4,871 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/convert_regnet_to_pytorch.py | transformers.models.regnet.convert_regnet_to_pytorch.NameToOurModelFuncMap | from transformers import AutoImageProcessor, RegNetConfig, RegNetForImageClassification, RegNetModel
import torch.nn as nn
from typing import Callable, Optional
class NameToOurModelFuncMap(dict):
"""
A Dictionary with some additional logic to return the correct hugging face RegNet class reference.
"""
... |
class NameToOurModelFuncMap(dict):
'''
A Dictionary with some additional logic to return the correct hugging face RegNet class reference.
'''
def __getitem__(self, x: str) -> Callable[[], nn.Module]:
pass | 2 | 1 | 6 | 0 | 6 | 0 | 2 | 0.43 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 28 | 11 | 1 | 7 | 3 | 5 | 3 | 6 | 3 | 4 | 2 | 2 | 1 | 2 |
4,872 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/modeling_regnet.py | transformers.models.regnet.modeling_regnet.RegNetConvLayer | from typing import Optional
from torch import Tensor, nn
from ...activations import ACT2FN
class RegNetConvLayer(nn.Module):
def __init__(self, in_channels: int, out_channels: int, kernel_size: int=3, stride: int=1, groups: int=1, activation: Optional[str]='relu'):
super().__init__()
self.convolut... |
class RegNetConvLayer(nn.Module):
def __init__(self, in_channels: int, out_channels: int, kernel_size: int=3, stride: int=1, groups: int=1, activation: Optional[str]='relu'):
pass
def forward(self, hidden_state):
pass | 3 | 0 | 13 | 0 | 13 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 2 | 3 | 2 | 12 | 28 | 1 | 27 | 14 | 16 | 0 | 11 | 6 | 8 | 2 | 1 | 0 | 3 |
4,873 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/modeling_regnet.py | transformers.models.regnet.modeling_regnet.RegNetEmbeddings | from .configuration_regnet import RegNetConfig
from torch import Tensor, nn
class RegNetEmbeddings(nn.Module):
"""
RegNet Embeddings (stem) composed of a single aggressive convolution.
"""
def __init__(self, config: RegNetConfig):
super().__init__()
self.embedder = RegNetConvLayer(conf... |
class RegNetEmbeddings(nn.Module):
'''
RegNet Embeddings (stem) composed of a single aggressive convolution.
'''
def __init__(self, config: RegNetConfig):
pass
def forward(self, pixel_values):
pass | 3 | 1 | 7 | 0 | 7 | 0 | 2 | 0.2 | 1 | 4 | 2 | 0 | 2 | 2 | 2 | 12 | 20 | 2 | 15 | 7 | 12 | 3 | 11 | 7 | 8 | 2 | 1 | 1 | 3 |
4,874 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/modeling_regnet.py | transformers.models.regnet.modeling_regnet.RegNetEncoder | from ...modeling_outputs import BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from torch import Tensor, nn
from .configuration_regnet import RegNetConfig
class RegNetEncoder(nn.Module):
def __init__(self, config: RegNetConfig):
super().__ini... |
class RegNetEncoder(nn.Module):
def __init__(self, config: RegNetConfig):
pass
def forward(self, hidden_state: Tensor, output_hidden_states: bool=False, return_dict: bool=True) -> BaseModelOutputWithNoAttention:
pass | 3 | 0 | 17 | 3 | 14 | 1 | 5 | 0.03 | 1 | 8 | 3 | 0 | 2 | 1 | 2 | 12 | 36 | 6 | 29 | 10 | 24 | 1 | 19 | 8 | 16 | 6 | 1 | 2 | 9 |
4,875 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/modeling_regnet.py | transformers.models.regnet.modeling_regnet.RegNetForImageClassification | from torch import Tensor, nn
from typing import Optional
from ...modeling_outputs import BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from ...utils import auto_docstring, logging
import torch
@auto_docstring(custom_intro='\n RegNet Model with an imag... | @auto_docstring(custom_intro='\n RegNet Model with an image classification head on top (a linear layer on top of the pooled features), e.g. for\n ImageNet.\n ')
class RegNetForImageClassification(RegNetPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, pix... | 5 | 1 | 30 | 4 | 23 | 4 | 8 | 0.13 | 1 | 5 | 2 | 0 | 2 | 3 | 2 | 3 | 68 | 8 | 53 | 19 | 37 | 7 | 32 | 12 | 29 | 13 | 2 | 3 | 15 |
4,876 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/modeling_regnet.py | transformers.models.regnet.modeling_regnet.RegNetModel | from torch import Tensor, nn
from ...utils import auto_docstring, logging
from ...modeling_outputs import BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
from typing import Optional
@auto_docstring
class RegNetModel(RegNetPreTrainedModel):
def __init_... | @auto_docstring
class RegNetModel(RegNetPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, pixel_values: Tensor, output_hidden_states: Optional[bool]=None, return_dict: Optional[bool]=None) -> BaseModelOutputWithPoolingAndNoAttention:
pass | 5 | 0 | 17 | 3 | 14 | 1 | 3 | 0.03 | 1 | 6 | 3 | 0 | 2 | 4 | 2 | 3 | 44 | 7 | 36 | 14 | 23 | 1 | 18 | 11 | 15 | 4 | 2 | 1 | 5 |
4,877 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/modeling_regnet.py | transformers.models.regnet.modeling_regnet.RegNetPreTrainedModel | from ...modeling_utils import PreTrainedModel
from torch import Tensor, nn
from .configuration_regnet import RegNetConfig
import math
from ...utils import auto_docstring, logging
@auto_docstring
class RegNetPreTrainedModel(PreTrainedModel):
config: RegNetConfig
base_model_prefix = 'regnet'
main_input_name ... | @auto_docstring
class RegNetPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 13 | 0 | 12 | 1 | 6 | 0.35 | 1 | 0 | 0 | 2 | 1 | 0 | 1 | 1 | 25 | 2 | 17 | 8 | 15 | 6 | 15 | 8 | 13 | 6 | 1 | 2 | 6 |
4,878 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/modeling_regnet.py | transformers.models.regnet.modeling_regnet.RegNetSELayer | from torch import Tensor, nn
class RegNetSELayer(nn.Module):
"""
Squeeze and Excitation layer (SE) proposed in [Squeeze-and-Excitation Networks](https://huggingface.co/papers/1709.01507).
"""
def __init__(self, in_channels: int, reduced_channels: int):
super().__init__()
self.pooler = ... |
class RegNetSELayer(nn.Module):
'''
Squeeze and Excitation layer (SE) proposed in [Squeeze-and-Excitation Networks](https://huggingface.co/papers/1709.01507).
'''
def __init__(self, in_channels: int, reduced_channels: int):
pass
def forward(self, hidden_state):
pass | 3 | 1 | 8 | 1 | 7 | 1 | 1 | 0.27 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 22 | 3 | 15 | 7 | 12 | 4 | 10 | 7 | 7 | 1 | 1 | 0 | 2 |
4,879 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/modeling_regnet.py | transformers.models.regnet.modeling_regnet.RegNetShortCut | from torch import Tensor, nn
class RegNetShortCut(nn.Module):
"""
RegNet shortcut, used to project the residual features to the correct size. If needed, it is also used to
downsample the input using `stride=2`.
"""
def __init__(self, in_channels: int, out_channels: int, stride: int=2):
sup... |
class RegNetShortCut(nn.Module):
'''
RegNet shortcut, used to project the residual features to the correct size. If needed, it is also used to
downsample the input using `stride=2`.
'''
def __init__(self, in_channels: int, out_channels: int, stride: int=2):
pass
def forward(self, inpu... | 3 | 1 | 4 | 0 | 4 | 0 | 1 | 0.44 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 12 | 15 | 2 | 9 | 6 | 6 | 4 | 9 | 6 | 6 | 1 | 1 | 0 | 2 |
4,880 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/modeling_regnet.py | transformers.models.regnet.modeling_regnet.RegNetStage | from .configuration_regnet import RegNetConfig
from torch import Tensor, nn
class RegNetStage(nn.Module):
"""
A RegNet stage composed by stacked layers.
"""
def __init__(self, config: RegNetConfig, in_channels: int, out_channels: int, stride: int=2, depth: int=2):
super().__init__()
la... |
class RegNetStage(nn.Module):
'''
A RegNet stage composed by stacked layers.
'''
def __init__(self, config: RegNetConfig, in_channels: int, out_channels: int, stride: int=2, depth: int=2):
pass
def forward(self, hidden_state):
pass | 3 | 1 | 13 | 1 | 11 | 1 | 2 | 0.17 | 1 | 6 | 3 | 0 | 2 | 1 | 2 | 12 | 31 | 4 | 23 | 13 | 13 | 4 | 8 | 5 | 5 | 2 | 1 | 0 | 3 |
4,881 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/modeling_regnet.py | transformers.models.regnet.modeling_regnet.RegNetXLayer | from .configuration_regnet import RegNetConfig
from torch import Tensor, nn
from ...activations import ACT2FN
class RegNetXLayer(nn.Module):
"""
RegNet's layer composed by three `3x3` convolutions, same as a ResNet bottleneck layer with reduction = 1.
"""
def __init__(self, config: RegNetConfig, in_ch... |
class RegNetXLayer(nn.Module):
'''
RegNet's layer composed by three `3x3` convolutions, same as a ResNet bottleneck layer with reduction = 1.
'''
def __init__(self, config: RegNetConfig, in_channels: int, out_channels: int, stride: int=1):
pass
def forward(self, hidden_state):
pas... | 3 | 1 | 10 | 0 | 10 | 0 | 2 | 0.14 | 1 | 5 | 3 | 0 | 2 | 3 | 2 | 12 | 26 | 2 | 21 | 9 | 18 | 3 | 15 | 9 | 12 | 2 | 1 | 0 | 3 |
4,882 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/regnet/modeling_regnet.py | transformers.models.regnet.modeling_regnet.RegNetYLayer | from .configuration_regnet import RegNetConfig
from torch import Tensor, nn
from ...activations import ACT2FN
class RegNetYLayer(nn.Module):
"""
RegNet's Y layer: an X layer with Squeeze and Excitation.
"""
def __init__(self, config: RegNetConfig, in_channels: int, out_channels: int, stride: int=1):
... |
class RegNetYLayer(nn.Module):
'''
RegNet's Y layer: an X layer with Squeeze and Excitation.
'''
def __init__(self, config: RegNetConfig, in_channels: int, out_channels: int, stride: int=1):
pass
def forward(self, hidden_state):
pass | 3 | 1 | 11 | 0 | 11 | 0 | 2 | 0.14 | 1 | 6 | 4 | 0 | 2 | 3 | 2 | 12 | 27 | 2 | 22 | 9 | 19 | 3 | 15 | 9 | 12 | 2 | 1 | 0 | 3 |
4,883 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/configuration_rembert.py | transformers.models.rembert.configuration_rembert.RemBertConfig | from ...configuration_utils import PretrainedConfig
class RemBertConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`RemBertModel`]. It is used to instantiate an
RemBERT model according to the specified arguments, defining the model architecture. Instantiating a ... | null | 2 | 1 | 42 | 1 | 41 | 0 | 1 | 1.35 | 1 | 1 | 0 | 0 | 1 | 17 | 1 | 1 | 112 | 11 | 43 | 42 | 19 | 58 | 21 | 20 | 19 | 1 | 1 | 0 | 1 |
4,884 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/configuration_rembert.py | transformers.models.rembert.configuration_rembert.RemBertOnnxConfig | from ...onnx import OnnxConfig
from collections import OrderedDict
from collections.abc import Mapping
class RemBertOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
if self.task == 'multiple-choice':
dynamic_axis = {0: 'batch', 1: 'choice', 2: 'sequenc... |
class RemBertOnnxConfig(OnnxConfig):
@property
def inputs(self) -> Mapping[str, Mapping[int, str]]:
pass
@property
def atol_for_validation(self) -> float:
pass | 5 | 0 | 7 | 0 | 7 | 0 | 2 | 0 | 1 | 4 | 0 | 0 | 2 | 0 | 2 | 2 | 18 | 1 | 17 | 6 | 12 | 0 | 8 | 4 | 5 | 2 | 1 | 1 | 3 |
4,885 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertAttention | from torch import nn
import torch
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
class RemBertAttention(nn.Module):
def __init__(self, config, layer_... |
class RemBertAttention(nn.Module):
def __init__(self, config, layer_idx=None):
pass
def prune_heads(self, heads):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Opti... | 4 | 0 | 15 | 1 | 13 | 1 | 1 | 0.12 | 1 | 6 | 2 | 0 | 3 | 3 | 3 | 13 | 49 | 4 | 41 | 20 | 28 | 5 | 22 | 11 | 18 | 2 | 1 | 1 | 4 |
4,886 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertEmbeddings | import torch
from torch import nn
from typing import Optional, Union
class RemBertEmbeddings(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, config.in... |
class RemBertEmbeddings(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 | 24 | 4 | 19 | 2 | 3 | 0.1 | 1 | 3 | 0 | 0 | 2 | 5 | 2 | 12 | 52 | 9 | 39 | 20 | 29 | 4 | 27 | 13 | 24 | 5 | 1 | 1 | 6 |
4,887 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertEncoder | from typing import Optional, Union
from torch import nn
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClas... |
class RemBertEncoder(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 | 46 | 4 | 42 | 0 | 9 | 0 | 1 | 8 | 2 | 0 | 2 | 4 | 2 | 12 | 93 | 8 | 85 | 27 | 70 | 0 | 37 | 15 | 34 | 17 | 1 | 3 | 18 |
4,888 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertForCausalLM | from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...utils import auto_docstring, loggin... | @auto_docstring(custom_intro='\n RemBERT Model with a `language modeling` head on top for CLM fine-tuning.\n ')
class RemBertForCausalLM(RemBertPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, n... | 7 | 1 | 25 | 3 | 15 | 7 | 2 | 0.45 | 2 | 6 | 3 | 0 | 5 | 2 | 5 | 6 | 133 | 20 | 78 | 34 | 53 | 35 | 30 | 16 | 24 | 5 | 2 | 1 | 11 |
4,889 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertForMaskedLM | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from ...utils import auto_docstring, logging
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAn... | @auto_docstring
class RemBertForMaskedLM(RemBertPreTrainedModel):
def __init__(self, config):
pass
def get_output_embeddings(self):
pass
def set_output_embeddings(self, new_embeddings):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.LongTensor]=None, atte... | 10 | 2 | 17 | 2 | 14 | 2 | 2 | 0.12 | 1 | 5 | 3 | 0 | 5 | 2 | 5 | 6 | 99 | 15 | 76 | 33 | 50 | 9 | 34 | 18 | 28 | 5 | 2 | 1 | 10 |
4,890 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertForMultipleChoice | from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
from typing import Optional, Union
from ...utils import auto_docstring, logging
import torch
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, Maske... | @auto_docstring
class RemBertForMultipleChoice(RemBertPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.FloatTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids: Op... | 5 | 1 | 37 | 5 | 29 | 4 | 6 | 0.11 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 3 | 82 | 10 | 65 | 27 | 44 | 7 | 28 | 14 | 25 | 11 | 2 | 1 | 12 |
4,891 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertForQuestionAnswering | from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from torch import nn
import torch
from torc... | @auto_docstring
class RemBertForQuestionAnswering(RemBertPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.FloatTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids:... | 5 | 0 | 42 | 5 | 30 | 7 | 4 | 0.19 | 1 | 4 | 2 | 0 | 2 | 3 | 2 | 3 | 91 | 11 | 67 | 30 | 45 | 13 | 32 | 16 | 29 | 7 | 2 | 2 | 8 |
4,892 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertForSequenceClassification | from torch import nn
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...utils import a... | @auto_docstring(custom_intro='\n RemBERT 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 RemBertForSequenceClassification(RemBertPreTrainedModel):
def __init__(self, config):
pass
@auto_docst... | 5 | 1 | 40 | 4 | 33 | 4 | 7 | 0.1 | 1 | 5 | 2 | 0 | 2 | 4 | 2 | 3 | 87 | 8 | 72 | 26 | 51 | 7 | 34 | 13 | 31 | 12 | 2 | 3 | 13 |
4,893 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertForTokenClassification | from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOutput
from ...utils import auto_docstring, loggin... | @auto_docstring
class RemBertForTokenClassification(RemBertPreTrainedModel):
def __init__(self, config):
pass
@auto_docstring
def forward(self, input_ids: Optional[torch.FloatTensor]=None, attention_mask: Optional[torch.FloatTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_id... | 5 | 1 | 31 | 4 | 24 | 3 | 3 | 0.09 | 1 | 4 | 2 | 0 | 2 | 4 | 2 | 3 | 69 | 9 | 55 | 26 | 34 | 5 | 22 | 13 | 19 | 5 | 2 | 1 | 6 |
4,894 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertIntermediate | from ...activations import ACT2FN
from torch import nn
import torch
class RemBertIntermediate(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isinstance(config.hidden_act, str):
self.intermediate... |
class RemBertIntermediate(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 |
4,895 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertLMPredictionHead | from ...activations import ACT2FN
import torch
from torch import nn
class RemBertLMPredictionHead(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.output_embedding_size)
self.decoder = nn.Linear(config.output_embedding_size, confi... |
class RemBertLMPredictionHead(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 14 | 1 | 13 | 7 | 10 | 0 | 13 | 7 | 10 | 1 | 1 | 0 | 2 |
4,896 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertLayer | from ...modeling_layers import GradientCheckpointingLayer
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
import torch
class RemBertLayer(GradientCheckpoin... |
class RemBertLayer(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.13 | 1 | 7 | 3 | 0 | 3 | 8 | 3 | 13 | 86 | 9 | 70 | 32 | 57 | 9 | 41 | 23 | 37 | 7 | 1 | 2 | 11 |
4,897 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertModel | import torch
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions, CausalLMOutputWithCrossAttentions, MaskedLMOutput, MultipleChoiceModelOutput, QuestionAnsweringModelOutput, SequenceClassifierOutput, TokenClassifierOu... | null | 8 | 2 | 29 | 3 | 19 | 7 | 5 | 0.41 | 1 | 8 | 4 | 0 | 5 | 4 | 5 | 6 | 167 | 22 | 103 | 39 | 76 | 42 | 51 | 23 | 45 | 17 | 2 | 2 | 23 |
4,898 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertOnlyMLMHead | from torch import nn
import torch
class RemBertOnlyMLMHead(nn.Module):
def __init__(self, config):
super().__init__()
self.predictions = RemBertLMPredictionHead(config)
def forward(self, sequence_output: torch.Tensor) -> torch.Tensor:
prediction_scores = self.predictions(sequence_outp... |
class RemBertOnlyMLMHead(nn.Module):
def __init__(self, config):
pass
def forward(self, sequence_output: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 2 | 1 | 2 | 12 | 8 | 1 | 7 | 5 | 4 | 0 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
4,899 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/src/transformers/models/rembert/modeling_rembert.py | transformers.models.rembert.modeling_rembert.RemBertOutput | from torch import nn
import torch
class RemBertOutput(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 RemBertOutput(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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.