File size: 543 Bytes
838f544
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
"""InDIM configuration: ModernBERT with a factorized (ALBERT-style) word embedding.

InDIM-small (32M) keeps a 128,064 x 128 word table and projects it to the 384-wide encoder; the masked-LM output
layer reuses the same table (tied). Everything else is the ModernBERT encoder as in `transformers`.
"""
from transformers import ModernBertConfig


class InDIMConfig(ModernBertConfig):
    model_type = "indim"

    def __init__(self, embedding_rank=128, **kwargs):
        super().__init__(**kwargs)
        self.embedding_rank = embedding_rank