File size: 1,435 Bytes
967e04b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""MagicBERT configuration for HuggingFace transformers."""

from transformers import PretrainedConfig


class MagicBERTConfig(PretrainedConfig):
    """Configuration class for MagicBERT model.

    MagicBERT is a BERT-style transformer model designed for binary file
    type classification. It uses a byte-level BPE tokenizer with a 32K vocabulary.
    """

    model_type = "magic-bert"

    def __init__(
        self,
        vocab_size: int = 32768,
        hidden_size: int = 512,
        num_hidden_layers: int = 8,
        num_attention_heads: int = 8,
        intermediate_size: int = 2048,
        hidden_dropout_prob: float = 0.1,
        attention_probs_dropout_prob: float = 0.1,
        max_position_embeddings: int = 512,
        pad_token_id: int = 2,
        hidden_act: str = "gelu",
        layer_norm_eps: float = 1e-12,
        **kwargs,
    ):
        super().__init__(pad_token_id=pad_token_id, **kwargs)
        self.vocab_size = vocab_size
        self.hidden_size = hidden_size
        self.num_hidden_layers = num_hidden_layers
        self.num_attention_heads = num_attention_heads
        self.intermediate_size = intermediate_size
        self.hidden_dropout_prob = hidden_dropout_prob
        self.attention_probs_dropout_prob = attention_probs_dropout_prob
        self.max_position_embeddings = max_position_embeddings
        self.hidden_act = hidden_act
        self.layer_norm_eps = layer_norm_eps