whenxuan: update the model type for config
Browse files- configuration_symtime.py +64 -64
configuration_symtime.py
CHANGED
|
@@ -1,64 +1,64 @@
|
|
| 1 |
-
from dataclasses import dataclass
|
| 2 |
-
from typing import List, Literal, Optional, Dict
|
| 3 |
-
from enum import Enum
|
| 4 |
-
|
| 5 |
-
from transformers.configuration_utils import PretrainedConfig
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
@dataclass
|
| 9 |
-
class SymTimeConfig(PretrainedConfig):
|
| 10 |
-
"""
|
| 11 |
-
Time series encoder configuration for SymTime Model.
|
| 12 |
-
|
| 13 |
-
Parameters
|
| 14 |
-
-----------
|
| 15 |
-
patch_size
|
| 16 |
-
The size of the patch to be used for the input data.
|
| 17 |
-
num_layers
|
| 18 |
-
The number of layers to be used for the encoder.
|
| 19 |
-
d_model
|
| 20 |
-
The dimension of the model.
|
| 21 |
-
d_ff
|
| 22 |
-
The dimension of the feedforward network.
|
| 23 |
-
num_heads
|
| 24 |
-
The number of heads to be used for the attention mechanism.
|
| 25 |
-
norm
|
| 26 |
-
The normalization to be used for the encoder.
|
| 27 |
-
attn_dropout
|
| 28 |
-
The dropout rate to be used for the attention mechanism.
|
| 29 |
-
dropout
|
| 30 |
-
The dropout rate to be used for the encoder.
|
| 31 |
-
act
|
| 32 |
-
The activation function to be used for the encoder.
|
| 33 |
-
pre_norm
|
| 34 |
-
Whether to use pre-norm for the encoder.
|
| 35 |
-
"""
|
| 36 |
-
|
| 37 |
-
model_type = "
|
| 38 |
-
|
| 39 |
-
def __init__(
|
| 40 |
-
self,
|
| 41 |
-
patch_size: int = 16,
|
| 42 |
-
num_layers: int = 6,
|
| 43 |
-
d_model: int = 512,
|
| 44 |
-
d_ff: int = 2048,
|
| 45 |
-
num_heads: int = 8,
|
| 46 |
-
norm: str = "BatchNorm",
|
| 47 |
-
dropout: float = 0.1,
|
| 48 |
-
act: str = "gelu",
|
| 49 |
-
pre_norm: bool = False,
|
| 50 |
-
initializer_factor: float = 0.05,
|
| 51 |
-
**kwargs,
|
| 52 |
-
) -> None:
|
| 53 |
-
self.patch_size = patch_size
|
| 54 |
-
self.num_layers = num_layers
|
| 55 |
-
self.d_model = d_model
|
| 56 |
-
self.num_heads = num_heads
|
| 57 |
-
self.d_ff = d_ff
|
| 58 |
-
self.norm = norm
|
| 59 |
-
self.dropout = dropout
|
| 60 |
-
self.act = act
|
| 61 |
-
self.pre_norm = pre_norm
|
| 62 |
-
self.initializer_factor = initializer_factor
|
| 63 |
-
|
| 64 |
-
super().__init__(**kwargs)
|
|
|
|
| 1 |
+
from dataclasses import dataclass
|
| 2 |
+
from typing import List, Literal, Optional, Dict
|
| 3 |
+
from enum import Enum
|
| 4 |
+
|
| 5 |
+
from transformers.configuration_utils import PretrainedConfig
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
@dataclass
|
| 9 |
+
class SymTimeConfig(PretrainedConfig):
|
| 10 |
+
"""
|
| 11 |
+
Time series encoder configuration for SymTime Model.
|
| 12 |
+
|
| 13 |
+
Parameters
|
| 14 |
+
-----------
|
| 15 |
+
patch_size
|
| 16 |
+
The size of the patch to be used for the input data.
|
| 17 |
+
num_layers
|
| 18 |
+
The number of layers to be used for the encoder.
|
| 19 |
+
d_model
|
| 20 |
+
The dimension of the model.
|
| 21 |
+
d_ff
|
| 22 |
+
The dimension of the feedforward network.
|
| 23 |
+
num_heads
|
| 24 |
+
The number of heads to be used for the attention mechanism.
|
| 25 |
+
norm
|
| 26 |
+
The normalization to be used for the encoder.
|
| 27 |
+
attn_dropout
|
| 28 |
+
The dropout rate to be used for the attention mechanism.
|
| 29 |
+
dropout
|
| 30 |
+
The dropout rate to be used for the encoder.
|
| 31 |
+
act
|
| 32 |
+
The activation function to be used for the encoder.
|
| 33 |
+
pre_norm
|
| 34 |
+
Whether to use pre-norm for the encoder.
|
| 35 |
+
"""
|
| 36 |
+
|
| 37 |
+
model_type = "symtime"
|
| 38 |
+
|
| 39 |
+
def __init__(
|
| 40 |
+
self,
|
| 41 |
+
patch_size: int = 16,
|
| 42 |
+
num_layers: int = 6,
|
| 43 |
+
d_model: int = 512,
|
| 44 |
+
d_ff: int = 2048,
|
| 45 |
+
num_heads: int = 8,
|
| 46 |
+
norm: str = "BatchNorm",
|
| 47 |
+
dropout: float = 0.1,
|
| 48 |
+
act: str = "gelu",
|
| 49 |
+
pre_norm: bool = False,
|
| 50 |
+
initializer_factor: float = 0.05,
|
| 51 |
+
**kwargs,
|
| 52 |
+
) -> None:
|
| 53 |
+
self.patch_size = patch_size
|
| 54 |
+
self.num_layers = num_layers
|
| 55 |
+
self.d_model = d_model
|
| 56 |
+
self.num_heads = num_heads
|
| 57 |
+
self.d_ff = d_ff
|
| 58 |
+
self.norm = norm
|
| 59 |
+
self.dropout = dropout
|
| 60 |
+
self.act = act
|
| 61 |
+
self.pre_norm = pre_norm
|
| 62 |
+
self.initializer_factor = initializer_factor
|
| 63 |
+
|
| 64 |
+
super().__init__(**kwargs)
|