A Large-scale Class-level Benchmark Dataset for Code Generation with LLMs
Paper • 2504.15564 • Published
id int64 0 328k | repository_name stringlengths 7 58 | file_path stringlengths 9 302 | class_name stringlengths 5 256 | gold_code stringlengths 16 2.16M | v3_prompt_text stringlengths 90 96.1k | v3_target_text stringlengths 8 2.16M | imports stringlengths 0 54.7k | class_docstring stringclasses 1
value | num_functions int64 0 800 | num_cross_deps int64 0 755 | parallelizable_bodies int64 0 384 | docstring_coverage float64 0 1 | parse_ok bool 1
class | parse_error stringclasses 1
value | source stringclasses 1
value | body_spans_json stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | huggingface/pytorch-pretrained-BERT | huggingface_pytorch-pretrained-BERT/benchmark/benchmarks_entrypoint.py | benchmark.benchmarks_entrypoint.ImportModuleException | class ImportModuleException(Exception):
pass | """Implement class ImportModuleException.
Required methods (implement on the class; order is not specified):
"""
class ImportModuleException: | pass
| 0 | 0 | 0 | 0 | true | mrahman2025/OpenClassGen | [] | |||
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.... | """Implement class MetricsRecorder.
Required methods (implement on the class; order is not specified):
- `__init__(self, connection, logger: logging.Logger, repository: str, branch: str, commit_id: str, commit_msg: str, collect_csv_data: bool=True)`
- `initialise_benchmark(self, metadata: dict[str, str])`: Creates a n... |
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.use_database = connection is not None
if self.use_database:
self.conn.autocommit = True
self.lo... | import pandas as pd
import os
from datetime import datetime
import uuid
import logging
import json | 8 | 2 | 6 | 0.625 | true | mrahman2025/OpenClassGen | [] | ||
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... | """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 similar configuration to that of the MyNewModel-7B.
e.... | """
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 similar configuration to that of the ... | from ...modeling_rope_utils import rope_config_validation
from ...configuration_utils import PretrainedConfig | 1 | 0 | 1 | 0 | true | mrahman2025/OpenClassGen | [] | ||
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... | """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 configuration to that of the Gemma-7B.
e.g. [google/gemm... | """
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 configuration to that of the Gemma-7B.
... | from ...modeling_rope_utils import rope_config_validation
from ...configuration_utils import PretrainedConfig | 1 | 0 | 1 | 0 | true | mrahman2025/OpenClassGen | [] | ||
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... | """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 similar configuration to that of the NewModel-7B.
e.g. [go... | """
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 similar configuration to that of the NewM... | from ...configuration_utils import PretrainedConfig | 2 | 0 | 2 | 0 | true | mrahman2025/OpenClassGen | [] | ||
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) | """Implement class CustomOutputChecker.
Required methods (implement on the class; order is not specified):
- `check_output(self, want, got, optionflags)`"""
class CustomOutputChecker: |
def check_output(self, want, got, optionflags):
if IGNORE_RESULT & optionflags:
return True
return OutputChecker.check_output(self, want, got, optionflags)
| 1 | 0 | 1 | 0 | true | mrahman2025/OpenClassGen | [] | |||
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... | """Implement class CircleCIJob.
Required methods (implement on the class; order is not specified):
- `__post_init__(self)`
- `to_dict(self)`
- `job_name(self)`"""
import copy
from typing import Any, Optional
from dataclasses import dataclass
import os
class CircleCIJob: | 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] = 0
pytest_num_workers: int = 8
pytest_options: dict[str, Any] = None
resource_class: O... | import copy
from typing import Any, Optional
from dataclasses import dataclass
import os | 3 | 0 | 3 | 0 | true | mrahman2025/OpenClassGen | [] | ||
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... | """Implement class EmptyJob.
Required methods (implement on the class; order is not specified):
- `to_dict(self)`"""
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/workflow/$CIRCLE_WORKFLOW_ID/job"... | import copy | 1 | 0 | 1 | 0 | true | mrahman2025/OpenClassGen | [] | ||
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... | """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_resize` parameter in the `preprocess` method.
size (`dict`, *optional*, default... | """
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_resize` parameter in the `preprocess` method.
size... | 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... | 4 | 1 | 3 | 0.5 | true | mrahman2025/OpenClassGen | [] | ||
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... | """Implement class BaseTransformer.
Required methods (implement on the class; order is not specified):
- `__init__(self, hparams: argparse.Namespace, num_labels=None, mode='base', config=None, tokenizer=None, model=None, **config_kwargs)`: Initialize a model, tokenizer and config.
- `load_hf_checkpoint(self, *args, **... |
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."""
super().__init__()
self.save_hyperparameters(hparams)
self.step_count = 0
self.output_dir ... | 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... | 15 | 7 | 7 | 0.2 | true | mrahman2025/OpenClassGen | [] | ||
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... | """Implement class LoggingCallback.
Required methods (implement on the class; order is not specified):
- `on_batch_end(self, trainer, pl_module)`
- `on_validation_end(self, trainer: pl.Trainer, pl_module: pl.LightningModule)`
- `on_test_end(self, trainer: pl.Trainer, pl_module: pl.LightningModule)`"""
import pytorch_l... |
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())}
pl_module.logger.log_metrics(lrs)
def on_validation_end(self, trainer: pl.Trainer, pl_module: pl.LightningModule):
... | import pytorch_lightning as pl
import os
from pytorch_lightning.utilities import rank_zero_info | 3 | 0 | 3 | 0 | true | mrahman2025/OpenClassGen | [] | ||
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... | """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 dimension here is attention_hidden_size = 2 * hidden_siz... | """
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 dimension here is attention_hidden_... | from ...utils.deprecation import deprecate_kwarg
import torch
from torch import nn
from typing import Optional | 2 | 0 | 2 | 0 | true | mrahman2025/OpenClassGen | [] | ||
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... | """Implement class DummyBertAttention.
Required methods (implement on the class; order is not specified):
- `__init__(self, config, position_embedding_type=None, layer_idx=None)`
- `prune_heads(self, heads)`
- `forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Opti... |
def __init__(self, config, position_embedding_type=None, layer_idx=None):
super().__init__()
self.self = DUMMY_BERT_SELF_ATTENTION_CLASSES[config._attn_implementation](config, position_embedding_type=position_embedding_type, layer_idx=layer_idx)
self.output = DummyBertSelfOutput(config)
... | 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 | 3 | 0 | 2 | 0 | true | mrahman2025/OpenClassGen | [] | ||
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.... | """Construct the embeddings from word, position and token_type embeddings.
Required methods (implement on the class; order is not specified):
- `__init__(self, config)`
- `forward(self, input_ids: Optional[torch.LongTensor]=None, token_type_ids: Optional[torch.LongTensor]=None, position_ids: Optional[torch.LongTensor]... | """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.hidden_size, padding_idx=config.pad_token_id)
self.position_embeddings = nn.Embedding(config.max_pos... | import torch
from torch import nn
from typing import Optional, Union | 2 | 0 | 0 | 0 | true | mrahman2025/OpenClassGen | [] | ||
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... | """Implement class DummyBertEncoder.
Required methods (implement on the class; order is not specified):
- `__init__(self, config, layer_idx=None)`
- `forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional... |
def __init__(self, config, layer_idx=None):
super().__init__()
self.config = config
self.layer = nn.ModuleList([DummyBertLayer(config, layer_idx=i) for i in range(config.num_hidden_layers)])
self.gradient_checkpointing = False
def forward(self, hidden_states: torch.Tensor, atte... | from ...cache_utils import Cache, DynamicCache, EncoderDecoderCache
from typing import Optional, Union
from torch import nn
from ...modeling_outputs import BaseModelOutputWithPastAndCrossAttentions, BaseModelOutputWithPoolingAndCrossAttentions
import torch | 2 | 0 | 2 | 0 | true | mrahman2025/OpenClassGen | [] | ||
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... | """Implement class DummyBertIntermediate.
Required methods (implement on the class; order is not specified):
- `__init__(self, config)`
- `forward(self, hidden_states: torch.Tensor)`"""
import torch
from torch import nn
from ...activations import ACT2FN
class DummyBertIntermediate: |
def __init__(self, config):
super().__init__()
self.dense = nn.Linear(config.hidden_size, config.intermediate_size)
if isinstance(config.hidden_act, str):
self.intermediate_act_fn = ACT2FN[config.hidden_act]
else:
self.intermediate_act_fn = config.hidden_act
... | import torch
from torch import nn
from ...activations import ACT2FN | 2 | 0 | 1 | 0 | true | mrahman2025/OpenClassGen | [] | ||
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... | """Implement class DummyBertLayer.
Required methods (implement on the class; order is not specified):
- `__init__(self, config, layer_idx=None)`
- `forward(self, hidden_states: torch.Tensor, attention_mask: Optional[torch.FloatTensor]=None, head_mask: Optional[torch.FloatTensor]=None, encoder_hidden_states: Optional[t... |
def __init__(self, config, layer_idx=None):
super().__init__()
self.chunk_size_feed_forward = config.chunk_size_feed_forward
self.seq_len_dim = 1
self.attention = DummyBertAttention(config, layer_idx=layer_idx)
self.is_decoder = config.is_decoder
self.add_cross_atten... | 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... | 3 | 0 | 1 | 0 | true | mrahman2025/OpenClassGen | [] |
Derived from mrahman2025/OpenClassGen (Rahman et al. 2025, arXiv:2504.15564).
License: CC BY 2.0 (same as upstream). Keep repository_name and file_path when redistributing.
Underlying GitHub repos may carry additional software licenses.
gold_code is upstream human_written_code.
We add parsed fields, body-span indices, and a Variant-3 prompt/target pair (v3_prompt_text / v3_target_text).
No unit tests. Splits are repository-disjoint (train / validation).
| Field | Meaning |
|---|---|
id |
Upstream OpenClassGen id. |
repository_name |
GitHub org/repo. Split key. |
file_path |
Path inside the repo. |
class_name |
Class name (may be qualified). |
gold_code |
Gold class source (human_written_code). |
imports |
Imports parsed from gold (may be empty). |
class_docstring |
Class docstring from gold, if any. |
v3_prompt_text |
Prompt ending at class ClassName:: module docstring lists required methods (unordered); no method defs / no pass. |
v3_target_text |
Indented class body. v3_prompt_text + v3_target_text is a full file. |
body_spans_json |
JSON list of {name, start_char, end_char} over gold_code for method bodies. |
num_functions |
Method count. |
num_cross_deps |
Cross-method / field dependency edge count. |
parallelizable_bodies |
Count of mutually independent method bodies. |
docstring_coverage |
Fraction of methods with a docstring. |
parse_ok |
Gold / v3 render parsed during build. |
parse_error |
Error string if not parse_ok; else empty. |
source |
Always mrahman2025/OpenClassGen. |