File size: 613 Bytes
559e904
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from dataclasses import dataclass

import torch


@dataclass
class TrainConfig:
    data_dir: str = "../data"
    resume_from_checkpoint: str | None = None
    project_name: str = "Plot2Eq"

    batch_size: int = 256
    epochs: int = 1000
    lr: float = 3e-4
    weight_decay: float = 0.05
    warmup_ratio: float = 0.05
    max_grad_norm: float = 1.0

    d_model: int = 512
    nhead: int = 8
    num_enc_layers: int = 4
    num_dec_layers: int = 4
    dropout: float = 0.1
    max_seq_len: int = 128
    label_smoothing: float = 0.1

    device = torch.device("cuda" if torch.cuda.is_available() else "cpu")