|
from transformers.configuration_utils import PretrainedConfig
|
|
from transformers.utils import logging
|
|
|
|
|
|
logger = logging.get_logger(__name__)
|
|
|
|
|
|
class FastEsmConfig(PretrainedConfig):
|
|
model_type = "fast_esm"
|
|
|
|
def __init__(
|
|
self,
|
|
vocab_size=None,
|
|
mask_token_id=None,
|
|
pad_token_id=None,
|
|
hidden_size=768,
|
|
num_hidden_layers=12,
|
|
num_attention_heads=12,
|
|
intermediate_size=3072,
|
|
hidden_dropout_prob=0.1,
|
|
attention_probs_dropout_prob=0.1,
|
|
max_position_embeddings=1026,
|
|
initializer_range=0.02,
|
|
layer_norm_eps=1e-12,
|
|
position_embedding_type="absolute",
|
|
emb_layer_norm_before=None,
|
|
**kwargs,
|
|
):
|
|
super().__init__(pad_token_id=pad_token_id, mask_token_id=mask_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.initializer_range = initializer_range
|
|
self.layer_norm_eps = layer_norm_eps
|
|
self.position_embedding_type = position_embedding_type
|
|
self.emb_layer_norm_before = emb_layer_norm_before
|
|
|
|
def to_dict(self):
|
|
"""
|
|
Serializes this instance to a Python dictionary. Override the default [`~PretrainedConfig.to_dict`].
|
|
|
|
Returns:
|
|
`Dict[str, any]`: Dictionary of all the attributes that make up this configuration instance,
|
|
"""
|
|
output = super().to_dict()
|
|
return output
|
|
|
|
|
|
def get_default_vocab_list():
|
|
return (
|
|
"<cls>",
|
|
"<pad>",
|
|
"<eos>",
|
|
"<unk>",
|
|
"L",
|
|
"A",
|
|
"G",
|
|
"V",
|
|
"S",
|
|
"E",
|
|
"R",
|
|
"T",
|
|
"I",
|
|
"D",
|
|
"P",
|
|
"K",
|
|
"Q",
|
|
"N",
|
|
"F",
|
|
"Y",
|
|
"M",
|
|
"H",
|
|
"W",
|
|
"C",
|
|
"X",
|
|
"B",
|
|
"U",
|
|
"Z",
|
|
"O",
|
|
".",
|
|
"-",
|
|
"<null_1>",
|
|
"<mask>",
|
|
)
|
|
|