File size: 1,118 Bytes
ac5c307
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""All hyperparameters for Kat in one place."""
from dataclasses import dataclass
from pathlib import Path

ROOT = Path(__file__).parent
DATA_DIR = ROOT / "data"

# Special tokens. Kept as literal strings so data.py can write them into the
# text files before a tokenizer exists.
USER, BOT, EOS, PAD = "<|user|>", "<|bot|>", "<|eos|>", "<|pad|>"
SPECIALS = [PAD, USER, BOT, EOS]


@dataclass
class DataConfig:
    dataset: str = "li2017dailydialog/daily_dialog"
    # The main branch ships only a loading script, which datasets>=4 refuses to
    # run. The auto-converted parquet branch carries the actual data.
    revision: str = "refs/convert/parquet"
    lowercase: bool = True


@dataclass
class ModelConfig:
    vocab_size: int = 8000
    block_size: int = 128
    n_layer: int = 4
    n_head: int = 4
    n_embd: int = 256
    dropout: float = 0.1


@dataclass
class TrainConfig:
    batch_size: int = 32
    max_steps: int = 4000
    lr: float = 3e-4
    warmup_steps: int = 100
    weight_decay: float = 0.1
    grad_clip: float = 1.0
    eval_every: int = 250
    eval_batches: int = 40
    seed: int = 1337