stackifiers-repo / configuration_stackifiers.py
Machacini's picture
Publish verified mmbert-small full-finetune checkpoint, loader and evaluation card
aa142c2 verified
Raw History Blame Contribute Delete
1.45 kB
"""Configuration for the Stackifiers five-score repository regressor."""
from transformers import PretrainedConfig
METRICS = ('pretraining_value', 'repo_quality', 'coding_standard', 'difficulty', 'educational_value')
class StackifiersConfig(PretrainedConfig):
model_type = 'stackifiers_repo'
def __init__(self, backbone_config=None, max_length=8192, head_dropout=0.1,
metrics=None, variant=None, **kwargs):
metrics = list(METRICS if metrics is None else metrics)
if metrics != list(METRICS):
raise ValueError('The five trained score names and their order must be preserved')
for key in ('num_labels', 'problem_type', 'id2label', 'label2id'):
kwargs.pop(key, None)
super().__init__(num_labels=len(metrics), problem_type='regression',
id2label=dict(enumerate(metrics)),
label2id={name: i for i, name in enumerate(metrics)}, **kwargs)
self.backbone_config = dict(backbone_config or {'model_type': 'modernbert'})
self.max_length = max_length
self.head_dropout = head_dropout
self.metrics = metrics
self.variant = variant
self.score_range = [0.0, 5.0]
self.pooling = 'attention-mask-weighted token mean, including special tokens'
self.chunk_aggregation = 'content-token-weighted mean before the scoring head'
StackifiersConfig.register_for_auto_class()