File size: 1,509 Bytes
5af7e8d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
42
43
44
45
from transformers import BertConfig


class PunctuationBertConfig(BertConfig):
    r"""
    This is the configuration class to store the configuration of a [`PunctuationBertConfig`]. It is based on BERT config
     to the specified arguments, defining the model architecture.
     Args:
        backward_context (`int`, *optional*, defaults to 15):
            size of backward context window
        forward_context (`int`, *optional*, defaults to 16):
            size of forward context window
        output_size (`int`, *optional*, defaults to 4):
            number of punctuation classes
        dropout (`float`, *optional*, defaults to 0.3):
            dropout rate

    Examples:
        ```python
    >>> from transformers import BertConfig, BertModel

    >>> # Initializing a BERT google-bert/bert-base-uncased style configuration
    >>> configuration = PunctuationBertConfig()

    >>> # Initializing a model (with random weights) from the google-bert/bert-base-uncased style configuration
    >>> model = BertForPunctuation(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```"""

    def __init__(
        self,
        backward_context=15,
        forward_context=16,
        output_size=4,
        dropout=0.3,
        **kwargs,
    ):
        super().__init__(**kwargs)
        self.backward_context = backward_context
        self.forward_context = forward_context
        self.output_size = output_size
        self.dropout = dropout