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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/benchmark/benchmarks_entrypoint.py | benchmark.benchmarks_entrypoint.ImportModuleException | class ImportModuleException(Exception):
pass | class ImportModuleException(Exception):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
1 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/benchmark/benchmarks_entrypoint.py | benchmark.benchmarks_entrypoint.MetricsRecorder | import pandas as pd
import os
from datetime import datetime
import uuid
import logging
import json
class MetricsRecorder:
def __init__(self, connection, logger: logging.Logger, repository: str, branch: str, commit_id: str, commit_msg: str, collect_csv_data: bool=True):
self.conn = connection
self.... |
class MetricsRecorder:
def __init__(self, connection, logger: logging.Logger, repository: str, branch: str, commit_id: str, commit_msg: str, collect_csv_data: bool=True):
pass
def initialise_benchmark(self, metadata: dict[str, str]) -> str:
'''
Creates a new benchmark, returns the ben... | 9 | 5 | 10 | 0 | 8 | 2 | 1 | 0.23 | 0 | 4 | 0 | 0 | 5 | 5 | 5 | 5 | 54 | 4 | 43 | 15 | 37 | 10 | 24 | 12 | 18 | 1 | 0 | 1 | 5 |
2 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/configuration_my_new_model.py | configuration_my_new_model.MyNewModelConfig | from ...modeling_rope_utils import rope_config_validation
from ...configuration_utils import PretrainedConfig
class MyNewModelConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`MyNewModelModel`]. It is used to instantiate an MyNewModel
model according to the spe... |
class MyNewModelConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`MyNewModelModel`]. It is used to instantiate an MyNewModel
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yi... | 2 | 1 | 63 | 2 | 58 | 3 | 4 | 1.63 | 1 | 1 | 0 | 0 | 1 | 19 | 1 | 1 | 195 | 11 | 70 | 50 | 42 | 114 | 30 | 24 | 28 | 4 | 1 | 1 | 4 |
3 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/configuration_my_new_model2.py | configuration_my_new_model2.MyNewModel2Config | from ...modeling_rope_utils import rope_config_validation
from ...configuration_utils import PretrainedConfig
class MyNewModel2Config(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`GemmaModel`]. It is used to instantiate an Gemma
model according to the specified ar... |
class MyNewModel2Config(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`GemmaModel`]. It is used to instantiate an Gemma
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a sim... | 2 | 1 | 62 | 3 | 56 | 3 | 4 | 0.35 | 1 | 1 | 0 | 0 | 1 | 18 | 1 | 1 | 97 | 5 | 68 | 48 | 41 | 24 | 29 | 23 | 27 | 4 | 1 | 1 | 4 |
4 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/configuration_new_model.py | configuration_new_model.NewModelConfig | from ...configuration_utils import PretrainedConfig
class NewModelConfig(PretrainedConfig):
"""
This is the configuration class to store the configuration of a [`NewModelModel`]. It is used to instantiate an NewModel
model according to the specified arguments, defining the model architecture. Instantiating... |
class NewModelConfig(PretrainedConfig):
'''
This is the configuration class to store the configuration of a [`NewModelModel`]. It is used to instantiate an NewModel
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a ... | 4 | 1 | 25 | 0 | 25 | 0 | 1 | 1.25 | 1 | 1 | 0 | 0 | 2 | 16 | 2 | 2 | 122 | 3 | 53 | 45 | 26 | 66 | 23 | 21 | 20 | 1 | 1 | 0 | 2 |
5 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/conftest.py | conftest.CustomOutputChecker | class CustomOutputChecker(OutputChecker):
def check_output(self, want, got, optionflags):
if IGNORE_RESULT & optionflags:
return True
return OutputChecker.check_output(self, want, got, optionflags) | class CustomOutputChecker(OutputChecker):
def check_output(self, want, got, optionflags):
pass | 2 | 0 | 4 | 0 | 4 | 0 | 2 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 5 | 0 | 5 | 2 | 3 | 0 | 5 | 2 | 3 | 2 | 1 | 1 | 2 |
6 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/.circleci/create_circleci_config.py | create_circleci_config.CircleCIJob | import copy
from typing import Any, Optional
from dataclasses import dataclass
import os
@dataclass
class CircleCIJob:
name: str
additional_env: dict[str, Any] = None
docker_image: list[dict[str, str]] = None
install_steps: list[str] = None
marker: Optional[str] = None
parallelism: Optional[int... | @dataclass
class CircleCIJob:
def __post_init__(self):
pass
def to_dict(self):
pass
@property
def job_name(self):
pass | 6 | 0 | 32 | 1 | 30 | 1 | 7 | 0.05 | 0 | 1 | 0 | 0 | 3 | 0 | 3 | 3 | 113 | 5 | 103 | 28 | 98 | 5 | 57 | 26 | 53 | 10 | 0 | 3 | 20 |
7 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/.circleci/create_circleci_config.py | create_circleci_config.EmptyJob | import copy
class EmptyJob:
job_name = 'empty'
def to_dict(self):
steps = [{'run': 'ls -la'}]
if self.job_name == 'collection_job':
steps.extend(['checkout', {'run': 'pip install requests || true'}, {'run': 'while [[ $(curl --location --request GET "https://circleci.com/api/v2/work... |
class EmptyJob:
def to_dict(self):
pass | 2 | 0 | 19 | 1 | 18 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 22 | 2 | 20 | 4 | 18 | 0 | 7 | 4 | 5 | 2 | 0 | 1 | 2 |
8 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/image_processing_new_imgproc_model.py | image_processing_new_imgproc_model.ImgprocModelImageProcessor | from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
import torch
from ...image_transforms import convert_to_rgb, resize, to_channel_dimension_format
import numpy as np
from typing import Optional, Union
from ...utils import TensorType, filter_out_non_signature_kwargs, is_vision_availab... |
class ImgprocModelImageProcessor(BaseImageProcessor):
'''
Constructs a IMGPROC_MODEL image processor.
Args:
do_resize (`bool`, *optional*, defaults to `True`):
Whether to resize the image's (height, width) dimensions to the specified `size`. Can be overridden by the
`do_resi... | 6 | 3 | 53 | 4 | 30 | 18 | 6 | 0.85 | 1 | 6 | 0 | 0 | 4 | 9 | 4 | 4 | 251 | 23 | 123 | 53 | 82 | 105 | 54 | 17 | 49 | 17 | 1 | 1 | 24 |
9 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/legacy/pytorch-lightning/lightning_base.py | lightning_base.BaseTransformer | import os
from transformers.optimization import Adafactor, get_cosine_schedule_with_warmup, get_cosine_with_hard_restarts_schedule_with_warmup, get_linear_schedule_with_warmup, get_polynomial_decay_schedule_with_warmup
from typing import Any
import argparse
import pytorch_lightning as pl
from pathlib import Path
from t... |
class BaseTransformer(pl.LightningModule):
def __init__(self, hparams: argparse.Namespace, num_labels=None, mode='base', config=None, tokenizer=None, model=None, **config_kwargs):
'''Initialize a model, tokenizer and config.'''
pass
def load_hf_checkpoint(self, *args, **kwargs):
pass
... | 18 | 3 | 12 | 0 | 12 | 0 | 2 | 0.04 | 1 | 17 | 0 | 2 | 14 | 9 | 15 | 15 | 204 | 20 | 178 | 50 | 151 | 7 | 86 | 37 | 70 | 10 | 1 | 2 | 26 |
10 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/legacy/pytorch-lightning/lightning_base.py | lightning_base.LoggingCallback | import pytorch_lightning as pl
import os
from pytorch_lightning.utilities import rank_zero_info
class LoggingCallback(pl.Callback):
def on_batch_end(self, trainer, pl_module):
lr_scheduler = trainer.lr_schedulers[0]['scheduler']
lrs = {f'lr_group_{i}': lr for i, lr in enumerate(lr_scheduler.get_lr... |
class LoggingCallback(pl.Callback):
def on_batch_end(self, trainer, pl_module):
pass
def on_validation_end(self, trainer: pl.Trainer, pl_module: pl.LightningModule):
pass
def on_test_end(self, trainer: pl.Trainer, pl_module: pl.LightningModule):
pass | 4 | 0 | 7 | 0 | 6 | 1 | 2 | 0.1 | 1 | 2 | 0 | 0 | 3 | 0 | 3 | 3 | 24 | 2 | 20 | 12 | 16 | 2 | 20 | 11 | 16 | 3 | 1 | 3 | 7 |
11 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_add_function.py | modeling_add_function.TestAttention | from ...utils.deprecation import deprecate_kwarg
import torch
from torch import nn
from typing import Optional
class TestAttention(nn.Module):
"""
Multi-headed attention from 'Attention Is All You Need' paper. Modified to use sliding window attention: Longformer
and "Generating Long Sequences with Sparse T... |
class TestAttention(nn.Module):
'''
Multi-headed attention from 'Attention Is All You Need' paper. Modified to use sliding window attention: Longformer
and "Generating Long Sequences with Sparse Transformers".
Adapted from transformers.models.mistral.modeling_mistral.MistralAttention:
The input dim... | 4 | 1 | 2 | 0 | 2 | 0 | 1 | 2.2 | 1 | 1 | 0 | 0 | 2 | 0 | 2 | 12 | 19 | 3 | 5 | 4 | 2 | 11 | 5 | 4 | 2 | 1 | 1 | 0 | 2 |
12 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_dummy_bert.py | modeling_dummy_bert.DummyBertAttention | import torch
from torch import nn
from typing import Optional, Union
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
class DummyBertAttention... |
class DummyBertAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, layer_idx=None):
pass
def prune_heads(self, heads):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attentio... | 5 | 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 |
13 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_dummy_bert.py | modeling_dummy_bert.DummyBertEmbeddings | import torch
from torch import nn
from typing import Optional, Union
class DummyBertEmbeddings(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.... |
class DummyBertEmbeddings(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.LongTens... | 3 | 1 | 29 | 3 | 23 | 3 | 4 | 0.15 | 1 | 3 | 0 | 0 | 2 | 6 | 2 | 12 | 62 | 8 | 47 | 23 | 37 | 7 | 34 | 16 | 31 | 7 | 1 | 2 | 8 |
14 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_dummy_bert.py | modeling_dummy_bert.DummyBertEncoder | from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from torch import nn
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions
import torch
class DummyBertEncoder(nn.Module):
def __init__(self, con... |
class DummyBertEncoder(nn.Module):
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, encoder_attention_... | 3 | 0 | 45 | 4 | 41 | 0 | 9 | 0 | 1 | 7 | 1 | 0 | 2 | 3 | 2 | 12 | 91 | 8 | 83 | 26 | 68 | 0 | 35 | 14 | 32 | 17 | 1 | 3 | 18 |
15 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_dummy_bert.py | modeling_dummy_bert.DummyBertIntermediate | import torch
from torch import nn
from ...activations import ACT2FN
class DummyBertIntermediate(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.intermedia... |
class DummyBertIntermediate(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 |
16 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_dummy_bert.py | modeling_dummy_bert.DummyBertLayer | from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
import torch
from ...modeling_layers import GradientCheckpointingLayer
from typing import Optional, Union
from ...utils.deprecation import depr... |
class DummyBertLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_idx=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[tor... | 5 | 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 |
17 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_dummy_bert.py | modeling_dummy_bert.DummyBertModel | from ...utils import auto_docstring, logging
import torch
from typing import Optional, Union
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask_for_sdpa, _prepare_4d_causal_attention_mask_for_sdpa
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCro... | null | 8 | 2 | 37 | 4 | 25 | 8 | 5 | 0.35 | 1 | 7 | 3 | 0 | 5 | 6 | 5 | 6 | 211 | 29 | 135 | 45 | 108 | 47 | 65 | 29 | 59 | 21 | 2 | 2 | 27 |
18 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_dummy_bert.py | modeling_dummy_bert.DummyBertOutput | import torch
from torch import nn
class DummyBertOutput(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.Dro... |
class DummyBertOutput(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 |
19 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_dummy_bert.py | modeling_dummy_bert.DummyBertPooler | from torch import nn
import torch
class DummyBertPooler(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
first_t... |
class DummyBertPooler(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.2 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 10 | 7 | 7 | 2 | 10 | 7 | 7 | 1 | 1 | 0 | 2 |
20 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_dummy_bert.py | modeling_dummy_bert.DummyBertPreTrainedModel | from ...modeling_utils import PreTrainedModel
from .configuration_dummy_bert import DummyBertConfig
from ...utils import auto_docstring, logging
from torch import nn
@auto_docstring
class DummyBertPreTrainedModel(PreTrainedModel):
config: DummyBertConfig
base_model_prefix = 'dummy_bert'
supports_gradient_c... | @auto_docstring
class DummyBertPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.39 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 27 | 2 | 18 | 7 | 16 | 7 | 16 | 7 | 14 | 6 | 1 | 2 | 6 |
21 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_dummy_bert.py | modeling_dummy_bert.DummyBertSdpaSelfAttention | from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
import torch
class DummyBertSdpaSelfAttention(DummyBertSelfAttention):
def __init__(self, config, position_embedding_type=None, layer_idx=None):
super()._... |
class DummyBertSdpaSelfAttention(DummyBertSelfAttention):
def __init__(self, config, position_embedding_type=None, layer_idx=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tens... | 4 | 0 | 48 | 6 | 34 | 9 | 6 | 0.28 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 15 | 99 | 12 | 68 | 22 | 56 | 19 | 35 | 13 | 32 | 11 | 2 | 2 | 12 |
22 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_dummy_bert.py | modeling_dummy_bert.DummyBertSelfAttention | import math
import torch
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from torch import nn
from typing import Optional, Union
class DummyBertSelfAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, layer_idx=None):
... |
class DummyBertSelfAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, layer_idx=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, he... | 4 | 0 | 43 | 7 | 31 | 6 | 6 | 0.19 | 1 | 5 | 0 | 1 | 3 | 11 | 3 | 13 | 132 | 22 | 93 | 44 | 80 | 18 | 72 | 35 | 68 | 13 | 1 | 2 | 17 |
23 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_dummy_bert.py | modeling_dummy_bert.DummyBertSelfOutput | import torch
from torch import nn
class DummyBertSelfOutput(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.Dropo... |
class DummyBertSelfOutput(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 |
24 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_from_uppercase_model.py | modeling_from_uppercase_model.FromUppercaseModelAttention | import torch
from .configuration_from_uppercase_model import FromUppercaseModelTextConfig, FromUppercaseModelVisionConfig
from torch import nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS
from typing import Callable, Optional, Union
class FromUppercaseModelAttention(nn.Module):
"""Multi-headed attention f... |
class FromUppercaseModelAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: Union[FromUppercaseModelVisionConfig, FromUppercaseModelTextConfig]):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Ten... | 3 | 2 | 32 | 5 | 25 | 2 | 4 | 0.11 | 1 | 5 | 0 | 2 | 3 | 10 | 3 | 13 | 102 | 19 | 75 | 30 | 65 | 8 | 54 | 24 | 50 | 8 | 1 | 2 | 11 |
25 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_from_uppercase_model.py | modeling_from_uppercase_model.FromUppercaseModelEncoderLayer | from ...modeling_layers import GradientCheckpointingLayer
from .configuration_from_uppercase_model import FromUppercaseModelTextConfig, FromUppercaseModelVisionConfig
from torch import nn
from typing import Callable, Optional, Union
import torch
class FromUppercaseModelEncoderLayer(GradientCheckpointingLayer):
de... |
class FromUppercaseModelEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config: Union[FromUppercaseModelVisionConfig, FromUppercaseModelTextConfig]):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, causal_attention_mask: torch.Tensor, output_attentions: ... | 3 | 1 | 23 | 3 | 16 | 5 | 2 | 0.31 | 1 | 4 | 1 | 0 | 2 | 5 | 2 | 12 | 48 | 6 | 32 | 17 | 23 | 10 | 21 | 11 | 18 | 2 | 1 | 1 | 3 |
26 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_from_uppercase_model.py | modeling_from_uppercase_model.FromUppercaseModelMLP | import torch
from torch import nn
from ...activations import ACT2FN
class FromUppercaseModelMLP(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.activation_fn = ACT2FN[config.hidden_act]
self.fc1 = nn.Linear(config.hidden_size, config.intermediat... |
class FromUppercaseModelMLP(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 13 | 1 | 12 | 7 | 9 | 0 | 12 | 7 | 9 | 1 | 1 | 0 | 2 |
27 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_multimodal2.py | modeling_multimodal2.Multimodal2VisionAttention | from torch import nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
import torch
from typing import Callable, Optional, Union
from .configuration_multimodal2 import Multimodal2Config, Multimodal2TextConfig, Multimodal2VisionConfig
class Multimodal2VisionAttention(nn.Module):
"""Multi-headed... |
class Multimodal2VisionAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: Union[Multimodal2VisionConfig, Multimodal2TextConfig]):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, caus... | 3 | 2 | 32 | 5 | 25 | 2 | 4 | 0.11 | 1 | 5 | 0 | 2 | 3 | 10 | 3 | 13 | 102 | 19 | 75 | 30 | 65 | 8 | 54 | 24 | 50 | 8 | 1 | 2 | 11 |
28 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_multimodal2.py | modeling_multimodal2.Multimodal2VisionEmbeddings | from torch import nn
import torch
from .configuration_multimodal2 import Multimodal2Config, Multimodal2TextConfig, Multimodal2VisionConfig
from ...utils import auto_docstring, can_return_tuple, torch_int
class Multimodal2VisionEmbeddings(nn.Module):
def __init__(self, config: Multimodal2VisionConfig):
sup... |
class Multimodal2VisionEmbeddings(nn.Module):
def __init__(self, config: Multimodal2VisionConfig):
pass
def interpolate_pos_encoding(self, embeddings: torch.Tensor, height: int, width: int) -> torch.Tensor:
'''
This method allows to interpolate the pre-trained position encodings, to b... | 4 | 1 | 26 | 5 | 19 | 3 | 2 | 0.16 | 1 | 4 | 0 | 0 | 3 | 9 | 3 | 13 | 81 | 16 | 57 | 27 | 53 | 9 | 43 | 27 | 39 | 3 | 1 | 1 | 6 |
29 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_multimodal2.py | modeling_multimodal2.Multimodal2VisionEncoder | from typing import Callable, Optional, Union
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from torch import nn
import torch
class Multimodal2VisionEncoder(nn.Module):
"""
Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a
[`Mul... |
class Multimodal2VisionEncoder(nn.Module):
'''
Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a
[`Multimodal2VisionEncoderLayer`].
Args:
config: Multimodal2VisionConfig
'''
def __init__(self, config):
pass
def forward(self... | 3 | 2 | 43 | 5 | 25 | 13 | 7 | 0.61 | 1 | 7 | 1 | 0 | 2 | 3 | 2 | 12 | 95 | 13 | 51 | 19 | 40 | 31 | 27 | 11 | 24 | 12 | 1 | 2 | 13 |
30 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_multimodal2.py | modeling_multimodal2.Multimodal2VisionEncoderLayer | import torch
from ...modeling_layers import GradientCheckpointingLayer
from typing import Callable, Optional, Union
from torch import nn
class Multimodal2VisionEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config):
super().__init__()
self.embed_dim = config.hidden_size
self.... |
class Multimodal2VisionEncoderLayer(GradientCheckpointingLayer):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, causal_attention_mask: torch.Tensor, output_attentions: Optional[bool]=False) -> tuple[torch.FloatTensor]:
'''
... | 3 | 1 | 23 | 3 | 16 | 5 | 2 | 0.31 | 1 | 4 | 1 | 0 | 2 | 5 | 2 | 12 | 48 | 6 | 32 | 17 | 23 | 10 | 21 | 11 | 18 | 2 | 1 | 1 | 3 |
31 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_multimodal2.py | modeling_multimodal2.Multimodal2VisionMLP | from torch import nn
from ...activations import ACT2FN
import torch
class Multimodal2VisionMLP(nn.Module):
def __init__(self, config):
super().__init__()
self.config = config
self.activation_fn = ACT2FN[config.hidden_act]
self.fc1 = nn.Linear(config.hidden_size, config.intermediate... |
class Multimodal2VisionMLP(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 2 | 0 | 0 | 2 | 4 | 2 | 12 | 13 | 1 | 12 | 7 | 9 | 0 | 12 | 7 | 9 | 1 | 1 | 0 | 2 |
32 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_multimodal2.py | modeling_multimodal2.Multimodal2VisionModel | from typing import Callable, Optional, Union
from torch import nn
import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from .configuration_multimodal2 import Multimodal2Config, Multimodal2TextConfig, Multimodal2VisionConfig
from ...utils import auto_docstring, can_return_tuple, torch... | @add_start_docstrings('New doc', MULTIMODAL2_VISION_START_DOCSTRING)
class Multimodal2VisionModel(Multimodal2VisionPreTrainedModel):
def __init__(self, config: Multimodal2VisionConfig):
pass
def get_input_embeddings(self) -> nn.Module:
pass
@can_return_tuple
@auto_docstring
def for... | 7 | 1 | 15 | 2 | 7 | 6 | 1 | 0.61 | 1 | 3 | 1 | 0 | 3 | 1 | 3 | 4 | 55 | 10 | 28 | 16 | 15 | 17 | 13 | 8 | 9 | 2 | 2 | 0 | 4 |
33 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_multimodal2.py | modeling_multimodal2.Multimodal2VisionPreTrainedModel | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_multimodal2 import Multimodal2Config, Multimodal2TextConfig, Multimodal2VisionConfig
from ...utils import auto_docstring, can_return_tuple, torch_int
@auto_docstring
class Multimodal2VisionPreTrainedModel(PreTrainedModel):
c... | @auto_docstring
class Multimodal2VisionPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 4 | 0 | 3 | 1 | 2 | 0.56 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 16 | 2 | 9 | 7 | 7 | 5 | 9 | 7 | 7 | 2 | 1 | 1 | 2 |
34 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_multimodal2.py | modeling_multimodal2.Multimodal2VisionTransformer | import torch
from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
from typing import Callable, Optional, Union
from ...utils import auto_docstring, can_return_tuple, torch_int
from torch import nn
class Multimodal2VisionTransformer(nn.Module):
def __init__(self, config):
super().__i... |
class Multimodal2VisionTransformer(nn.Module):
def __init__(self, config):
pass
@auto_docstring
def forward(self, pixel_values: Optional[torch.FloatTensor]=None, output_attentions: Optional[bool]=None, output_hidden_states: Optional[bool]=None, interpolate_pos_encoding: Optional[bool]=False) -> Ba... | 4 | 0 | 27 | 4 | 21 | 2 | 4 | 0.07 | 1 | 5 | 2 | 0 | 2 | 5 | 2 | 12 | 57 | 9 | 45 | 21 | 33 | 3 | 24 | 13 | 21 | 6 | 1 | 1 | 7 |
35 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_my_new_model2.py | modeling_my_new_model2.MyNewModel2Attention | from .configuration_my_new_model2 import MyNewModel2Config
from ...processing_utils import Unpack
from typing import Callable, Optional
from ...utils.deprecation import deprecate_kwarg
from ...cache_utils import Cache
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from torch import nn
from ...ut... |
class MyNewModel2Attention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: MyNewModel2Config, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.T... | 4 | 1 | 35 | 4 | 31 | 1 | 3 | 0.03 | 1 | 4 | 1 | 0 | 2 | 11 | 2 | 12 | 74 | 9 | 63 | 31 | 52 | 2 | 34 | 23 | 31 | 5 | 1 | 2 | 6 |
36 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_my_new_model2.py | modeling_my_new_model2.MyNewModel2DecoderLayer | from ...modeling_layers import GenericForSequenceClassification, GradientCheckpointingLayer
from ...cache_utils import Cache
from .configuration_my_new_model2 import MyNewModel2Config
from ...utils.deprecation import deprecate_kwarg
from ...utils import TransformersKwargs, auto_docstring
import torch
from typing import... |
class MyNewModel2DecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: MyNewModel2Config, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=None, ... | 4 | 0 | 25 | 4 | 21 | 2 | 2 | 0.07 | 1 | 8 | 4 | 0 | 2 | 5 | 2 | 12 | 52 | 8 | 42 | 22 | 28 | 3 | 21 | 11 | 18 | 2 | 1 | 1 | 3 |
37 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_my_new_model2.py | modeling_my_new_model2.MyNewModel2ForSequenceClassification | from ...modeling_layers import GenericForSequenceClassification, GradientCheckpointingLayer
class MyNewModel2ForSequenceClassification(GenericForSequenceClassification, MyNewModel2PreTrainedModel):
pass |
class MyNewModel2ForSequenceClassification(GenericForSequenceClassification, MyNewModel2PreTrainedModel):
pass | 1 | 0 | 21 | 2 | 17 | 2 | 3 | 0.12 | 1 | 5 | 1 | 0 | 4 | 3 | 4 | 5 | 87 | 11 | 68 | 29 | 50 | 8 | 36 | 16 | 31 | 9 | 2 | 2 | 12 |
38 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_my_new_model2.py | modeling_my_new_model2.MyNewModel2MLP | from torch import nn
from ...activations import ACT2FN
class MyNewModel2MLP(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(sel... |
class MyNewModel2MLP(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 |
39 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_my_new_model2.py | modeling_my_new_model2.MyNewModel2PreTrainedModel | from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_my_new_model2 import MyNewModel2Config
from ...utils import TransformersKwargs, auto_docstring
@auto_docstring
class MyNewModel2PreTrainedModel(PreTrainedModel):
config: MyNewModel2Config
base_model_prefix = 'model'
... | @auto_docstring
class MyNewModel2PreTrainedModel(PreTrainedModel):
pass | 2 | 0 | 10 | 0 | 10 | 0 | 5 | 0 | 1 | 0 | 0 | 2 | 1 | 0 | 1 | 1 | 23 | 1 | 22 | 14 | 20 | 0 | 21 | 14 | 19 | 5 | 1 | 2 | 5 |
40 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_my_new_model2.py | modeling_my_new_model2.MyNewModel2RMSNorm | import torch
from torch import nn
class MyNewModel2RMSNorm(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) + se... |
class MyNewModel2RMSNorm(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 |
41 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_new_task_model.py | modeling_new_task_model.NewTaskModelCausalLMOutputWithPast | import torch
from dataclasses import dataclass
from ...cache_utils import Cache, StaticCache
from typing import ClassVar, Optional, Union
from ...utils import ModelOutput, auto_docstring, can_return_tuple
@dataclass
@auto_docstring(custom_intro='\n Base class for NewTaskModel causal language model (or autoregressiv... | @dataclass
@auto_docstring(custom_intro='\n Base class for NewTaskModel causal language model (or autoregressive) outputs.\n ')
class NewTaskModelCausalLMOutputWithPast(ModelOutput):
'''
loss (`torch.FloatTensor` of shape `(1,)`, *optional*, returned when `labels` is provided):
Language modeling l... | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 3.57 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 37 | 5 | 7 | 7 | 6 | 25 | 7 | 7 | 6 | 0 | 1 | 0 | 0 |
42 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_new_task_model.py | modeling_new_task_model.NewTaskModelForNewTask | from ...utils import ModelOutput, auto_docstring, can_return_tuple
from ...cache_utils import Cache, StaticCache
from ...generation import GenerationMixin
from torch import nn
from typing import ClassVar, Optional, Union
import torch
@auto_docstring(custom_intro='\n The Base NewTaskModel model which consists of a v... | @auto_docstring(custom_intro='\n The Base NewTaskModel model which consists of a vision backbone and a language model without language modeling head.,\n ')
class NewTaskModelForNewTask(NewTaskModelPreTrainedModel, GenerationMixin):
def __init__(self, config):
pass
def get_input_embeddings(self):... | 21 | 2 | 20 | 2 | 14 | 4 | 3 | 0.3 | 2 | 6 | 2 | 0 | 12 | 9 | 12 | 13 | 256 | 36 | 174 | 85 | 118 | 52 | 90 | 42 | 77 | 13 | 2 | 2 | 30 |
43 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_new_task_model.py | modeling_new_task_model.NewTaskModelMultiModalProjector | from .configuration_new_task_model import NewTaskModelConfig
from torch import nn
class NewTaskModelMultiModalProjector(nn.Module):
def __init__(self, config: NewTaskModelConfig):
super().__init__()
self.linear = nn.Linear(config.vision_config.hidden_size, config.vision_config.projection_dim, bias... |
class NewTaskModelMultiModalProjector(nn.Module):
def __init__(self, config: NewTaskModelConfig):
pass
def forward(self, image_features):
pass | 3 | 0 | 4 | 1 | 3 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 1 | 2 | 12 | 9 | 2 | 7 | 5 | 4 | 0 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
44 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_new_task_model.py | modeling_new_task_model.NewTaskModelPreTrainedModel | from .configuration_new_task_model import NewTaskModelConfig
from ...utils import ModelOutput, auto_docstring, can_return_tuple
from torch import nn
from ...modeling_utils import PreTrainedModel
@auto_docstring
class NewTaskModelPreTrainedModel(PreTrainedModel):
config: NewTaskModelConfig
base_model_prefix = '... | @auto_docstring
class NewTaskModelPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
pass | 3 | 0 | 20 | 2 | 16 | 2 | 7 | 0.07 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 32 | 3 | 27 | 13 | 25 | 2 | 22 | 13 | 20 | 7 | 1 | 2 | 7 |
45 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_roberta.py | modeling_roberta.RobertaAttention | import torch.nn as nn
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
import torch
from typing import Optional, Union
from ...utils.deprecation import deprecate_kwarg
class RobertaAttention(... |
class RobertaAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, layer_idx=None):
pass
def prune_heads(self, heads):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_... | 5 | 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 |
46 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_roberta.py | modeling_roberta.RobertaEmbeddings | import torch.nn as nn
from typing import Optional, Union
import torch
class RobertaEmbeddings(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.h... |
class RobertaEmbeddings(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 | 31 | 3 | 25 | 3 | 4 | 0.14 | 1 | 3 | 0 | 0 | 2 | 7 | 2 | 12 | 65 | 8 | 50 | 24 | 40 | 7 | 35 | 17 | 32 | 7 | 1 | 2 | 8 |
47 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_roberta.py | modeling_roberta.RobertaEncoder | from typing import Optional, Union
import torch.nn as nn
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions
import torch
class RobertaEncoder(nn.Module):
def __init__(self, conf... |
class RobertaEncoder(nn.Module):
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, encoder_attention_ma... | 3 | 0 | 45 | 4 | 41 | 0 | 9 | 0 | 1 | 7 | 1 | 0 | 2 | 3 | 2 | 12 | 91 | 8 | 83 | 26 | 68 | 0 | 35 | 14 | 32 | 17 | 1 | 3 | 18 |
48 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_roberta.py | modeling_roberta.RobertaIntermediate | from ...activations import ACT2FN
import torch.nn as nn
import torch
class RobertaIntermediate(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.intermediat... |
class RobertaIntermediate(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 |
49 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_roberta.py | modeling_roberta.RobertaLayer | from typing import Optional, Union
from ...pytorch_utils import apply_chunking_to_forward, find_pruneable_heads_and_indices, prune_linear_layer
from ...utils.deprecation import deprecate_kwarg
from ...modeling_layers import GradientCheckpointingLayer
import torch.nn as nn
from ...cache_utils import Cache, DynamicCache,... |
class RobertaLayer(GradientCheckpointingLayer):
def __init__(self, config, layer_idx=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch... | 5 | 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 |
50 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_roberta.py | modeling_roberta.RobertaModel | import torch
import torch.nn as nn
from ...modeling_attn_mask_utils import _prepare_4d_attention_mask_for_sdpa, _prepare_4d_causal_attention_mask_for_sdpa
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from ...modeling_outputs import BaseModelOutputWithPastAndCros... | null | 8 | 2 | 37 | 4 | 25 | 8 | 5 | 0.35 | 1 | 7 | 3 | 0 | 5 | 6 | 5 | 6 | 211 | 29 | 135 | 45 | 108 | 47 | 65 | 29 | 59 | 21 | 2 | 2 | 27 |
51 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_roberta.py | modeling_roberta.RobertaPooler | import torch
import torch.nn as nn
class RobertaPooler(nn.Module):
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.hidden_size)
self.activation = nn.Tanh()
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
first_to... |
class RobertaPooler(nn.Module):
def __init__(self, config):
pass
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
pass | 3 | 0 | 6 | 0 | 5 | 1 | 1 | 0.2 | 1 | 2 | 0 | 0 | 2 | 2 | 2 | 12 | 13 | 1 | 10 | 7 | 7 | 2 | 10 | 7 | 7 | 1 | 1 | 0 | 2 |
52 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_roberta.py | modeling_roberta.RobertaPreTrainedModel | import torch.nn as nn
from ...modeling_utils import PreTrainedModel
from .configuration_roberta import RobertaConfig
from ...utils import auto_docstring, logging
@auto_docstring
class RobertaPreTrainedModel(PreTrainedModel):
config: RobertaConfig
base_model_prefix = 'roberta'
supports_gradient_checkpointin... | @auto_docstring
class RobertaPreTrainedModel(PreTrainedModel):
def _init_weights(self, module):
'''Initialize the weights'''
pass | 3 | 1 | 15 | 0 | 12 | 3 | 6 | 0.39 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 27 | 2 | 18 | 7 | 16 | 7 | 16 | 7 | 14 | 6 | 1 | 2 | 6 |
53 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_roberta.py | modeling_roberta.RobertaSdpaSelfAttention | from typing import Optional, Union
from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
import torch
import torch.nn as nn
from ...utils.deprecation import deprecate_kwarg
class RobertaSdpaSelfAttention(RobertaSelfAttention):
def __init__(self, config, position_embedding_type=None, layer_idx=None):... |
class RobertaSdpaSelfAttention(RobertaSelfAttention):
def __init__(self, config, position_embedding_type=None, layer_idx=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.Tensor]=... | 4 | 0 | 48 | 6 | 34 | 9 | 6 | 0.28 | 1 | 3 | 0 | 0 | 2 | 2 | 2 | 15 | 99 | 12 | 68 | 22 | 56 | 19 | 35 | 13 | 32 | 11 | 2 | 2 | 12 |
54 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_roberta.py | modeling_roberta.RobertaSelfAttention | from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
import math
import torch.nn as nn
from ...utils.deprecation import deprecate_kwarg
import torch
class RobertaSelfAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, layer_idx=None):
... |
class RobertaSelfAttention(nn.Module):
def __init__(self, config, position_embedding_type=None, layer_idx=None):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head... | 4 | 0 | 43 | 7 | 31 | 6 | 6 | 0.19 | 1 | 5 | 0 | 1 | 3 | 11 | 3 | 13 | 132 | 22 | 93 | 44 | 80 | 18 | 72 | 35 | 68 | 13 | 1 | 2 | 17 |
55 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_super.py | modeling_super.SuperAttention | from typing import Callable, Optional, Union
from ...processing_utils import Unpack
from ...utils import TransformersKwargs, auto_docstring
import torch
from ...utils.deprecation import deprecate_kwarg
from torch import nn
from ...cache_utils import Cache
from .configuration_super import SuperConfig
from ...modeling_ut... |
class SuperAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: SuperConfig, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: torch.Tensor, posit... | 4 | 1 | 35 | 4 | 31 | 1 | 3 | 0.03 | 1 | 3 | 0 | 0 | 2 | 11 | 2 | 12 | 74 | 9 | 63 | 31 | 52 | 2 | 34 | 23 | 31 | 5 | 1 | 2 | 6 |
56 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_super.py | modeling_super.SuperDecoderLayer | from ...modeling_layers import GradientCheckpointingLayer
from ...cache_utils import Cache
from ...utils import TransformersKwargs, auto_docstring
import torch
from typing import Callable, Optional, Union
from .configuration_super import SuperConfig
from ...processing_utils import Unpack
from ...utils.deprecation impor... |
class SuperDecoderLayer(GradientCheckpointingLayer):
def __init__(self, config: SuperConfig, 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 | 25 | 4 | 21 | 2 | 2 | 0.07 | 1 | 7 | 3 | 0 | 2 | 5 | 2 | 12 | 52 | 8 | 42 | 22 | 28 | 3 | 21 | 11 | 18 | 2 | 1 | 1 | 3 |
57 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_super.py | modeling_super.SuperMLP | from torch import nn
from ...activations import ACT2FN
class SuperMLP(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 SuperMLP(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 |
58 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_super.py | modeling_super.SuperModel | from torch import nn
from ...cache_utils import Cache
from typing import Callable, Optional, Union
from transformers.modeling_outputs import CausalLMOutputWithPast
from ...utils.generic import check_model_inputs
from ...utils import TransformersKwargs, auto_docstring
from .configuration_super import SuperConfig
import ... | @auto_docstring
class SuperModel(SuperPreTrainedModel):
def __init__(self, config: SuperConfig):
pass
@check_model_inputs
@auto_docstring
def forward(self, input_ids: torch.LongTensor=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_valu... | 6 | 0 | 27 | 2 | 21 | 5 | 3 | 0.29 | 1 | 8 | 3 | 0 | 5 | 7 | 6 | 7 | 179 | 17 | 126 | 56 | 89 | 37 | 55 | 26 | 48 | 9 | 2 | 2 | 17 |
59 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_super.py | modeling_super.SuperPreTrainedModel | from ...utils import TransformersKwargs, auto_docstring
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
from .configuration_super import SuperConfig
@auto_docstring
class SuperPreTrainedModel(PreTrainedModel):
config: SuperConfig
base_model_prefix = 'model'
supports_gradient_checkpoi... | @auto_docstring
class SuperPreTrainedModel(PreTrainedModel):
pass | 2 | 0 | 10 | 0 | 10 | 0 | 5 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 23 | 1 | 22 | 14 | 20 | 0 | 21 | 14 | 19 | 5 | 1 | 2 | 5 |
60 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_super.py | modeling_super.SuperRMSNorm | from ...integrations import use_kernel_forward_from_hub
import torch
from torch import nn
@use_kernel_forward_from_hub('RMSNorm')
class SuperRMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
"""
SuperRMSNorm is equivalent to T5LayerNorm
"""
super().__init__()
... | @use_kernel_forward_from_hub('RMSNorm')
class SuperRMSNorm(nn.Module):
def __init__(self, hidden_size, eps=1e-06):
'''
SuperRMSNorm 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 |
61 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_super.py | modeling_super.SuperRotaryEmbedding | from .configuration_super import SuperConfig
from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
import torch
from torch import nn
class SuperRotaryEmbedding(nn.Module):
inv_freq: torch.Tensor
def __init__(self, config: SuperConfig, device=None):
super().__init__()
if h... |
class SuperRotaryEmbedding(nn.Module):
def __init__(self, config: SuperConfig, 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 | 3 | 0 | 0 | 3 | 7 | 3 | 13 | 59 | 8 | 40 | 21 | 35 | 14 | 38 | 20 | 34 | 3 | 1 | 1 | 8 |
62 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modeling_switch_function.py | modeling_switch_function.SwitchFunctionAttention | from ...utils.deprecation import deprecate_kwarg
from ...processing_utils import Unpack
from ...utils import TransformersKwargs
import torch
from .configuration_switch_function import SwitchFunctionConfig
from ...cache_utils import Cache
from torch import nn
from ...modeling_utils import ALL_ATTENTION_FUNCTIONS
from ty... |
class SwitchFunctionAttention(nn.Module):
'''Multi-headed attention from 'Attention Is All You Need' paper'''
def __init__(self, config: SwitchFunctionConfig, layer_idx: int):
pass
@deprecate_kwarg('past_key_value', new_name='past_key_values', version='4.58')
def forward(self, hidden_states: t... | 4 | 1 | 35 | 4 | 31 | 1 | 3 | 0.03 | 1 | 3 | 0 | 0 | 2 | 11 | 2 | 12 | 74 | 9 | 63 | 31 | 52 | 2 | 34 | 23 | 31 | 5 | 1 | 2 | 6 |
63 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/utils/models_to_deprecate.py | models_to_deprecate.HubModelLister | class HubModelLister:
"""
Utility for getting models from the hub based on tags. Handles errors without crashing the script.
"""
def __init__(self, tags):
self.tags = tags
self.model_list = api.list_models(tags=tags)
def __iter__(self):
try:
yield from self.mode... | class HubModelLister:
'''
Utility for getting models from the hub based on tags. Handles errors without crashing the script.
'''
def __init__(self, tags):
pass
def __iter__(self):
pass | 3 | 1 | 5 | 0 | 5 | 0 | 2 | 0.3 | 0 | 1 | 0 | 0 | 2 | 2 | 2 | 2 | 15 | 2 | 10 | 6 | 7 | 3 | 10 | 5 | 7 | 2 | 0 | 1 | 3 |
64 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_add_function.py | modular_add_function.TestAttention | from transformers.models.zamba.modeling_zamba import ZambaAttention
from transformers.models.llama.modeling_llama import apply_rotary_pos_emb
class TestAttention(ZambaAttention):
def __init__(self):
pass
def forward(self):
_ = apply_rotary_pos_emb(1, 1, 1, 1) |
class TestAttention(ZambaAttention):
def __init__(self):
pass
def forward(self):
pass | 3 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 2 | 0 | 2 | 14 | 6 | 1 | 5 | 4 | 2 | 0 | 5 | 4 | 2 | 1 | 2 | 0 | 2 |
65 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_dummy_bert.py | modular_dummy_bert.DummyBertModel | from typing import Optional, Union
from ...modeling_outputs import BaseModelOutputWithPoolingAndCrossAttentions
import torch
from transformers.models.bert.modeling_bert import BertModel
class DummyBertModel(BertModel):
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor... |
class DummyBertModel(BertModel):
def forward(self, input_ids: Optional[torch.Tensor]=None, attention_mask: Optional[torch.Tensor]=None, token_type_ids: Optional[torch.Tensor]=None, position_ids: Optional[torch.Tensor]=None, head_mask: Optional[torch.Tensor]=None, inputs_embeds: Optional[torch.Tensor]=None, encode... | 2 | 0 | 17 | 0 | 17 | 0 | 1 | 0 | 1 | 3 | 0 | 0 | 1 | 0 | 1 | 7 | 18 | 0 | 18 | 17 | 1 | 0 | 3 | 2 | 1 | 1 | 3 | 0 | 1 |
66 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_from_uppercase_model.py | modular_from_uppercase_model.FromUppercaseModelEncoderLayer | from transformers.models.clip.modeling_clip import CLIPEncoderLayer
class FromUppercaseModelEncoderLayer(CLIPEncoderLayer):
pass |
class FromUppercaseModelEncoderLayer(CLIPEncoderLayer):
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 |
67 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/utils/modular_model_converter.py | modular_model_converter.ClassDependencyMapper | from libcst import ClassDef, CSTVisitor
from typing import Optional, Union
class ClassDependencyMapper(CSTVisitor):
"""A visitor which is designed to analyze a single class node to get all its dependencies that are shared with the set of
`global_names`.
"""
def __init__(self, class_name: str, global_n... |
class ClassDependencyMapper(CSTVisitor):
'''A visitor which is designed to analyze a single class node to get all its dependencies that are shared with the set of
`global_names`.
'''
def __init__(self, class_name: str, global_names: set[str], objects_imported_from_modeling: Optional[set[str]]=None):
... | 3 | 1 | 9 | 0 | 9 | 0 | 2 | 0.17 | 1 | 3 | 0 | 0 | 2 | 4 | 2 | 2 | 23 | 2 | 18 | 9 | 13 | 3 | 10 | 7 | 7 | 2 | 1 | 1 | 4 |
68 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/utils/modular_model_converter.py | modular_model_converter.ModelFileMapper | from libcst.metadata import MetadataWrapper, ParentNodeProvider, PositionProvider, ScopeProvider
import libcst as cst
import re
class ModelFileMapper(ModuleMapper):
"""A mapper designed to parse modeling files (like `modeling_llama.py`). When encountering such a file
in the `modular_xxx.py` file, we need to co... |
class ModelFileMapper(ModuleMapper):
'''A mapper designed to parse modeling files (like `modeling_llama.py`). When encountering such a file
in the `modular_xxx.py` file, we need to correctly visit it and merge the dependencies of the modular and current file.
For this reason, this class should only be inst... | 9 | 6 | 20 | 1 | 12 | 7 | 3 | 0.63 | 1 | 7 | 0 | 0 | 6 | 2 | 7 | 42 | 157 | 17 | 86 | 26 | 75 | 54 | 71 | 23 | 63 | 10 | 5 | 3 | 19 |
69 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/utils/modular_model_converter.py | modular_model_converter.ModularFileMapper | from collections import Counter, defaultdict, deque
import libcst as cst
import re
from libcst import matchers as m
class ModularFileMapper(ModuleMapper):
"""This is a Mapper to visit a modular file (like `modular_llama.py`). It visits the whole file, recording dependency,
then visits all imported modeling fil... |
class ModularFileMapper(ModuleMapper):
'''This is a Mapper to visit a modular file (like `modular_llama.py`). It visits the whole file, recording dependency,
then visits all imported modeling files (like `modeling_llama.py`), and manages their mutual dependencies.
Calling the method `create_modules()` afte... | 8 | 7 | 39 | 2 | 29 | 8 | 8 | 0.32 | 1 | 11 | 2 | 0 | 7 | 12 | 7 | 42 | 284 | 22 | 202 | 72 | 194 | 64 | 154 | 72 | 146 | 13 | 5 | 5 | 53 |
70 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/utils/modular_model_converter.py | modular_model_converter.ModuleMapper | from libcst.metadata import MetadataWrapper, ParentNodeProvider, PositionProvider, ScopeProvider
import re
from libcst import matchers as m
from libcst import ClassDef, CSTVisitor
from collections import Counter, defaultdict, deque
from abc import ABC, abstractmethod
import libcst as cst
class ModuleMapper(CSTVisitor,... |
class ModuleMapper(CSTVisitor, ABC):
'''An abstract visitor class which analyses a module, creating a mapping of dependencies for classes, functions and assignments.
Class dependencies are computed with `compute_class_dependencies()`, while function and assignment dependencies are stored in
`self.object_re... | 18 | 10 | 9 | 0 | 5 | 4 | 2 | 0.71 | 2 | 6 | 0 | 2 | 15 | 13 | 15 | 35 | 155 | 18 | 85 | 50 | 68 | 60 | 80 | 49 | 64 | 4 | 4 | 3 | 33 |
71 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/utils/modular_model_converter.py | modular_model_converter.ReplaceNameTransformer | import libcst as cst
import re
from libcst import matchers as m
class ReplaceNameTransformer(m.MatcherDecoratableTransformer):
"""A transformer that replaces `old_name` with `new_name` in comments, string and any references.
It should take into account name like `MyNewModel`, or `my_new_model`. Without using t... |
class ReplaceNameTransformer(m.MatcherDecoratableTransformer):
'''A transformer that replaces `old_name` with `new_name` in comments, string and any references.
It should take into account name like `MyNewModel`, or `my_new_model`. Without using the AUTO_MAPPING.
Supported renaming patterns:
- llam... | 7 | 2 | 7 | 0 | 7 | 1 | 2 | 0.34 | 1 | 3 | 0 | 0 | 5 | 7 | 5 | 5 | 51 | 5 | 35 | 18 | 28 | 12 | 28 | 17 | 22 | 2 | 1 | 1 | 8 |
72 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_multimodal2.py | modular_multimodal2.Multimodal2VisionAttention | from transformers.models.clip.modeling_clip import CLIPMLP, CLIPAttention, CLIPEncoder, CLIPEncoderLayer, CLIPPreTrainedModel, CLIPVisionModel, CLIPVisionTransformer
class Multimodal2VisionAttention(CLIPAttention):
pass |
class Multimodal2VisionAttention(CLIPAttention):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 | 0 | 0 | 0 | 13 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 2 | 0 | 0 |
73 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_multimodal2.py | modular_multimodal2.Multimodal2VisionEncoder | from torch import nn
from transformers.models.clip.modeling_clip import CLIPMLP, CLIPAttention, CLIPEncoder, CLIPEncoderLayer, CLIPPreTrainedModel, CLIPVisionModel, CLIPVisionTransformer
class Multimodal2VisionEncoder(CLIPEncoder):
def __init__(self, config):
super().__init__(config)
self.layers =... |
class Multimodal2VisionEncoder(CLIPEncoder):
def __init__(self, config):
pass | 2 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 3 | 1 | 0 | 1 | 1 | 1 | 13 | 4 | 0 | 4 | 3 | 2 | 0 | 4 | 3 | 2 | 1 | 2 | 0 | 1 |
74 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_multimodal2.py | modular_multimodal2.Multimodal2VisionEncoderLayer | from transformers.models.clip.modeling_clip import CLIPMLP, CLIPAttention, CLIPEncoder, CLIPEncoderLayer, CLIPPreTrainedModel, CLIPVisionModel, CLIPVisionTransformer
class Multimodal2VisionEncoderLayer(CLIPEncoderLayer):
def __init__(self, config):
super().__init__()
self.mlp = Multimodal2VisionML... |
class Multimodal2VisionEncoderLayer(CLIPEncoderLayer):
def __init__(self, config):
pass | 2 | 0 | 4 | 0 | 4 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 1 | 2 | 1 | 13 | 5 | 0 | 5 | 4 | 3 | 0 | 5 | 4 | 3 | 1 | 2 | 0 | 1 |
75 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_multimodal2.py | modular_multimodal2.Multimodal2VisionMLP | from transformers.models.clip.modeling_clip import CLIPMLP, CLIPAttention, CLIPEncoder, CLIPEncoderLayer, CLIPPreTrainedModel, CLIPVisionModel, CLIPVisionTransformer
class Multimodal2VisionMLP(CLIPMLP):
pass |
class Multimodal2VisionMLP(CLIPMLP):
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 |
76 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_multimodal2.py | modular_multimodal2.Multimodal2VisionModel | from transformers.utils import add_start_docstrings
from transformers.models.clip.modeling_clip import CLIPMLP, CLIPAttention, CLIPEncoder, CLIPEncoderLayer, CLIPPreTrainedModel, CLIPVisionModel, CLIPVisionTransformer
@add_start_docstrings('New doc', MULTIMODAL2_VISION_START_DOCSTRING)
class Multimodal2VisionModel(CLI... | @add_start_docstrings('New doc', MULTIMODAL2_VISION_START_DOCSTRING)
class Multimodal2VisionModel(CLIPVisionModel, Multimodal2VisionPreTrainedModel):
pass | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 2 | 0 | 2 | 2 | 1 | 0 | 2 | 2 | 1 | 0 | 3 | 0 | 0 |
77 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_multimodal2.py | modular_multimodal2.Multimodal2VisionPreTrainedModel | from transformers.models.clip.modeling_clip import CLIPMLP, CLIPAttention, CLIPEncoder, CLIPEncoderLayer, CLIPPreTrainedModel, CLIPVisionModel, CLIPVisionTransformer
class Multimodal2VisionPreTrainedModel(CLIPPreTrainedModel):
def _init_weights(self, module):
if isinstance(module, Multimodal2VisionMLP):
... |
class Multimodal2VisionPreTrainedModel(CLIPPreTrainedModel):
def _init_weights(self, module):
pass | 2 | 0 | 3 | 0 | 3 | 0 | 2 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 2 | 4 | 0 | 4 | 2 | 2 | 0 | 4 | 2 | 2 | 2 | 2 | 1 | 2 |
78 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_multimodal2.py | modular_multimodal2.Multimodal2VisionTransformer | from transformers.models.clip.modeling_clip import CLIPMLP, CLIPAttention, CLIPEncoder, CLIPEncoderLayer, CLIPPreTrainedModel, CLIPVisionModel, CLIPVisionTransformer
class Multimodal2VisionTransformer(CLIPVisionTransformer):
def __init__(self, config):
super().__init__(config)
self.encoder = Multi... |
class Multimodal2VisionTransformer(CLIPVisionTransformer):
def __init__(self, config):
pass | 2 | 0 | 3 | 0 | 3 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 1 | 1 | 1 | 13 | 4 | 0 | 4 | 3 | 2 | 0 | 4 | 3 | 2 | 1 | 2 | 0 | 1 |
79 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_my_new_model.py | modular_my_new_model.MyNewModelConfig | from transformers.models.llama.configuration_llama import LlamaConfig
class MyNewModelConfig(LlamaConfig):
"""
This is the configuration class to store the configuration of a [`MyNewModelModel`]. It is used to instantiate an MyNewModel
model according to the specified arguments, defining the model architec... |
class MyNewModelConfig(LlamaConfig):
'''
This is the configuration class to store the configuration of a [`MyNewModelModel`]. It is used to instantiate an MyNewModel
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a... | 2 | 1 | 4 | 0 | 4 | 0 | 1 | 0.8 | 1 | 1 | 0 | 0 | 1 | 2 | 1 | 2 | 10 | 1 | 5 | 4 | 3 | 4 | 5 | 4 | 3 | 1 | 2 | 0 | 1 |
80 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_my_new_model2.py | modular_my_new_model2.MyNewModel2Config | from transformers.models.llama.configuration_llama import LlamaConfig
class MyNewModel2Config(LlamaConfig):
"""
This is the configuration class to store the configuration of a [`GemmaModel`]. It is used to instantiate an Gemma
model according to the specified arguments, defining the model architecture. Ins... |
class MyNewModel2Config(LlamaConfig):
'''
This is the configuration class to store the configuration of a [`GemmaModel`]. It is used to instantiate an Gemma
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
defaults will yield a similar ... | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 20 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 21 | 0 | 1 | 1 | 0 | 20 | 1 | 1 | 0 | 0 | 2 | 0 | 0 |
81 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_my_new_model2.py | modular_my_new_model2.MyNewModel2ForSequenceClassification | from transformers.models.gemma.modeling_gemma import GemmaForSequenceClassification
class MyNewModel2ForSequenceClassification(GemmaForSequenceClassification):
pass |
class MyNewModel2ForSequenceClassification(GemmaForSequenceClassification):
pass | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 2 | 0 | 2 | 1 | 1 | 0 | 2 | 1 | 1 | 0 | 3 | 0 | 0 |
82 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_new_imgproc_model.py | modular_new_imgproc_model.ImgprocModelImageProcessor | import torch
from transformers.models.blip.image_processing_blip import BlipImageProcessor
import torch.utils.checkpoint
class ImgprocModelImageProcessor(BlipImageProcessor):
def new_image_processing_method(self, pixel_values: torch.FloatTensor):
return pixel_values / 2 |
class ImgprocModelImageProcessor(BlipImageProcessor):
def new_image_processing_method(self, pixel_values: torch.FloatTensor):
pass | 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 24 | 3 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 4 | 0 | 1 |
83 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_new_model.py | modular_new_model.NewModelConfig | from transformers.models.gemma.configuration_gemma import GemmaConfig
class NewModelConfig(GemmaConfig):
def __init__(self, vocab_size=256030, hidden_size=64, intermediate_size=90, num_hidden_layers=28, num_attention_heads=16, num_key_value_heads=16, head_dim=256, hidden_act='gelu_pytorch_tanh', hidden_activation... |
class NewModelConfig(GemmaConfig):
def __init__(self, vocab_size=256030, hidden_size=64, intermediate_size=90, num_hidden_layers=28, num_attention_heads=16, num_key_value_heads=16, head_dim=256, hidden_act='gelu_pytorch_tanh', hidden_activation=None, max_position_embeddings=1500, initializer_range=0.02, rms_norm_... | 4 | 0 | 14 | 0 | 14 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 2 | 0 | 2 | 3 | 30 | 1 | 29 | 27 | 2 | 0 | 5 | 3 | 2 | 1 | 2 | 0 | 2 |
84 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_new_task_model.py | modular_new_task_model.NewTaskModelForNewTask | import torch.utils.checkpoint
from typing import ClassVar, Optional, Union
import torch
from transformers.models.paligemma.modeling_paligemma import PaliGemmaForConditionalGeneration
from ...cache_utils import Cache
from torch import nn
class NewTaskModelForNewTask(PaliGemmaForConditionalGeneration):
main_input_na... |
class NewTaskModelForNewTask(PaliGemmaForConditionalGeneration):
def __init__(self, config):
pass
def forward(self, input_ids: torch.LongTensor=None, pixel_values: torch.FloatTensor=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_values: Opti... | 4 | 1 | 22 | 3 | 18 | 3 | 1 | 0.18 | 1 | 4 | 0 | 0 | 3 | 4 | 3 | 16 | 71 | 11 | 55 | 32 | 33 | 10 | 22 | 14 | 18 | 2 | 3 | 1 | 4 |
85 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_roberta.py | modular_roberta.RobertaEmbeddings | import torch.nn as nn
from transformers.models.bert.modeling_bert import BertEmbeddings, BertModel
class RobertaEmbeddings(BertEmbeddings):
def __init__(self, config):
super().__init__(config)
self.pad_token_id = config.pad_token_id
self.position_embeddings = nn.Embedding(config.max_positi... |
class RobertaEmbeddings(BertEmbeddings):
def __init__(self, config):
pass | 2 | 0 | 6 | 0 | 6 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 2 | 1 | 13 | 7 | 0 | 7 | 4 | 5 | 0 | 5 | 4 | 3 | 1 | 2 | 0 | 1 |
86 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_roberta.py | modular_roberta.RobertaModel | from transformers.models.bert.modeling_bert import BertEmbeddings, BertModel
class RobertaModel(BertModel):
def __init__(self, config, add_pooling_layer=True):
super().__init__(self, config) |
class RobertaModel(BertModel):
def __init__(self, config, add_pooling_layer=True):
pass | 2 | 0 | 2 | 0 | 2 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 7 | 3 | 0 | 3 | 2 | 1 | 0 | 3 | 2 | 1 | 1 | 3 | 0 | 1 |
87 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_super.py | modular_super.SuperModel | from typing import Optional, Union
from ...cache_utils import Cache
from transformers.modeling_outputs import CausalLMOutputWithPast
from transformers.models.llama.modeling_llama import LlamaModel
import torch
class SuperModel(LlamaModel):
def forward(self, input_ids: torch.LongTensor=None, attention_mask: Option... |
class SuperModel(LlamaModel):
def forward(self, input_ids: torch.LongTensor=None, attention_mask: Optional[torch.Tensor]=None, position_ids: Optional[torch.LongTensor]=None, past_key_values: Optional[Union[Cache, list[torch.FloatTensor]]]=None, inputs_embeds: Optional[torch.FloatTensor]=None, use_cache: Optional[... | 2 | 0 | 27 | 0 | 27 | 0 | 1 | 0 | 1 | 4 | 0 | 0 | 1 | 0 | 1 | 8 | 28 | 0 | 28 | 15 | 14 | 0 | 5 | 3 | 3 | 1 | 3 | 0 | 1 |
88 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/modular-transformers/modular_switch_function.py | modular_switch_function.SwitchFunctionAttention | from transformers.models.llama.modeling_llama import LlamaAttention
class SwitchFunctionAttention(LlamaAttention):
pass |
class SwitchFunctionAttention(LlamaAttention):
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 |
89 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/utils/notification_service.py | notification_service.Message | import re
import os
from typing import Any, Optional, Union
import json
import time
class Message:
def __init__(self, title: str, ci_title: str, model_results: dict, additional_results: dict, selected_warnings: Optional[list]=None, prev_ci_artifacts=None, other_ci_artifacts=None):
self.title = title
... |
class Message:
def __init__(self, title: str, ci_title: str, model_results: dict, additional_results: dict, selected_warnings: Optional[list]=None, prev_ci_artifacts=None, other_ci_artifacts=None):
pass
@property
def time(self) -> str:
pass
@property
def header(self) -> dict:
... | 32 | 1 | 37 | 5 | 29 | 2 | 6 | 0.07 | 0 | 9 | 0 | 1 | 16 | 20 | 18 | 18 | 722 | 121 | 564 | 178 | 524 | 38 | 355 | 156 | 335 | 17 | 0 | 5 | 107 |
90 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/legacy/benchmarking/plot_csv_file.py | plot_csv_file.Plot | import matplotlib.pyplot as plt
import numpy as np
import csv
from matplotlib.ticker import ScalarFormatter
from collections import defaultdict
class Plot:
def __init__(self, args):
self.args = args
self.result_dict = defaultdict(lambda: {'bsz': [], 'seq_len': [], 'result': {}})
with open(... |
class Plot:
def __init__(self, args):
pass
def plot(self):
pass | 3 | 0 | 42 | 7 | 33 | 3 | 9 | 0.07 | 0 | 5 | 0 | 0 | 2 | 2 | 2 | 2 | 85 | 14 | 67 | 22 | 64 | 5 | 46 | 21 | 43 | 13 | 0 | 3 | 17 |
91 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/legacy/benchmarking/plot_csv_file.py | plot_csv_file.PlotArguments | from dataclasses import dataclass, field
from typing import Optional
@dataclass
class PlotArguments:
"""
Arguments pertaining to which model/config/tokenizer we are going to fine-tune, or train from scratch.
"""
csv_file: str = field(metadata={'help': 'The csv file to plot.'})
plot_along_batch: boo... | @dataclass
class PlotArguments:
'''
Arguments pertaining to which model/config/tokenizer we are going to fine-tune, or train from scratch.
'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 33 | 1 | 29 | 8 | 28 | 3 | 8 | 8 | 7 | 0 | 0 | 0 | 0 |
92 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/pytorch/audio-classification/run_audio_classification.py | run_audio_classification.ModelArguments | from dataclasses import dataclass, field
import warnings
from typing import Optional
@dataclass
class ModelArguments:
"""
Arguments pertaining to which model/config/tokenizer we are going to fine-tune from.
"""
model_name_or_path: str = field(default='facebook/wav2vec2-base', metadata={'help': 'Path to... | @dataclass
class ModelArguments:
'''
Arguments pertaining to which model/config/tokenizer we are going to fine-tune from.
'''
def __post_init__(self):
pass | 3 | 1 | 14 | 0 | 14 | 0 | 3 | 0.05 | 0 | 2 | 0 | 0 | 1 | 0 | 1 | 1 | 69 | 2 | 64 | 13 | 62 | 3 | 17 | 13 | 15 | 3 | 0 | 1 | 3 |
93 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/pytorch/text-classification/run_classification.py | run_classification.DataTrainingArguments | from dataclasses import dataclass, field
from typing import Optional
@dataclass
class DataTrainingArguments:
"""
Arguments pertaining to what data we are going to input our model for training and eval.
Using `HfArgumentParser` we can turn this class
into argparse arguments to be able to specify them o... | @dataclass
class DataTrainingArguments:
'''
Arguments pertaining to what data we are going to input our model for training and eval.
Using `HfArgumentParser` we can turn this class
into argparse arguments to be able to specify them on
the command line.
'''
def __post_init__(self):
p... | 3 | 1 | 11 | 1 | 10 | 0 | 3 | 0.04 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 146 | 4 | 136 | 28 | 134 | 6 | 33 | 28 | 31 | 3 | 0 | 2 | 3 |
94 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/pytorch/contrastive-image-text/run_clip.py | run_clip.DataTrainingArguments | from typing import Optional
from dataclasses import dataclass, field
@dataclass
class DataTrainingArguments:
"""
Arguments pertaining to what data we are going to input our model for training and eval.
"""
dataset_name: Optional[str] = field(default=None, metadata={'help': 'The name of the dataset to u... | @dataclass
class DataTrainingArguments:
'''
Arguments pertaining to what data we are going to input our model for training and eval.
'''
def __post_init__(self):
pass | 3 | 1 | 10 | 0 | 10 | 0 | 4 | 0.04 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 72 | 2 | 67 | 15 | 65 | 3 | 22 | 15 | 20 | 4 | 0 | 2 | 4 |
95 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/pytorch/contrastive-image-text/run_clip.py | run_clip.ModelArguments | from dataclasses import dataclass, field
from typing import Optional
@dataclass
class ModelArguments:
"""
Arguments pertaining to which model/config/tokenizer we are going to fine-tune, or train from scratch.
"""
model_name_or_path: str = field(metadata={'help': 'Path to pretrained model or model ident... | @dataclass
class ModelArguments:
'''
Arguments pertaining to which model/config/tokenizer we are going to fine-tune, or train from scratch.
'''
pass | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0.06 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 51 | 1 | 47 | 12 | 46 | 3 | 12 | 12 | 11 | 0 | 0 | 0 | 0 |
96 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/pytorch/contrastive-image-text/run_clip.py | run_clip.Transform | import torch
from torchvision.transforms.functional import InterpolationMode
from torchvision.transforms import CenterCrop, ConvertImageDtype, Normalize, Resize
class Transform(torch.nn.Module):
def __init__(self, image_size, mean, std):
super().__init__()
self.transforms = torch.nn.Sequential(Res... |
class Transform(torch.nn.Module):
def __init__(self, image_size, mean, std):
pass
def forward(self, x) -> torch.Tensor:
'''`x` should be an instance of `PIL.Image.Image`'''
pass | 3 | 1 | 7 | 0 | 6 | 1 | 1 | 0.08 | 1 | 3 | 0 | 0 | 2 | 1 | 2 | 12 | 15 | 1 | 13 | 4 | 10 | 1 | 8 | 4 | 5 | 1 | 1 | 1 | 2 |
97 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/pytorch/language-modeling/run_clm.py | run_clm.DataTrainingArguments | from dataclasses import dataclass, field
from transformers.utils.versions import require_version
from typing import Optional
@dataclass
class DataTrainingArguments:
"""
Arguments pertaining to what data we are going to input our model for training and eval.
"""
dataset_name: Optional[str] = field(defau... | @dataclass
class DataTrainingArguments:
'''
Arguments pertaining to what data we are going to input our model for training and eval.
'''
def __post_init__(self):
pass | 3 | 1 | 13 | 1 | 12 | 0 | 5 | 0.04 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 75 | 3 | 69 | 15 | 67 | 3 | 24 | 15 | 22 | 5 | 0 | 2 | 5 |
98 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/pytorch/language-modeling/run_clm.py | run_clm.ModelArguments | from dataclasses import dataclass, field
from typing import Optional
@dataclass
class ModelArguments:
"""
Arguments pertaining to which model/config/tokenizer we are going to fine-tune, or train from scratch.
"""
model_name_or_path: Optional[str] = field(default=None, metadata={'help': "The model check... | @dataclass
class ModelArguments:
'''
Arguments pertaining to which model/config/tokenizer we are going to fine-tune, or train from scratch.
'''
def __post_init__(self):
pass | 3 | 1 | 5 | 0 | 5 | 0 | 2 | 0.04 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 88 | 2 | 83 | 14 | 81 | 3 | 16 | 14 | 14 | 2 | 0 | 1 | 2 |
99 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/examples/pytorch/language-modeling/run_fim.py | run_fim.DataTrainingArguments | from transformers.utils.versions import require_version
from dataclasses import dataclass, field
from typing import Optional
@dataclass
class DataTrainingArguments:
"""
Arguments pertaining to what data we are going to input our model for training and eval.
"""
dataset_name: Optional[str] = field(defau... | @dataclass
class DataTrainingArguments:
'''
Arguments pertaining to what data we are going to input our model for training and eval.
'''
def __post_init__(self):
pass | 3 | 1 | 13 | 1 | 12 | 0 | 5 | 0.02 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 127 | 3 | 121 | 22 | 119 | 3 | 31 | 22 | 29 | 5 | 0 | 2 | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.