Update configuration_footballbert.py
Browse files- configuration_footballbert.py +79 -79
configuration_footballbert.py
CHANGED
|
@@ -1,80 +1,80 @@
|
|
| 1 |
-
"""FootballBERT Configuration"""
|
| 2 |
-
|
| 3 |
-
from transformers import PretrainedConfig
|
| 4 |
-
|
| 5 |
-
class FootballBERTConfig(PretrainedConfig):
|
| 6 |
-
"""
|
| 7 |
-
Configuration class for FootballBERT models.
|
| 8 |
-
|
| 9 |
-
FootballBERT treats players as tokens and matches as sentences, learning
|
| 10 |
-
contextual embeddings for football players through masked player prediction.
|
| 11 |
-
|
| 12 |
-
Args:
|
| 13 |
-
vocab_size (`int`, *optional*, defaults to 99944):
|
| 14 |
-
Vocabulary size of the FootballBERT model (number of unique players).
|
| 15 |
-
hidden_size (`int`, *optional*, defaults to 256):
|
| 16 |
-
Dimensionality of the encoder layers and the pooler layer.
|
| 17 |
-
num_hidden_layers (`int`, *optional*, defaults to 6):
|
| 18 |
-
Number of hidden layers in the Transformer encoder.
|
| 19 |
-
num_attention_heads (`int`, *optional*, defaults to 1):
|
| 20 |
-
Number of attention heads for each attention layer in the Transformer encoder.
|
| 21 |
-
intermediate_size (`int`, *optional*, defaults to 1024):
|
| 22 |
-
Dimensionality of the "intermediate" (often named feed-forward) layer in the Transformer encoder.
|
| 23 |
-
hidden_dropout_prob (`float`, *optional*, defaults to 0.05):
|
| 24 |
-
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
|
| 25 |
-
max_position_embeddings (`int`, *optional*, defaults to
|
| 26 |
-
The maximum sequence length (2 teams *
|
| 27 |
-
num_positions (`int`, *optional*, defaults to 1419):
|
| 28 |
-
Number of unique position labels.
|
| 29 |
-
num_seasons (`int`, *optional*, defaults to 23):
|
| 30 |
-
Number of unique seasons in the dataset.
|
| 31 |
-
pad_token_id (`int`, *optional*, defaults to 99944):
|
| 32 |
-
The id of the padding token.
|
| 33 |
-
mask_token_id (`int`, *optional*, defaults to 99943):
|
| 34 |
-
The id of the mask token.
|
| 35 |
-
position_pad_token_id (`int`, *optional*, defaults to 1419):
|
| 36 |
-
The id of the padding token for positions.
|
| 37 |
-
season_pad_token_id (`int`, *optional*, defaults to 23):
|
| 38 |
-
The id of the padding token for seasons.
|
| 39 |
-
"""
|
| 40 |
-
|
| 41 |
-
model_type = "footballbert"
|
| 42 |
-
|
| 43 |
-
def __init__(
|
| 44 |
-
self,
|
| 45 |
-
vocab_size: int = 99944,
|
| 46 |
-
hidden_size: int = 256,
|
| 47 |
-
num_hidden_layers: int = 6,
|
| 48 |
-
num_attention_heads: int = 1,
|
| 49 |
-
intermediate_size: int = 1024,
|
| 50 |
-
hidden_dropout_prob: float = 0.05,
|
| 51 |
-
max_position_embeddings: int =
|
| 52 |
-
num_positions: int = 1419,
|
| 53 |
-
num_seasons: int = 23,
|
| 54 |
-
pad_token_id: int = 99944,
|
| 55 |
-
mask_token_id: int = 99943,
|
| 56 |
-
position_pad_token_id: int = 1419,
|
| 57 |
-
season_pad_token_id: int = 23,
|
| 58 |
-
**kwargs
|
| 59 |
-
):
|
| 60 |
-
super().__init__(pad_token_id=pad_token_id, **kwargs)
|
| 61 |
-
|
| 62 |
-
self.vocab_size = vocab_size
|
| 63 |
-
self.hidden_size = hidden_size
|
| 64 |
-
self.num_hidden_layers = num_hidden_layers
|
| 65 |
-
self.num_attention_heads = num_attention_heads
|
| 66 |
-
self.intermediate_size = intermediate_size
|
| 67 |
-
self.hidden_dropout_prob = hidden_dropout_prob
|
| 68 |
-
self.max_position_embeddings = max_position_embeddings
|
| 69 |
-
self.num_positions = num_positions
|
| 70 |
-
self.num_seasons = num_seasons
|
| 71 |
-
self.mask_token_id = mask_token_id
|
| 72 |
-
self.position_pad_token_id = position_pad_token_id
|
| 73 |
-
self.season_pad_token_id = season_pad_token_id
|
| 74 |
-
|
| 75 |
-
# auto mapping for model
|
| 76 |
-
self.auto_map = {
|
| 77 |
-
"AutoConfig": "configuration_footballbert.FootballBERTConfig",
|
| 78 |
-
"AutoModel": "modeling_footballbert.FootballBERTModel",
|
| 79 |
-
"AutoModelForMaskedLM": "modeling_footballbert.FootballBERTForMaskedPlayerPrediction",
|
| 80 |
}
|
|
|
|
| 1 |
+
"""FootballBERT Configuration"""
|
| 2 |
+
|
| 3 |
+
from transformers import PretrainedConfig
|
| 4 |
+
|
| 5 |
+
class FootballBERTConfig(PretrainedConfig):
|
| 6 |
+
"""
|
| 7 |
+
Configuration class for FootballBERT models.
|
| 8 |
+
|
| 9 |
+
FootballBERT treats players as tokens and matches as sentences, learning
|
| 10 |
+
contextual embeddings for football players through masked player prediction.
|
| 11 |
+
|
| 12 |
+
Args:
|
| 13 |
+
vocab_size (`int`, *optional*, defaults to 99944):
|
| 14 |
+
Vocabulary size of the FootballBERT model (number of unique players).
|
| 15 |
+
hidden_size (`int`, *optional*, defaults to 256):
|
| 16 |
+
Dimensionality of the encoder layers and the pooler layer.
|
| 17 |
+
num_hidden_layers (`int`, *optional*, defaults to 6):
|
| 18 |
+
Number of hidden layers in the Transformer encoder.
|
| 19 |
+
num_attention_heads (`int`, *optional*, defaults to 1):
|
| 20 |
+
Number of attention heads for each attention layer in the Transformer encoder.
|
| 21 |
+
intermediate_size (`int`, *optional*, defaults to 1024):
|
| 22 |
+
Dimensionality of the "intermediate" (often named feed-forward) layer in the Transformer encoder.
|
| 23 |
+
hidden_dropout_prob (`float`, *optional*, defaults to 0.05):
|
| 24 |
+
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
|
| 25 |
+
max_position_embeddings (`int`, *optional*, defaults to 32):
|
| 26 |
+
The maximum sequence length (2 teams * 16 players max).
|
| 27 |
+
num_positions (`int`, *optional*, defaults to 1419):
|
| 28 |
+
Number of unique position labels.
|
| 29 |
+
num_seasons (`int`, *optional*, defaults to 23):
|
| 30 |
+
Number of unique seasons in the dataset.
|
| 31 |
+
pad_token_id (`int`, *optional*, defaults to 99944):
|
| 32 |
+
The id of the padding token.
|
| 33 |
+
mask_token_id (`int`, *optional*, defaults to 99943):
|
| 34 |
+
The id of the mask token.
|
| 35 |
+
position_pad_token_id (`int`, *optional*, defaults to 1419):
|
| 36 |
+
The id of the padding token for positions.
|
| 37 |
+
season_pad_token_id (`int`, *optional*, defaults to 23):
|
| 38 |
+
The id of the padding token for seasons.
|
| 39 |
+
"""
|
| 40 |
+
|
| 41 |
+
model_type = "footballbert"
|
| 42 |
+
|
| 43 |
+
def __init__(
|
| 44 |
+
self,
|
| 45 |
+
vocab_size: int = 99944,
|
| 46 |
+
hidden_size: int = 256,
|
| 47 |
+
num_hidden_layers: int = 6,
|
| 48 |
+
num_attention_heads: int = 1,
|
| 49 |
+
intermediate_size: int = 1024,
|
| 50 |
+
hidden_dropout_prob: float = 0.05,
|
| 51 |
+
max_position_embeddings: int = 32,
|
| 52 |
+
num_positions: int = 1419,
|
| 53 |
+
num_seasons: int = 23,
|
| 54 |
+
pad_token_id: int = 99944,
|
| 55 |
+
mask_token_id: int = 99943,
|
| 56 |
+
position_pad_token_id: int = 1419,
|
| 57 |
+
season_pad_token_id: int = 23,
|
| 58 |
+
**kwargs
|
| 59 |
+
):
|
| 60 |
+
super().__init__(pad_token_id=pad_token_id, **kwargs)
|
| 61 |
+
|
| 62 |
+
self.vocab_size = vocab_size
|
| 63 |
+
self.hidden_size = hidden_size
|
| 64 |
+
self.num_hidden_layers = num_hidden_layers
|
| 65 |
+
self.num_attention_heads = num_attention_heads
|
| 66 |
+
self.intermediate_size = intermediate_size
|
| 67 |
+
self.hidden_dropout_prob = hidden_dropout_prob
|
| 68 |
+
self.max_position_embeddings = max_position_embeddings
|
| 69 |
+
self.num_positions = num_positions
|
| 70 |
+
self.num_seasons = num_seasons
|
| 71 |
+
self.mask_token_id = mask_token_id
|
| 72 |
+
self.position_pad_token_id = position_pad_token_id
|
| 73 |
+
self.season_pad_token_id = season_pad_token_id
|
| 74 |
+
|
| 75 |
+
# auto mapping for model
|
| 76 |
+
self.auto_map = {
|
| 77 |
+
"AutoConfig": "configuration_footballbert.FootballBERTConfig",
|
| 78 |
+
"AutoModel": "modeling_footballbert.FootballBERTModel",
|
| 79 |
+
"AutoModelForMaskedLM": "modeling_footballbert.FootballBERTForMaskedPlayerPrediction",
|
| 80 |
}
|