Download config.py from starcrow/sft_qat: direct link, hf CLI and curl.
- Browser
- Download file 2.12 kB
-
https://huggingface.co/starcrow/sft_qat/resolve/main/config.py
- Command line
-
hf download hf://starcrow/sft_qat/config.py
-
curl -L -o config.py https://huggingface.co/starcrow/sft_qat/resolve/main/config.py
2.12 kB
| """JSONL SFT + QAT-LoRA ํ์ต ์ค์ .""" | |
| from dataclasses import dataclass, field | |
| class PathConfig: | |
| base_model: str = r"/workspace/model" | |
| dataset_path: str = "./data/train.jsonl" | |
| output_dir: str = "./output_sft_qat" | |
| log_file: str = "./logs/train_sft_qat.log" | |
| checkpoint_dir: str = "./output_sft_qat" | |
| class DataConfig: | |
| # auto: messages, instruction/output, prompt/completion ์ ํ๋ณ๋ก ์๋ ๊ฐ์ง | |
| format: str = "auto" | |
| class LoraConfig: | |
| r: int = 64 | |
| lora_alpha: int = 128 | |
| lora_dropout: float = 0.05 | |
| target_modules: list = field(default_factory=lambda: [ | |
| "q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj" | |
| ]) | |
| bias: str = "none" | |
| task_type: str = "CAUSAL_LM" | |
| class QATConfig: | |
| enabled: bool = True | |
| block_size: int = 32 | |
| quant_warmup_steps: int = 0 | |
| target_modules: list | None = None | |
| class TrainingConfig: | |
| max_seq_length: int = 4063 | |
| seed: int = 42 | |
| per_device_train_batch_size: int = 1 | |
| gradient_accumulation_steps: int = 8 | |
| num_train_epochs: int = 1 | |
| max_steps: int = -1 | |
| learning_rate: float = 2e-4 | |
| lr_scheduler_type: str = "cosine" | |
| warmup_ratio: float = 0.05 | |
| weight_decay: float = 0.01 | |
| optim: str = "paged_adamw_8bit" | |
| bf16: bool = True | |
| fp16: bool = False | |
| tf32: bool = True | |
| logging_steps: int = 10 | |
| save_steps: int = 200 | |
| save_total_limit: int = 3 | |
| report_to: str = "none" | |
| dataloader_num_workers: int = 0 | |
| gradient_checkpointing: bool = True | |
| ddp_find_unused_parameters: bool = False | |
| class SFTConfig: | |
| paths: PathConfig = field(default_factory=PathConfig) | |
| data: DataConfig = field(default_factory=DataConfig) | |
| lora: LoraConfig = field(default_factory=LoraConfig) | |
| training: TrainingConfig = field(default_factory=TrainingConfig) | |
| qat: QATConfig = field(default_factory=QATConfig) | |
| def __post_init__(self): | |
| if self.qat.target_modules is None: | |
| self.qat.target_modules = self.lora.target_modules | |
| DEFAULT_CONFIG = SFTConfig() | |