File size: 1,353 Bytes
f030d3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fd05733
f030d3a
 
 
 
 
 
fd05733
 
 
 
f030d3a
 
 
 
 
 
 
5da4724
f030d3a
 
 
 
 
fd05733
f030d3a
 
65db57d
fd05733
 
 
 
65db57d
 
 
 
 
 
 
 
1d2f1ad
 
 
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
from dataclasses import dataclass
from pathlib import Path

@dataclass(frozen=True)
class DataIngestionConfig:
    root_dir : Path
    source_URL : str
    local_data_file : Path
    unzip_dir : Path
    
    
@dataclass(frozen=True)
class DataValidationConfig:
    root_dir : Path
    STATUS_FILE : str
    ALL_REQUIRED_FILES : list
    data_dir : Path
    
    
@dataclass(frozen=True)
class DataTransformationConfig:
    root_dir: Path
    data_path: Path
    tokenizer_name: str
    # dev quick-run options
    dev_run: bool = False
    dev_model: str | None = None
    
    
    
@dataclass(frozen=True)
class ModelTrainerConfig:
    root_dir: Path
    data_path: Path
    model_ckpt: str
    num_train_epochs: int
    warmup_steps: int
    per_device_train_batch_size: int
    weight_decay: float
    logging_steps: int
    eval_strategy: str
    eval_steps: int
    save_steps: float
    gradient_accumulation_steps: int   
    # dev / quick-train options
    dev_run: bool = False
    dev_model: str | None = None
    dev_subset: int = 0
    
    
@dataclass(frozen=True)
class ModelEvaluationConfig:
    root_dir: Path
    data_path: Path
    model_path: Path
    tokenizer_path: Path
    metric_file_name: Path
    # Hub model ID used as fallback when the local fine-tuned model is absent
    hub_model_id: str = "google/pegasus-cnn_dailymail"