pure-roberta-base / configuration_pure_roberta.py
yangwang825's picture
Upload config
008bba7 verified
from transformers import PretrainedConfig
from transformers.utils import logging
logger = logging.get_logger(__name__)
class PureRobertaConfig(PretrainedConfig):
model_type = "pure_roberta"
def __init__(
self,
vocab_size=50265,
hidden_size=768,
num_hidden_layers=12,
num_attention_heads=12,
intermediate_size=3072,
hidden_act="gelu",
hidden_dropout_prob=0.1,
attention_probs_dropout_prob=0.1,
max_position_embeddings=512,
type_vocab_size=2,
initializer_range=0.02,
layer_norm_eps=1e-12,
pad_token_id=1,
bos_token_id=0,
eos_token_id=2,
position_embedding_type="absolute",
use_cache=True,
classifier_dropout=None,
svd_rank=5, # A slightly overestimated rank of token embedding matrix
num_pc_to_remove=1, # Number of principal component to remove
center=False, # If True, centre the input token embedding matrix
num_iters=2, # Number of subspace iterations to conduct
alpha=1, # Feature expression factor in parameter-free self-attention module
disable_pcr=False,
disable_pfsa=False,
disable_covariance=True,
**kwargs,
):
super().__init__(pad_token_id=pad_token_id, bos_token_id=bos_token_id, eos_token_id=eos_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.hidden_act = hidden_act
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.type_vocab_size = type_vocab_size
self.initializer_range = initializer_range
self.layer_norm_eps = layer_norm_eps
self.position_embedding_type = position_embedding_type
self.use_cache = use_cache
self.classifier_dropout = classifier_dropout
self.svd_rank = svd_rank
self.num_pc_to_remove = num_pc_to_remove
self.center = center
self.num_iters = num_iters
self.alpha = alpha
self.disable_pcr = disable_pcr
self.disable_pfsa = disable_pfsa
self.disable_covariance = disable_covariance