| 118 | |
| 119 | @dataclass |
| 120 | class TrainingArguments(transformers.TrainingArguments): |
| 121 | ddp_timeout: int = 36000 |
| 122 | base_dir: str = "." |
| 123 | output_dir: str = "output" |
| 124 | save_dir: str = "checkpoints" |
| 125 | save_part_checkpoints: bool = True |
| 126 | data_dir: str = ".cache" |
| 127 | eval_on_start: bool = True |
| 128 | eval_strategy: str = "steps" |
| 129 | eval_steps: int = 5000 |
| 130 | eval_delay: int = 0 |
| 131 | per_device_train_batch_size: int = 32 |
| 132 | per_device_eval_batch_size: int = 1 |
| 133 | gradient_accumulation_steps: int = 1 |
| 134 | optim: str = "adamw_torch" |
| 135 | learning_rate: float = 1e-4 |
| 136 | weight_decay: float = 1.0e-08 |
| 137 | # weight_decay: float = 0.01 |
| 138 | adam_beta1: float = 0.9 |
| 139 | adam_beta2: float = 0.95 |
| 140 | adam_epsilon: float = 1e-8 |
| 141 | gradient_clipping: float = 1.0 |
| 142 | max_grad_norm: float = 1.0 |
| 143 | lr_scheduler_type: str = "cosine_with_min_lr" |
| 144 | lr_scheduler_kwargs: dict = field(default_factory=lambda: {"min_lr": 1e-5}) |
| 145 | logging_steps: int = 10 |
| 146 | warmup_steps: int = 5000 |
| 147 | save_strategy: str = "steps" |
| 148 | save_steps: int = 5000 |
| 149 | save_total_limit: int = 1 |
| 150 | restore_callback_states_from_checkpoint: bool = True |
| 151 | seed: int = 42 |
| 152 | data_seed: int = 42 |
| 153 | bf16: bool = True |
| 154 | tf32: bool = True |
| 155 | dataloader_num_workers: int = 32 |
| 156 | datasets_num_proc: int = os.getenv("OMP_NUM_THREADS", 12) |
| 157 | dataloader_persistent_workers: bool = False |
| 158 | dataloader_pin_memory: bool = True |
| 159 | dataloader_drop_last: bool = True |
| 160 | remove_unused_columns: bool = False |
| 161 | run_name: str = "test" |
| 162 | report_to: str = "wandb" |
| 163 | ddp_find_unused_parameters: bool = False |
| 164 | overwrite_output_dir: bool = False |
| 165 | resume_from_checkpoint: str = None |
| 166 | disable_tqdm: bool = True |
| 167 | |
| 168 | def __post_init__(self): |
| 169 | try: |
| 170 | self = possible_override_args(override_args, self) |
| 171 | self = get_full_dirs(self) |
| 172 | except (FileNotFoundError, yaml.YAMLError) as exc: |
| 173 | print(f"Failed to load override config: {exc}") |
| 174 | super().__post_init__() |
| 175 | |
| 176 | |
| 177 | if __name__ == "__main__": |
nothing calls this directly
no outgoing calls
no test coverage detected