Dataset Viewer
Auto-converted to Parquet Duplicate
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
End of preview. Expand in Data Studio

๐Ÿ“˜ Data Dictionary for the Curated Class-level Dataset

Field Description
id A unique identifier for each data point, starting from 0.
repository_name Name of the GitHub repository from which the class was extracted.
file_path Full path to the file containing the class within the repository.
class_name Name of the class defined in the corresponding file.
human_written_code Full source code of the human-written class, including all docstrings.
class_skeleton Extracted skeleton of the class, including class and method signatures along with associated docstrings (if present).
total_program_units Total number of program units (i.e., classes and methods) within the class skeleton.
total_doc_str Number of program units in the class skeleton that contain associated docstrings.
AvgCountLine Average number of lines per class.
AvgCountLineBlank Average number of blank lines per class.
AvgCountLineCode Average number of code lines per class (excluding comments and blanks).
AvgCountLineComment Average number of comment lines per class.
AvgCyclomatic Average cyclomatic complexity across methods in the class.
CommentToCodeRatio Ratio of comment lines to code lines in the class.
CountClassBase Number of base classes (i.e., direct superclasses).
CountClassCoupled Number of other classes referenced (coupled) by this class.
CountClassCoupledModified Number of coupled classes after removing standard library dependencies.
CountClassDerived Number of classes that inherit from this class.
CountDeclInstanceMethod Number of instance methods declared in the class.
CountDeclInstanceVariable Number of instance variables declared in the class.
CountDeclMethod Number of methods declared in the class (excluding inherited ones).
CountDeclMethodAll Total number of declared methods, including inherited ones.
CountLine Total number of lines in the class.
CountLineBlank Number of blank lines in the class.
CountLineCode Number of executable code lines in the class.
CountLineCodeDecl Number of declaration lines in the class.
CountLineCodeExe Number of executable statement lines in the class.
CountLineComment Number of comment lines in the class.
CountStmt Total number of statements in the class.
CountStmtDecl Number of declaration statements in the class.
CountStmtExe Number of executable statements in the class.
MaxCyclomatic Maximum cyclomatic complexity among all methods in the class.
MaxInheritanceTree Maximum depth of the class in the inheritance hierarchy.
MaxNesting Maximum level of nested control structures in the class.
SumCyclomatic Sum of cyclomatic complexity across all methods in the class.

If you use this dataset, please cite:

@article{rahman2025large,
  title={A Large-scale Class-level Benchmark Dataset for Code Generation with LLMs},
  author={Rahman, Musfiqur and Khatoonabadi, SayedHassan and Shihab, Emad},
  journal={arXiv preprint arXiv:2504.15564},
  year={2025}
}
Downloads last month
32

Paper for mrahman2025/OpenClassGen