summaryrefslogtreecommitdiff
path: root/training/conf/network/conv_transformer.yaml
blob: 016adbb31c907050906ee61b2fd50ae14f8ce84b (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
_target_: text_recognizer.networks.ConvTransformer
encoder:
  _target_: text_recognizer.networks.image_encoder.ImageEncoder
  encoder:
    _target_: text_recognizer.networks.convnext.ConvNext
    dim: 16
    dim_mults: [2, 4, 8]
    depths: [3, 3, 6]
    downsampling_factors: [[2, 2], [2, 2], [2, 2]]
  pixel_embedding:
    _target_: "text_recognizer.networks.transformer.embeddings.axial.\
      AxialPositionalEmbeddingImage"
    dim: &hidden_dim 128
    axial_shape: [7, 128]
    axial_dims: [64, 64]
decoder:
  _target_: text_recognizer.networks.text_decoder.TextDecoder
  hidden_dim: *hidden_dim
  num_classes: 58
  pad_index: 3
  decoder:
    _target_: text_recognizer.networks.transformer.Decoder
    dim: *hidden_dim
    depth: 10
    block:
      _target_: text_recognizer.networks.transformer.decoder_block.DecoderBlock
      self_attn:
        _target_: text_recognizer.networks.transformer.Attention
        dim: *hidden_dim
        num_heads: 12
        dim_head: 64
        dropout_rate: &dropout_rate 0.2
        causal: true
      cross_attn:
        _target_: text_recognizer.networks.transformer.Attention
        dim: *hidden_dim
        num_heads: 12
        dim_head: 64
        dropout_rate: *dropout_rate
        causal: false
      norm:
        _target_: text_recognizer.networks.transformer.RMSNorm
        dim: *hidden_dim
      ff:
        _target_: text_recognizer.networks.transformer.FeedForward
        dim: *hidden_dim
        dim_out: null
        expansion_factor: 2
        glu: true
        dropout_rate: *dropout_rate
    rotary_embedding:
      _target_: text_recognizer.networks.transformer.RotaryEmbedding
      dim: 64
  token_pos_embedding:
    _target_: "text_recognizer.networks.transformer.embeddings.fourier.\
      PositionalEncoding"
    dim: *hidden_dim
    dropout_rate: 0.1
    max_len: 89